vue学习-vue回调中有参数,页面需要新加参数

1.回调页面方法 
this. $emit( "edit", type);

回调中只有一个参数type

2.但是在父页面需要往该回调函数中增加新参数index

写法需如下:

v-on:edit-panel=' edit( index, $event)'

即需要在新增加的参数后面加上$event

3.在父页面实现该回调函数时,写法如下:

edit : function( index, type) {}
即,在父页面新添加的参数,要写在该回调函数原有参数前面,否则,赋值顺序不对

猜你喜欢

转载自blog.csdn.net/liudan302698481/article/details/80856507