點擊出現(xiàn)彈框,監(jiān)聽點擊其他地方 就可以 關(guān)閉彈框
code:
watch: {
show (val) {
if (val) document.addEventListener('click', this.hide, true)
}
}
// hide 方法
hide () {
this.show = false
}
這樣就可以了
點擊出現(xiàn)彈框,監(jiān)聽點擊其他地方 就可以 關(guān)閉彈框
code:
watch: {
show (val) {
if (val) document.addEventListener('click', this.hide, true)
}
}
// hide 方法
hide () {
this.show = false
}
這樣就可以了