zhaojs
2023-05-16 9707c4410a67d6a6d63b634f53565711d2d337da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!-- 价格展示组件 -->
<template>
    <view class="flex align-end">
        <view class="present-price">
            <text class="rmb">¥</text>
            <text class="number">{{presentPrice}}</text>
        </view>
        <view class="original-price ml-20" v-if="!!originalPrice">
            <text>¥</text>
            <text>{{originalPrice}}</text>
            <!-- 为了兼容html2canvas 生成海报不支持删除线 -->
            <view class='line'></view>
        </view>
    </view>
</template>
 
<script>
    export default {
        name: "Price",
        props: {
            presentPrice: { // 现价
                type: [Number, String],
                default: 0
            },
            originalPrice: { // 原价
                type: [Number, String],
                default: 0
            },
        }
    }
</script>
 
<style lang="scss" scoped>
    .present-price {
        color: #FF3824;
        line-height: 34rpx;
        font-weight: bold;
 
        .rmb {
            font-size: 24rpx;
        }
 
        .number {
            font-size: 34rpx;
        }
    }
 
    .original-price {
        position: relative;
        font-size: 22rpx;
        font-weight: 500;
        color: #999999;
        line-height: 34rpx;
        // text-decoration: line-through;
 
        /* 删除线 */
        .line {
            position: absolute;
            top: 50%;
            left: 0;
            display: inline-block;
            width: 108%;
            height: 0.8rpx;
            background-color: #999999;
 
        }
    }
</style>