<template>
<div>
//三:绑定事件
//这是我封装的一个组件我在该组件上绑定了事件
<screenNavigation ref="leftclick" v-clickoutside="handleClickOutside"></screenNavigation>
</div>
<template>
<script>
//一:引入
import Clickoutside from 'element-ui/src/utils/clickoutside'
import screenNavigation from './screenNavigation.vue'
export default {
//二:注册
directives: { Clickoutside },
components:{screenNavigation},
data() {
return {
}
},
components:{screenNavigation},
created() {
},
methods: {
//四:事件处理函数
handleClickOutside(){
this.$refs.leftclick.listShow=false
},
}
}
</script>
v-clickoutside vue点击某个区域外会触发的事件
于 2023-03-04 15:13:59 首次发布