3***@qq.com
3***@qq.com
  • 发布:2020-08-19 19:14
  • 更新:2021-07-16 10:58
  • 阅读:844

【报Bug】微信小程序下for循环里的其他标签特殊写法会导致该循环里的自定义组件上的v-model取值错误

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 2.8.6

第三方开发者工具版本号: 1.03.2006090

基础库版本号: 2.12.1

项目创建方式: HBuilderX

示例代码:

<template>
<view>
<view v-for="item in list" :key="item.goodsName">
<text>{{ nameFn(item) }}</text> // 这种写法会导致自定义组件clear-btn-input的v-model item.qty取值错误
<text>{{ ${item.goodsName}: ${item.qty} }}</text> // 这种写法自定义组件clear-btn-input的v-model item.qty取值正确
<clear-btn-input type="number" v-model="item.qty" placeholder="请输入金额"></clear-btn-input>
</view>
</view>
</template>

<script>
import clearBtnInput from "@/components/mine/form/clearBtnInput.vue"

export default{  
    name:"",  
    components: {  
        clearBtnInput  
    },  
    data() {  
        return {  
            list: [{  
                auxiliaryUnit2Name: "套",  
                conversionRelation2: 10,  
                expiredTime: null,  
                goodsAttrName: "川味,",  
                goodsBarcode: "90909090",  
                goodsBrandNoName: "欣果",  
                goodsClassIdName: null,  
                goodsName: "cml测试",  
                id: "98864194295695278",  
                linkCode: "1",  
                listId: "98859976386150644",  
                locationNo: "98765622329999404",  
                locationNoName: "002",  
                mainImage: null,  
                orderBy: null,  
                orderMode: null,  
                packSpecificationName: "1瓶*2瓶*5.00件",  
                qty: 23,  
                search: null,  
                selectParam: null,  
                taskId: "98859976386150642",  
                unit: "1000",  
                unitFlag: null,  
                unitName: "瓶",  
            }]  
        }  
    },  
    filters: {  
        aaa(item) {  
            return `${item.goodsName}: ${item.qty}`  
        }  
    },  
    onLoad() {  

    },  
    methods: {  
        nameFn(item) {  
            return `${item.goodsName}: ${item.qty}`  
        }  
    },  
}  

</script>

<style lang="scss">
</style>

操作步骤:

附件有代码,运行即可

预期结果:

其他标签写法不影响自定义组件的取值

实际结果:

for循环里的其他标签特殊写法会导致该循环里的自定义组件上的v-model取值错误

bug描述:

微信小程序下for循环里的其他标签特殊写法会导致该循环里的自定义组件上的v-model取值错误

2020-08-19 19:14 负责人:无 分享
已邀请:
7***@qq.com

7***@qq.com

我也碰到了 ,这种问题 小程序应该如何解决呢

[已删除]

[已删除]

哈哈 {{ item.goodsName + ':' + item.qty }}这样试试呢?函数里面直接去掉{{}}就好了

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