CN-599 feat: 新报告大部分功能
This commit is contained in:
@@ -277,74 +277,6 @@ export const cancelWithChange = {
|
||||
delete el.__vueDomClick__
|
||||
}
|
||||
}
|
||||
/* clickOutside指令 */
|
||||
const exceptClassName = ['prevent-click-outside'] // clickOutside排除的class(白名单)
|
||||
export const clickOutside = {
|
||||
// 初始化指令
|
||||
beforeMount (el, binding) {
|
||||
/* let oldValue
|
||||
try {
|
||||
oldValue = JSON.parse(JSON.stringify(binding.value.object))
|
||||
} catch (e) {
|
||||
|
||||
} */
|
||||
function documentHandler (e) {
|
||||
if (el.contains(e.target)) {
|
||||
return false
|
||||
} else {
|
||||
let flag = true
|
||||
const path = e.path || (e.composedPath && e.composedPath())
|
||||
// eslint-disable-next-line no-labels
|
||||
top: for (let i = 0; i < path.length; i++) {
|
||||
for (let j = 0; j < exceptClassName.length; j++) {
|
||||
if (path[i].className && path[i].className.indexOf(exceptClassName[j]) !== -1) {
|
||||
flag = false
|
||||
// eslint-disable-next-line no-labels
|
||||
break top
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
return false
|
||||
}
|
||||
binding.value()
|
||||
/* if (oldValue) {
|
||||
const newValue = JSON.parse(JSON.stringify(binding.value.oldValue))
|
||||
if (!isEqual(oldValue, newValue)) {
|
||||
ElMessageBox.confirm('Confirm?', { // TODO 国际化
|
||||
confirmButtonText: 'Yes', // TODO 国际化
|
||||
cancelButtonText: 'No', // TODO 国际化
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
if (binding.value.func) {
|
||||
binding.value.func()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
binding.value.func()
|
||||
}
|
||||
} else {
|
||||
if (binding.arg) {
|
||||
binding.value(e, binding.arg)
|
||||
} else {
|
||||
if (binding.value) {
|
||||
binding.value(e)
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
// 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
|
||||
el.__vueClickOutside__ = documentHandler
|
||||
document.addEventListener('click', documentHandler)
|
||||
},
|
||||
unmounted (el, binding) {
|
||||
// 解除事件监听
|
||||
document.removeEventListener('click', el.__vueClickOutside__)
|
||||
delete el.__vueClickOutside__
|
||||
}
|
||||
}
|
||||
|
||||
function noDataDomFactory () {
|
||||
const noDataDom = document.createElement('div')
|
||||
|
||||
Reference in New Issue
Block a user