Vue development --ElementUI the switch callback function parameters of the problem of change

<el-switch
	 v-model="value1"
	 @change='changeStatus($event,1)'>
</el-switch>
<el-switch
	 v-model="value2"
	 @change='changeStatus($event,2)'>
</el-switch>
<script>
 var vm = new Vue({
	 el: "#app",
	 data: {
	  value1: true,
	  value2: false
	 },
	 methods: {
	  	change: function($event,num){
		  console.log($event);  // 默认参数,当前状态改变值
		  console.log(num);   // 自定义参数
	  	}
	 }
 })
</script>

Guess you like

Origin blog.csdn.net/samarket/article/details/91491572