Commit b75ad4a1206ff67d7d86b77eb3c6551d9aae6269
1 parent
6ed0cd73
fixed #1700
Showing
2 changed files
with
16 additions
and
16 deletions
Show diff stats
examples/routers/poptip.vue
| 1 | 1 | <template> |
| 2 | - <div style="margin: 100px;"> | |
| 3 | - <Poptip | |
| 4 | - confirm | |
| 5 | - transfer | |
| 6 | - title="您确认删除这条内容吗?" | |
| 7 | - @on-ok="ok" | |
| 8 | - @on-cancel="cancel"> | |
| 9 | - <Button>删除</Button> | |
| 10 | - </Poptip> | |
| 11 | - <Poptip | |
| 12 | - confirm | |
| 13 | - title="您确认删除这条内容吗?" | |
| 14 | - @on-ok="ok" | |
| 15 | - @on-cancel="cancel"> | |
| 16 | - <Button>删除</Button> | |
| 2 | + <div style="margin: 200px;"> | |
| 3 | + <Poptip title="提示标题" transfer> | |
| 4 | + <div slot="content" style="padding: 50px"> | |
| 5 | + <Button>click me</Button> | |
| 6 | + </div> | |
| 7 | + <Button>click 激活</Button> | |
| 17 | 8 | </Poptip> |
| 18 | 9 | </div> |
| 19 | 10 | </template> | ... | ... |
src/components/poptip/poptip.vue
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | :style="styles" |
| 19 | 19 | ref="popper" |
| 20 | 20 | v-show="visible" |
| 21 | + @click="handleTransferClick" | |
| 21 | 22 | @mouseenter="handleMouseenter" |
| 22 | 23 | @mouseleave="handleMouseleave" |
| 23 | 24 | :data-transfer="transfer" |
| ... | ... | @@ -102,7 +103,8 @@ |
| 102 | 103 | return { |
| 103 | 104 | prefixCls: prefixCls, |
| 104 | 105 | showTitle: true, |
| 105 | - isInput: false | |
| 106 | + isInput: false, | |
| 107 | + disableCloseUnderTransfer: false, // transfer 模式下,点击 slot 也会触发关闭 | |
| 106 | 108 | }; |
| 107 | 109 | }, |
| 108 | 110 | computed: { |
| ... | ... | @@ -156,7 +158,14 @@ |
| 156 | 158 | } |
| 157 | 159 | this.visible = !this.visible; |
| 158 | 160 | }, |
| 161 | + handleTransferClick () { | |
| 162 | + if (this.transfer) this.disableCloseUnderTransfer = true; | |
| 163 | + }, | |
| 159 | 164 | handleClose () { |
| 165 | + if (this.disableCloseUnderTransfer) { | |
| 166 | + this.disableCloseUnderTransfer = false; | |
| 167 | + return false; | |
| 168 | + } | |
| 160 | 169 | if (this.confirm) { |
| 161 | 170 | this.visible = false; |
| 162 | 171 | return true; | ... | ... |