代码如下:
<swiper :current="tabIndex" class="swiper-box" style="flex: 1;" :duration="300" @change="ontabchange">
<swiper-item class="swiper-item" v-for="(tab,index1) in list" :key="index1">
<longForm :fields="handle" v-on:submitForm="changePregList"></longForm>
</swiper-item>
</swiper>
longForm 中设置监听 fields ,无法监听到值传递。
watch:{
fields:function(newvalue, old){
console.log(newvalue); // 此处设置的打印并没有被调用 无任何输出
}
}
当去除掉swiper 只使用组件时,是能正常输出的。
<longForm :fields="handle" v-on:submitForm="changePregList"></longForm> // 这样是能正常打印 fields
求教,何解?
1 个回复
4***@qq.com - 90后程序员
我也遇到这个问题了,请问解决了吗