watch: {
show(value) {
if (value && !this.clickNotClose) {
this.addEventClick()
}
}
methods: {
addEventClick() {
window.addEventListener('click', this.closeSidebar)
},
closeSidebar(evt) {
const parent = evt.target.closest('.rightPanel')
if (!parent) {
this.show = false
window.removeEventListener('click', this.closeSidebar)
}
},
}
}
笔记用
闭眼打键盘