vue的模拟点击
emer 发布于 2018-6-12 09:15 3463 次阅读
<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>