|
|
@ -5,7 +5,7 @@ |
|
|
|
颜色选择 |
|
|
|
</view> |
|
|
|
<view class="list"> |
|
|
|
<view :class="{act : unitKey.startsWith(item)}" |
|
|
|
<view :class="{act : colorIndex == index}" |
|
|
|
v-for="(item, index) in colorList" |
|
|
|
@click="selectUnit(item, index, 0)" :key="index"> |
|
|
|
{{ item }} |
|
|
@ -19,7 +19,7 @@ |
|
|
|
</view> |
|
|
|
<view class="list"> |
|
|
|
<view |
|
|
|
:class="{act : unitKey.endsWith(item), |
|
|
|
:class="{act : sizeIndex == index, |
|
|
|
del : getUnitClassDel(item, index)}" |
|
|
|
v-for="(item, index) in sizeList" |
|
|
|
@click="selectUnit(item, index, 1)" :key="index"> |
|
|
@ -56,11 +56,11 @@ |
|
|
|
|
|
|
|
return map |
|
|
|
}, |
|
|
|
// 颜色列表 |
|
|
|
// 尺寸列表 |
|
|
|
sizeList(){ |
|
|
|
return [...new Set(this.list.map(n => n.title || defaultKey))] |
|
|
|
}, |
|
|
|
// 尺寸列表 |
|
|
|
// 颜色列表 |
|
|
|
colorList(){ |
|
|
|
return [...new Set(this.list.map(n => n.colour || defaultKey))] |
|
|
|
}, |
|
|
@ -101,18 +101,19 @@ |
|
|
|
}, |
|
|
|
getUnitClassDel(item, index, type){ |
|
|
|
let key = this.colorList[this.colorIndex] + ':' + item |
|
|
|
return this.unitMap[key] ? false : true |
|
|
|
return !this.unitMap[key] |
|
|
|
}, |
|
|
|
// 更新索引 |
|
|
|
updateIndexAll(){ |
|
|
|
let key = this.unitKey |
|
|
|
|
|
|
|
this.colorList.forEach((n, i) => { |
|
|
|
if(key.startsWith(n)){ |
|
|
|
if(key.startsWith(n + ':')){ |
|
|
|
this.colorIndex = i |
|
|
|
} |
|
|
|
}) |
|
|
|
this.sizeList.forEach((n, i) => { |
|
|
|
if(key.endsWith(n)){ |
|
|
|
if(key.endsWith(':' + n)){ |
|
|
|
this.sizeIndex = i |
|
|
|
} |
|
|
|
}) |
|
|
|