Fix(商品):[#1015]规格改为包含小数点的名称后,无法操作
This commit is contained in:
@@ -24,14 +24,14 @@
|
||||
:key="indexn"
|
||||
:class="{
|
||||
'on': item.index == indexn,
|
||||
'disabled': productValue[itemn.attr].stock === 0
|
||||
'disabled': getAttrItemData(itemn.attr).stock === 0
|
||||
}"
|
||||
class="itemn"
|
||||
@click="tapAttr(indexw, indexn, itemn)"
|
||||
>
|
||||
{{ itemn.attr }}
|
||||
<text
|
||||
v-if="productValue[itemn.attr].stock === 0"
|
||||
v-if="getAttrItemData(itemn.attr).stock === 0"
|
||||
class="tag"
|
||||
>缺货</text>
|
||||
</view>
|
||||
@@ -71,6 +71,12 @@ export default {
|
||||
type: String,
|
||||
default: '{}'
|
||||
},
|
||||
productValueArr: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
cartNum: {
|
||||
type: Number,
|
||||
default: () => 1
|
||||
@@ -91,12 +97,18 @@ export default {
|
||||
CartNumAdd: function() {
|
||||
this.$emit("changeFun", { action: "ChangeCartNum", value: 1 })
|
||||
},
|
||||
tapAttr: function(indexw, indexn, itemn) {
|
||||
const productValue = JSON.parse(this.productValueStr || '{}')
|
||||
if (productValue[itemn.attr]) {
|
||||
if (productValue[itemn.attr].stock === 0) {
|
||||
return
|
||||
getAttrItemData(attr) {
|
||||
let result = {}
|
||||
this.productValueArr.map(item => {
|
||||
if (item.attrItemkey === attr) {
|
||||
result = item
|
||||
}
|
||||
})
|
||||
return result
|
||||
},
|
||||
tapAttr: function(indexw, indexn, itemn) {
|
||||
if (this.getAttrItemData(itemn.attr).stock === 0) {
|
||||
return
|
||||
}
|
||||
// 修改商品规格不生效的原因:
|
||||
// H5端下面写法,attr更新,但是除H5外其他端不支持,
|
||||
|
||||
Reference in New Issue
Block a user