vue如何触发某个元素的单击事件?
<a class="link" @click.native="test">1111</a>
<a class="link" @click.native="test">2222</a>
<a class="link" @click.native="test">333</a>
<button @test='shout'>点击我触发a的单击事件</button>
<script type="text/javascript">
var vm = new Vue({
el:"#app",
methods: {
test: function () {
console.log(1);
this.$emit('test');//把a标签的点击事件分发
},
shout:function () {
console.log('我触发了它');
}
}
})
</script>
应该是这样的。待考察