Commit b75ad4a1206ff67d7d86b77eb3c6551d9aae6269

Authored by 梁灏
1 parent 6ed0cd73

fixed #1700

examples/routers/poptip.vue
1 <template> 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 </Poptip> 8 </Poptip>
18 </div> 9 </div>
19 </template> 10 </template>
src/components/poptip/poptip.vue
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 :style="styles" 18 :style="styles"
19 ref="popper" 19 ref="popper"
20 v-show="visible" 20 v-show="visible"
  21 + @click="handleTransferClick"
21 @mouseenter="handleMouseenter" 22 @mouseenter="handleMouseenter"
22 @mouseleave="handleMouseleave" 23 @mouseleave="handleMouseleave"
23 :data-transfer="transfer" 24 :data-transfer="transfer"
@@ -102,7 +103,8 @@ @@ -102,7 +103,8 @@
102 return { 103 return {
103 prefixCls: prefixCls, 104 prefixCls: prefixCls,
104 showTitle: true, 105 showTitle: true,
105 - isInput: false 106 + isInput: false,
  107 + disableCloseUnderTransfer: false, // transfer 模式下,点击 slot 也会触发关闭
106 }; 108 };
107 }, 109 },
108 computed: { 110 computed: {
@@ -156,7 +158,14 @@ @@ -156,7 +158,14 @@
156 } 158 }
157 this.visible = !this.visible; 159 this.visible = !this.visible;
158 }, 160 },
  161 + handleTransferClick () {
  162 + if (this.transfer) this.disableCloseUnderTransfer = true;
  163 + },
159 handleClose () { 164 handleClose () {
  165 + if (this.disableCloseUnderTransfer) {
  166 + this.disableCloseUnderTransfer = false;
  167 + return false;
  168 + }
160 if (this.confirm) { 169 if (this.confirm) {
161 this.visible = false; 170 this.visible = false;
162 return true; 171 return true;