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> <template>
<el-row :gutter="10" class="json-path-suggest-button"> <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}} {{openTip}}
</el-button> </el-button>
<el-button size="small" type="danger" @click="$emit('clear')"> <el-button size="small" type="danger" @click="$emit('clear')">

View File

@ -1,5 +1,5 @@
<template> <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> <template v-slot:header>
<ms-instructions-icon :content="tip"/> <ms-instructions-icon :content="tip"/>
{{tip}} {{tip}}
@ -13,9 +13,37 @@ import MsDrawer from "../../../../common/components/MsDrawer";
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon"; import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
let dotReplace = "#DOT_MASK#"; 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 { export default {
name: "MsApiJsonpathSuggest", name: "MsApiJsonpathSuggest",
components: {MsInstructionsIcon, MsDrawer}, components: {MsInstructionsIcon, MsDrawer},
directives: { clickoutside },
data() { data() {
return { return {
visible: false, visible: false,

View File

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