mini-program-parser
Advanced tools
@@ -11,20 +11,29 @@ Component({ | ||
| containerWidth: 0, | ||
| renderVisible: false, | ||
| }, | ||
| ready() { | ||
| const { adaptive = true } = this.data.config; | ||
| if (adaptive) { | ||
| // 获取外层容器宽度 | ||
| wx.createSelectorQuery() | ||
| .in(this) | ||
| .select(".mini-parser") | ||
| .boundingClientRect((res) => { | ||
| if (res.width > 0) { | ||
| this.setData({ | ||
| containerWidth: res.width, | ||
| }); | ||
| } | ||
| }) | ||
| .exec(); | ||
| const { html, config } = this.data; | ||
| const { adaptive = true } = config; | ||
| if (html) { | ||
| if (adaptive) { | ||
| // 获取外层容器宽度 | ||
| wx.createSelectorQuery() | ||
| .in(this) | ||
| .select(".mini-parser") | ||
| .boundingClientRect((res) => { | ||
| if (res && res.width > 0) { | ||
| this.setData({ | ||
| containerWidth: res.width, | ||
| renderVisible: true, | ||
| }); | ||
| } | ||
| }) | ||
| .exec(); | ||
| } else { | ||
| this.setData({ | ||
| renderVisible: true, | ||
| }); | ||
| } | ||
| } | ||
| }, | ||
| }); |
+1
-1
| { | ||
| "name": "mini-program-parser", | ||
| "version": "0.3.1", | ||
| "version": "0.3.2", | ||
| "scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "rollup -c ./rollup.dev.config.js --watch", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
53171
2.36%995
0.91%