Commit d1a2dbeb authored by 何虹's avatar 何虹 💬

优化

parent d2901c7e
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"sortablejs": "^1.12.0", "sortablejs": "^1.12.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-click-outside": "^1.1.0",
"vue-codemirror": "^4.0.6", "vue-codemirror": "^4.0.6",
"vue-qr": "^2.3.0", "vue-qr": "^2.3.0",
"vue-video-player": "^5.0.2", "vue-video-player": "^5.0.2",
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<template v-else-if="item.type==='elDatePicker'"> <template v-else-if="item.type==='elDatePicker'">
<el-date-picker <el-date-picker
ref='currentDom' ref='currentDom'
v-clickoutside="hidePicker" v-click-outside="hidePicker"
clearable clearable
style="width:100%" style="width:100%"
size='mini' size='mini'
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
<template v-else-if="item.type==='elDatePickerDatetime'"> <template v-else-if="item.type==='elDatePickerDatetime'">
<el-date-picker <el-date-picker
ref='currentDom' ref='currentDom'
v-clickoutside="hidePicker"
clearable clearable
style="width:100%" style="width:100%"
size='mini' size='mini'
...@@ -56,7 +55,7 @@ ...@@ -56,7 +55,7 @@
<template v-else-if="item.type==='elDatePickerDate'"> <template v-else-if="item.type==='elDatePickerDate'">
<el-date-picker <el-date-picker
ref='currentDom' ref='currentDom'
v-clickoutside="hidePicker" v-click-outside="hidePicker"
clearable clearable
style="width:100%" style="width:100%"
size='mini' size='mini'
...@@ -70,7 +69,7 @@ ...@@ -70,7 +69,7 @@
<template v-else-if="item.type==='elDatePickerMonth'"> <template v-else-if="item.type==='elDatePickerMonth'">
<el-date-picker <el-date-picker
ref='currentDom' ref='currentDom'
v-clickoutside="hidePicker" v-click-outside="hidePicker"
clearable clearable
style="width:100%" style="width:100%"
size='mini' size='mini'
...@@ -84,7 +83,7 @@ ...@@ -84,7 +83,7 @@
<template v-else-if="item.type==='elDatePickerMonthRange'"> <template v-else-if="item.type==='elDatePickerMonthRange'">
<el-date-picker <el-date-picker
ref='currentDom' ref='currentDom'
v-clickoutside="hidePicker" v-click-outside="hidePicker"
clearable clearable
style="width:100%" style="width:100%"
size='mini' size='mini'
...@@ -394,12 +393,13 @@ ...@@ -394,12 +393,13 @@
</template> </template>
<script> <script>
// import elementUiMinins from '../../ucClass/elementUiMinins' // import elementUiMinins from '../../ucClass/elementUiMinins'
import clickOutSide from '../../ucClass/click-out-side' // import clickOutSide from '../../ucClass/click-out-side'
import ClickOutside from 'vue-click-outside'
export default { export default {
// mixins: [elementUiMinins], // mixins: [elementUiMinins],
name: 'dyncFormItemComponentChild', name: 'dyncFormItemComponentChild',
directives: { directives: {
clickoutside: clickOutSide ClickOutside
}, },
props: { props: {
type: {}, type: {},
...@@ -407,6 +407,9 @@ export default { ...@@ -407,6 +407,9 @@ export default {
formParms: {} formParms: {}
}, },
methods: { methods: {
hidePicker1() {
this.$refs.currentDom.hidePicker()
},
hidePicker() { hidePicker() {
this.$refs.currentDom.hidePicker() this.$refs.currentDom.hidePicker()
}, },
......
export default {
bind(el, binding, vnode) {
el.handler = function(e) {
if (el.contains(e.target)) {
return false
}
// vnode.context[binding.expression] = false
binding.value()
}
el.stopProp = function(event) {
event.stopPropagation()
}
el.addEventListener('click', el.stopProp)
document.body.addEventListener('click', el.handler)
},
unbind(el, binding) {
el.removeEventListener('click', el.stopProp)
document.body.removeEventListener('click', el.handler)
},
install(Vue) {
Vue.directive('clickoutside', {
bind: this.bind,
unbind: this.unbind
})
}
}
...@@ -6,17 +6,18 @@ export default { ...@@ -6,17 +6,18 @@ export default {
return false return false
} }
// vnode.context[binding.expression] = false // vnode.context[binding.expression] = false
binding.value() binding.value()
} }
el.stopProp = function(event) { el.stopProp = function(event) {
event.stopPropagation() event.stopPropagation()
} }
el.addEventListener('click', el.stopProp) el.addEventListener('click', el.stopProp)
document.body.addEventListener('click', el.handler, false) document.body.addEventListener('click', el.handler)
}, },
unbind(el, binding) { unbind(el, binding) {
el.removeEventListener('click', el.stopProp) el.removeEventListener('click', el.stopProp)
document.body.removeEventListener('click', el.handler, false) document.body.removeEventListener('click', el.handler)
}, },
install(Vue) { install(Vue) {
Vue.directive('clickoutside', { Vue.directive('clickoutside', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment