vuer如何绑定原生DOM事件?
a.vue
<template>
<div class="hospital-info">
<div id="box" ref="box"></div>
</div>
</template>
<script>
export default {
mounted(){
var box = this.$refs.box;
box.addEventListener('mouseover',()=>{
alert(1);
})
}
}
</script>
<style>
#box {
width: 200px;
height: 200px;
background-color: #f00;
}
</style>
效果:但数据移入红色区域时,alert(1).但是,实现不了?
用原生js,用Jquery操作,都不行!如何给固定DOM绑定DOM的原生事件,如mouseover,scroll;
官方文档