-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!-- 自定义指令测试 --> | ||
<template> | ||
<div> | ||
<el-button | ||
v-clickoutside="clickoutside" | ||
v-focus | ||
type="primary" | ||
@focus.native="focus" | ||
@click="click" | ||
> | ||
点我 | ||
</el-button> | ||
<div>{{ message }}</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'CustomDirectiveView', | ||
data() { | ||
return { | ||
message: '', | ||
firstFocus: true | ||
} | ||
}, | ||
methods: { | ||
clickoutside() { | ||
this.message = '你为什么不点我!😠' | ||
}, | ||
click() { | ||
this.message = '你点了我!😄' | ||
}, | ||
focus() { | ||
if (this.firstFocus) { | ||
this.message = '刚进来就聚焦在我身上!😎' | ||
this.firstFocus = false | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> |