完善页面
This commit is contained in:
@ -29,8 +29,9 @@
|
||||
},
|
||||
props: ['itemData'],
|
||||
created() {
|
||||
this.interval = this.itemData.params.interval;
|
||||
this.indicatorActiveColor = this.itemData.style.btnColor;
|
||||
this.interval = this.itemData.params?.interval;
|
||||
console.log("🚀 ~ this.interval:", this.interval)
|
||||
this.indicatorActiveColor = this.itemData.style?.btnColor;
|
||||
},
|
||||
methods: {
|
||||
changeSwiper(e) {
|
||||
|
||||
86
components/price-format/price-format.vue
Normal file
86
components/price-format/price-format.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<!-- 隐藏划线价(市场价) -->
|
||||
<text :style="{color, 'font-weight': weight}" :class="(lineThrough ? 'line-through' : '') + ' price-format'">
|
||||
<text v-if="showSubscript" :style="{'font-size': subscriptSize + 'rpx', 'margin-right': '2rpx'}">¥</text>
|
||||
<text :style="{'font-size': firstSize + 'rpx', 'margin-right': '1rpx'}">{{priceSlice.first}}</text>
|
||||
<text v-if="priceSlice.second" :style="{'font-size': secondSize + 'rpx'}">.{{priceSlice.second}}</text>
|
||||
</text>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
priceSlice: {
|
||||
}
|
||||
};
|
||||
},
|
||||
components: {},
|
||||
props: {
|
||||
firstSize: {
|
||||
type: [String, Number],
|
||||
default: 28
|
||||
},
|
||||
secondSize: {
|
||||
type: [String, Number],
|
||||
default: 28
|
||||
},
|
||||
color: {
|
||||
type: String
|
||||
},
|
||||
weight: {
|
||||
type:[String, Number] ,
|
||||
default: 400
|
||||
},
|
||||
price: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
showSubscript: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
subscriptSize: {
|
||||
type: [String, Number],
|
||||
default: 28
|
||||
},
|
||||
lineThrough: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.priceFormat()
|
||||
},
|
||||
watch: {
|
||||
price(val) {
|
||||
this.priceFormat()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
priceFormat() {
|
||||
let {
|
||||
price
|
||||
} = this;
|
||||
let priceSlice = {}
|
||||
if(price !== null && price !== '' && price !== undefined) {
|
||||
price = parseFloat(price);
|
||||
price = String(price).split('.');
|
||||
priceSlice.first = price[0];
|
||||
priceSlice.second = price[1];
|
||||
this.priceSlice = priceSlice
|
||||
}else {
|
||||
this.priceSlice = {
|
||||
first: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.price-format {
|
||||
font-family: Avenir, SourceHanSansCN, PingFang SC, Arial, Hiragino Sans GB, Microsoft YaHei, sans-serif;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user