fix(推荐断言弹框可以点击空白关闭): 推荐断言弹框可以点击空白关闭

This commit is contained in:
song.tianyang 2021-03-30 11:44:35 +08:00
parent e56e2e19b5
commit 33e0207d84
3 changed files with 40 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<template>
<el-row :gutter="10" class="json-path-suggest-button">
<el-button size="small" type="primary" @click="$emit('open')">
<el-button size="small" type="primary" @click="$emit('open')" @click.stop>
{{openTip}}
</el-button>
<el-button size="small" type="danger" @click="$emit('clear')">

View File

@ -1,5 +1,5 @@
<template>
<ms-drawer class="json-path-picker" :visible="visible" :size="30" @close="close" direction="right">
<ms-drawer class="json-path-picker" :visible="visible" :size="30" @close="close" direction="right" v-clickoutside="close">
<template v-slot:header>
<ms-instructions-icon :content="tip"/>
{{tip}}
@ -13,9 +13,37 @@ import MsDrawer from "../../../../common/components/MsDrawer";
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
let dotReplace = "#DOT_MASK#";
const clickoutside = {
//
bind (el, binding, vnode) {
function documentHandler (e) {
//
if (el.contains(e.target)) {
return false
}
//
if (binding.expression) {
// binding.valuehandleClose
binding.value(e)
}
}
// 便unbind
el.__vueClickOutside__ = documentHandler
document.addEventListener('click', documentHandler)
},
update () { },
unbind (el, binding) {
//
document.removeEventListener('click', el.__vueClickOutside__)
delete el.__vueClickOutside__
}
}
export default {
name: "MsApiJsonpathSuggest",
components: {MsInstructionsIcon, MsDrawer},
directives: { clickoutside },
data() {
return {
visible: false,

View File

@ -454,14 +454,18 @@
item.tags = JSON.parse(item.tags);
}
})
if (this.$refs.apiDefinitionTable) {
setTimeout(() => {
this.$refs.apiDefinitionTable.doLayout();
this.result.loading = false;
}, 500)
}
// if (this.$refs.apiDefinitionTable) {
// setTimeout(() => {
// this.$refs.apiDefinitionTable.doLayout();
// this.result.loading = false;
// }, 500)
// }
// nexttick:
this.$nextTick(function(){
if (this.$refs.apiDefinitionTable) {
this.$refs.apiDefinitionTable.doLayout();
this.result.loading = false;
}
this.checkTableRowIsSelect();
})
});