Skip to content

Commit bb2416a

Browse files
authored
fix(price): add new props strike-through (#1934)(#1907)
1 parent abef536 commit bb2416a

File tree

7 files changed

+55
-4
lines changed

7 files changed

+55
-4
lines changed

src/packages/__VUE/price/demo.vue

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
<nut-cell>
1616
<nut-price :price="8888" decimal-digits="0" size="normal" :need-symbol="true" :thousands="true" />
1717
</nut-cell>
18+
<h2>{{ translate('titleStrike') }}</h2>
19+
<nut-cell>
20+
<nut-price :price="8888" decimal-digits="0" size="normal" :need-symbol="true" :thousands="true" strike-through />
21+
</nut-cell>
1822
<h2>{{ translate('title3') }}</h2>
1923
<nut-cell>
2024
<nut-price :price="10010.01" size="normal" :need-symbol="true" :thousands="false" />
@@ -44,6 +48,7 @@ const initTranslate = () =>
4448
'zh-CN': {
4549
title1: '支持三种尺寸:small、normal、large',
4650
title2: '不保留小数',
51+
titleStrike: '划线价',
4752
title3: '有人民币符号,无千位分隔',
4853
title4: '有人民币符号,有千位分隔,保留小数点后三位',
4954
title5: '调整 symbol 符号位置',
@@ -52,6 +57,7 @@ const initTranslate = () =>
5257
'en-US': {
5358
title1: 'Support three sizes:small、normal、large',
5459
title2: 'No decimals',
60+
titleStrike: 'Strike Through',
5561
title3: 'With RMB symbol, no thousands separator',
5662
title4: 'With RMB symbol, separated by thousands, keep three decimal places',
5763
title5: 'Adjust the symbol position',

src/packages/__VUE/price/doc.en-US.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ app.use(Price);
4343
</template>
4444
```
4545

46+
:::
47+
### Strike Through
48+
49+
:::demo
50+
51+
``` html
52+
<template>
53+
<nut-price :price="8888" decimal-digits="0" size="normal" :need-symbol="true" :thousands="true" strike-through />
54+
</template>
55+
```
56+
4657
:::
4758

4859
### With RMB symbol, no thousands separator
@@ -116,4 +127,5 @@ app.use(Price);
116127
| decimal-digits | Decimal digits | Number | String | 2 |
117128
| thousands | Thousands separation | Boolean | false |
118129
| position | The symbol appear before or after the price,`before``after` | String | before |
119-
| size | Size,`large``normal``small` | String | large |
130+
| size | Size,`large``normal``small` | String | large |
131+
| strike-through`v3.3.1` | strike-through | Boolean | false |

src/packages/__VUE/price/doc.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ app.use(Price);
4545

4646
:::
4747

48+
49+
### 划线价
50+
51+
:::demo
52+
53+
``` html
54+
<template>
55+
<nut-price :price="8888" decimal-digits="0" size="normal" :need-symbol="true" :thousands="true" strike-through />
56+
</template>
57+
```
58+
59+
:::
60+
4861
### 有人民币符号,无千位分隔
4962

5063
:::demo
@@ -116,4 +129,5 @@ app.use(Price);
116129
| decimal-digits | 小数位位数 | Number | String | 2 |
117130
| thousands | 是否按照千分号形式显示 | Boolean | false |
118131
| position | 符号显示在价格前或者后,`before``after` | String | before |
119-
| size | 价格尺寸,`large``normal``small` | String | large |
132+
| size | 价格尺寸,`large``normal``small` | String | large |
133+
| strike-through`v3.3.1` | 是否展示划线价 | Boolean | false |

src/packages/__VUE/price/index.scss

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
font-size: 0;
33
display: inline;
44
color: $primary-color;
5+
&--strike {
6+
> view {
7+
text-decoration: line-through;
8+
}
9+
}
510
&--symbol {
611
display: inline-block;
712
font-size: $font-size-3;

src/packages/__VUE/price/index.taro.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ export default create({
5454
size: {
5555
type: String,
5656
default: 'large'
57+
},
58+
strikeThrough: {
59+
type: Boolean,
60+
default: false
5761
}
5862
},
5963
6064
setup(props) {
6165
const classes = computed(() => {
6266
return {
63-
[componentName]: true
67+
[componentName]: true,
68+
[`${componentName}--strike`]: props.strikeThrough
6469
};
6570
});
6671
const replaceSpecialChar = (url: string) => {

src/packages/__VUE/price/index.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,18 @@ export default create({
5656
size: {
5757
type: String,
5858
default: 'large'
59+
},
60+
strikeThrough: {
61+
type: Boolean,
62+
default: false
5963
}
6064
},
6165
6266
setup(props) {
6367
const classes = computed(() => {
6468
return {
65-
[componentName]: true
69+
[componentName]: true,
70+
[`${componentName}--strike`]: props.strikeThrough
6671
};
6772
});
6873
const showSymbol = computed(() => {

src/sites/mobile-taro/vue/src/exhibition/pages/price/index.vue

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
<nut-cell>
1616
<nut-price :price="8888" decimal-digits="0" size="normal" :need-symbol="true" :thousands="true" />
1717
</nut-cell>
18+
<h2>划线价</h2>
19+
<nut-cell>
20+
<nut-price :price="8888" decimal-digits="0" size="normal" :need-symbol="true" :thousands="true" strike-through />
21+
</nut-cell>
1822
<h2>调整 symbol 符号位置</h2>
1923
<nut-cell>
2024
<nut-price :price="8888.01" position="after" symbol="" size="normal" :need-symbol="true" :thousands="true" />

0 commit comments

Comments
 (0)