Browse Source

[优化] 价格组件

master
LAPTOP-D7TKRI82\邓 5 years ago
parent
commit
e0e22b4b83
  1. 1
      App.vue
  2. 22
      common/styles/sharedIconFont.css
  3. 30
      components/lf-price/lf-price.vue

1
App.vue

@ -119,6 +119,7 @@
@import "@/uview-ui/index.scss"; @import "@/uview-ui/index.scss";
@import '@/common/styles/theme.css'; @import '@/common/styles/theme.css';
@import '@/common/styles/common.css'; @import '@/common/styles/common.css';
@import '@/common/styles/sharedIconFont.css';
// //
.btn-bottom { .btn-bottom {

22
common/styles/sharedIconFont.css

@ -0,0 +1,22 @@
@font-face {
font-family: "lf-iconfont"; /* Project id 2758976 */
src: url('//at.alicdn.com/t/font_2758976_9bezuvselm.woff2?t=1629452232587') format('woff2'),
url('//at.alicdn.com/t/font_2758976_9bezuvselm.woff?t=1629452232587') format('woff'),
url('//at.alicdn.com/t/font_2758976_9bezuvselm.ttf?t=1629452232587') format('truetype');
}
.lf-iconfont {
font-family: "lf-iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.lf-icon-shanchu:before {
content: "\e674";
}
.lf-icon-jia:before {
content: "\e715";
}

30
components/lf-price/lf-price.vue

@ -1,11 +1,11 @@
<template> <template>
<view>
<view :style="{'--color': color}">
<block v-if="isPoint"> <block v-if="isPoint">
<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice(1) }}</text>
<text class="lf-font-28 lf-font-bold lf-color-price">.{{ showPrice(2) }}</text>
<text class="price-one text-price">{{ showPrice(1) }}</text>
<text class="price-two">.{{ showPrice(2) }}</text>
</block> </block>
<block v-else> <block v-else>
<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice() }}</text>
<text class="price-one text-price">{{ showPrice() }}</text>
</block> </block>
</view> </view>
</template> </template>
@ -16,6 +16,10 @@
price: { price: {
type: [Number, String], type: [Number, String],
default: '' default: ''
},
color: {
type: String,
default: '#FF0000'
} }
}, },
computed: { computed: {
@ -42,5 +46,21 @@
</script> </script>
<style lang="scss" scoped="scoped"> <style lang="scss" scoped="scoped">
.price-one{
font-size: 48rpx;
font-weight: bold;
color: var(--color);
}
.price-two{
font-size: 28rpx;
font-weight: bold;
color: var(--color);
}
.text-price::before {
content: "¥";
font-size: 28rpx!important;
margin-right: 4rpx;
font-weight: bold;
color: var(--color);
}
</style> </style>
Loading…
Cancel
Save