Vue自定义的组件上@click点击事件【失效】问题
代码如下:/*写的right_fixed组件*/Vue.component('right_fixed',{props:['message','top'],template:`<div class="intetral_details_btn">{{message}}</div>`})/* ri...
·
代码如下:
/*写的right_fixed组件*/
Vue.component('right_fixed',{
props:['message','top'],
template:`
<div class="intetral_details_btn">
{{message}}
</div>
`
})
/* right_fixed 组件的使用*/
<right_fixed message="侧边悬浮" style="top:345px" @click="toGuessMall()"></right_fixed>
问题描述:
添加的点击事件 @click = "toGuessMall( )" 是不起作用的,点击事件失效了。
解决办法:
在自定义的组件上的绑定原生事件得添加 .native 来完成。即:@click.native=""
代码展示:
<right_fixed message="侧边悬浮" style="top:345px" @click.native="toGuessMall()"></right_fixed>
------完。
更多推荐
已为社区贡献18条内容
所有评论(0)