伊呀程序
伊呀程序
  • 发布:2019-09-22 11:37
  • 更新:2021-05-26 18:46
  • 阅读:921

swiper内部使用自定义组件传参不生效问题

分类:uni-app

代码如下:

<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

求教,何解?

2019-09-22 11:37 负责人:无 分享
已邀请:
4***@qq.com

4***@qq.com - 90后程序员

我也遇到这个问题了,请问解决了吗

该问题目前已经被锁定, 无法添加新回复