[new feature] sku组件增加步进器相关自定义配置 (#600)

This commit is contained in:
wny
2018-02-01 21:43:36 +08:00
committed by GitHub
parent 1b85c09a75
commit 4270354a67
8 changed files with 214 additions and 3 deletions
+15 -2
View File
@@ -12,7 +12,7 @@
/>
</div>
<div v-if="!hideStock" class="van-sku__stock">{{ $t('remain', stock) }}</div>
<div v-if="quota > 0" class="van-sku__quota">{{ $t('quota', quota) }}</div>
<div v-if="quotaText" class="van-sku__quota">{{ quotaText }}</div>
</div>
</template>
@@ -40,7 +40,8 @@ export default create({
quota: Number,
quotaUsed: Number,
hideStock: Boolean,
disableStepperInput: Boolean
disableStepperInput: Boolean,
customStepperConfig: Object
},
data() {
@@ -69,6 +70,18 @@ export default create({
}
return this.skuStockNum;
},
quotaText() {
const { quotaText } = this.customStepperConfig;
let text = '';
if (quotaText) {
text = quotaText;
} else if (this.quota > 0) {
text = this.$t('quota', this.quota);
}
return text;
},
stepperLimit() {
const quotaLimit = this.quota - this.quotaUsed;
let limit;