vue同时传递到event和其他参数

Posted on 2020-05-04 16:55  猫头唔食鱼  阅读(2157)  评论(0编辑  收藏  举报

这样写就可以了

@click="test(...arguments,1)"

例子:

<template>
<div>
  <button @click="test(...arguments,1)">点击</button>
</div>
</template>
<script>
export default {
  name: "HelloWorld",
  data () {
    return {
    };
  },
  methods: {
    test(e,num){
      console.log(e);  // event对象
      console.log(num); // 1
    }
  },
}
</script>
<style lang="css" scoped>
</style>