Skip to content

Commit df46853

Browse files
committed
fix: Compatible with rpx mode
1 parent 02a3ee1 commit df46853

22 files changed

+150
-70
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ npx iconfont-init
6363
### use_rpx
6464
是否使用微信提供的[尺寸单位rpx](https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxss.html#%E5%B0%BA%E5%AF%B8%E5%8D%95%E4%BD%8D)还是普通的像素单位`px`。默认值为false,即使用`px`
6565

66-
------
67-
68-
**注意:** 百度小程序暂时不支持`rpx`格式。
69-
7066
### trim_icon_prefix
7167
如果你的图标有通用的前缀,而你在使用的时候又不想重复去写,那么可以通过这种配置这个选项把前缀统一去掉。
7268

snapshots/alipay/alipay.axml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

snapshots/alipay/alipay.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,24 @@ Component({
88
},
99
data: {
1010
quot: '"',
11+
svgSize: 18,
12+
},
13+
didMount() {
14+
const size = this.props.size;
15+
16+
if (size !== this.data.svgSize) {
17+
this.setData({
18+
svgSize: false ? size / 750 * my.getSystemInfoSync().windowWidth : size
19+
});
20+
}
21+
},
22+
disUpdate(prevProps) {
23+
const size = this.props.size;
24+
25+
if (size !== prevProps.size) {
26+
this.setData({
27+
svgSize: false ? size / 750 * my.getSystemInfoSync().windowWidth : size,
28+
});
29+
}
1130
},
1231
});

snapshots/baidu/baidu.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ Component({
1212
size: {
1313
type: Number,
1414
value: 18,
15+
observer: function(size) {
16+
this.setData({
17+
svgSize: false ? size / 750 * swan.getSystemInfoSync().windowWidth : size,
18+
});
19+
},
1520
},
1621
},
1722
data: {
1823
quot: '"',
24+
svgSize: false ? 18 / 750 * swan.getSystemInfoSync().windowWidth : 18,
1925
},
2026
});

snapshots/baidu/baidu.swan

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

snapshots/qq/qq.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ Component({
77
// string | string[]
88
color: {
99
type: null,
10-
observer: function(color, originalColor) {
11-
if (color !== originalColor) {
12-
this.setData({
13-
colorIsString: typeof color === 'string',
14-
});
15-
}
10+
observer: function(color) {
11+
this.setData({
12+
colorIsString: typeof color === 'string',
13+
});
1614
}
1715
},
1816
size: {
1917
type: Number,
2018
value: 24,
19+
observer: function(size) {
20+
this.setData({
21+
svgSize: false ? size / 750 * qq.getSystemInfoSync().windowWidth : size,
22+
});
23+
},
2124
},
2225
},
2326
data: {
27+
svgSize: false ? 24 / 750 * qq.getSystemInfoSync().windowWidth : 24,
2428
quot: '"',
2529
colorIsString: false,
2630
},

snapshots/qq/qq.qml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

snapshots/toutiao/toutiao.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@ Component({
88
color: {
99
type: null,
1010
value: '',
11-
observer: function(color, originalColor) {
12-
if (color !== originalColor) {
13-
this.setData({
14-
colorIsString: typeof color === 'string',
15-
});
16-
}
11+
observer: function(color) {
12+
this.setData({
13+
colorIsString: typeof color === 'string',
14+
});
1715
}
1816
},
1917
size: {
2018
type: Number,
2119
value: 18,
20+
observer: function(size) {
21+
this.setData({
22+
svgSize: false ? size / 750 * tt.getSystemInfoSync().windowWidth : size,
23+
});
24+
},
2225
},
2326
},
2427
data: {
28+
svgSize: false ? 18 / 750 * tt.getSystemInfoSync().windowWidth : 18,
2529
quot: '"',
2630
colorIsString: false,
2731
},

snapshots/toutiao/toutiao.ttml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

snapshots/wechat/wechat.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ Component({
77
// string | string[]
88
color: {
99
type: null,
10-
observer: function(color, originalColor) {
11-
if (color !== originalColor) {
12-
this.setData({
13-
colors: this.fixColor()
14-
});
15-
}
10+
observer: function() {
11+
this.setData({
12+
colors: this.fixColor()
13+
});
1614
}
1715
},
1816
size: {
1917
type: Number,
2018
value: 20,
19+
observer: function(size) {
20+
this.setData({
21+
svgSize: false ? size / 750 * wx.getSystemInfoSync().windowWidth : size,
22+
});
23+
},
2124
},
2225
},
2326
data: {
24-
colors: ''
27+
colors: '',
28+
svgSize: false ? 20 / 750 * wx.getSystemInfoSync().windowWidth : 20,
29+
quot: '"',
2530
},
2631
methods: {
2732
fixColor: function() {

0 commit comments

Comments
 (0)