<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>