Commit 7f1edb6a1596ef4d06e0b35624ed325952196223
1 parent
99f80db0
Poptip、Tooltip add on-popper-hide event
Poptip、Tooltip add on-popper-hide event
Showing
3 changed files
with
18 additions
and
5 deletions
Show diff stats
src/components/base/popper.js
... | ... | @@ -43,7 +43,12 @@ export default { |
43 | 43 | } |
44 | 44 | }, |
45 | 45 | visible(val) { |
46 | - val ? this.updatePopper() : this.destroyPopper(); | |
46 | + if (val) { | |
47 | + this.updatePopper(); | |
48 | + } else { | |
49 | + this.destroyPopper(); | |
50 | + this.$emit('on-popper-hide'); | |
51 | + } | |
47 | 52 | this.$emit('input', val); |
48 | 53 | } |
49 | 54 | }, | ... | ... |
test/routers/poptip.vue
... | ... | @@ -132,7 +132,7 @@ |
132 | 132 | <!--<Poptip title="标题" content="内容" trigger="hover">--> |
133 | 133 | <!--<Button>hover 触发</Button>--> |
134 | 134 | <!--</Poptip>--> |
135 | - <Poptip title="确定删除这条信息吗?" confirm content="内容" trigger="focus" @on-ok="ok" @on-cancel="cancel"> | |
135 | + <Poptip title="确定删除这条信息吗?" confirm content="内容" trigger="focus" @on-ok="ok" @on-cancel="cancel" @on-popper-hide="hide"> | |
136 | 136 | <a><strong>Delete</strong></a> |
137 | 137 | </Poptip> |
138 | 138 | <!--<Poptip title="标题" content="内容" trigger="focus">--> |
... | ... | @@ -174,6 +174,9 @@ |
174 | 174 | }, |
175 | 175 | cancel () { |
176 | 176 | Message.info('cancel'); |
177 | + }, | |
178 | + hide () { | |
179 | + Message.info('hide') | |
177 | 180 | } |
178 | 181 | } |
179 | 182 | } | ... | ... |
test/routers/tooltip.vue
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | </style> |
17 | 17 | <template> |
18 | 18 | <div class="top"> |
19 | - <Tooltip content="Top Left 文字提示" placement="top-start"> | |
19 | + <Tooltip content="Top Left 文字提示" placement="top-start" @on-popper-hide="hide"> | |
20 | 20 | <i-button>上左</i-button> |
21 | 21 | </Tooltip> |
22 | 22 | <Tooltip content="Top Center 文字提示" placement="top"> |
... | ... | @@ -63,8 +63,13 @@ |
63 | 63 | </div> |
64 | 64 | </template> |
65 | 65 | <script> |
66 | - import { Tooltip, iButton } from 'iview'; | |
66 | + import { Tooltip, iButton, Message } from 'iview'; | |
67 | 67 | export default { |
68 | - components: { Tooltip, iButton } | |
68 | + components: { Tooltip, iButton }, | |
69 | + methods: { | |
70 | + hide () { | |
71 | + Message.info('hide') | |
72 | + } | |
73 | + } | |
69 | 74 | } |
70 | 75 | </script> | ... | ... |