@didaoktv/didaoui-uniapp 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,18 +77,25 @@ const config = {
|
|
|
77
77
|
}
|
|
78
78
|
const tagSelector = {}
|
|
79
79
|
let windowWidth, system
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
// ponytail: 不能在模块顶层调用 uni.*——H5 下组件库 ESM 求值早于 uni-h5 运行时挂载 window.uni,
|
|
81
|
+
// 会抛 "uni is not defined";改为首次使用时惰性初始化
|
|
82
|
+
function initSystemInfo () {
|
|
83
|
+
if (windowWidth !== undefined) {
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
// #ifdef MP-WEIXIN
|
|
87
|
+
if (uni.canIUse('getWindowInfo')) {
|
|
88
|
+
windowWidth = uni.getWindowInfo().windowWidth
|
|
89
|
+
system = uni.getDeviceInfo().system
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
// #endif
|
|
86
93
|
const systemInfo = uni.getSystemInfoSync()
|
|
87
94
|
windowWidth = systemInfo.windowWidth
|
|
88
95
|
// #ifdef MP-WEIXIN
|
|
89
96
|
system = systemInfo.system
|
|
97
|
+
// #endif
|
|
90
98
|
}
|
|
91
|
-
// #endif
|
|
92
99
|
const blankChar = makeMap(' ,\r,\n,\t,\f')
|
|
93
100
|
let idIndex = 0
|
|
94
101
|
|
|
@@ -310,6 +317,7 @@ Parser.prototype.parseStyle = function (node) {
|
|
|
310
317
|
}
|
|
311
318
|
} else if (value.includes('rpx')) {
|
|
312
319
|
// 转换 rpx(rich-text 内部不支持 rpx)
|
|
320
|
+
initSystemInfo()
|
|
313
321
|
value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px')
|
|
314
322
|
}
|
|
315
323
|
styleObj[key] = value
|
|
@@ -556,6 +564,7 @@ Parser.prototype.onOpenTag = function (selfClose) {
|
|
|
556
564
|
}
|
|
557
565
|
// #endif
|
|
558
566
|
// 设置的宽度超出屏幕,为避免变形,高度转为自动
|
|
567
|
+
initSystemInfo()
|
|
559
568
|
if (parseInt(styleObj.width) > windowWidth) {
|
|
560
569
|
styleObj.height = undefined
|
|
561
570
|
}
|
|
@@ -790,6 +799,7 @@ Parser.prototype.popNode = function () {
|
|
|
790
799
|
|
|
791
800
|
Object.assign(styleObj, this.parseStyle(node))
|
|
792
801
|
|
|
802
|
+
initSystemInfo()
|
|
793
803
|
if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) {
|
|
794
804
|
styleObj['max-width'] = '100%'
|
|
795
805
|
styleObj['box-sizing'] = 'border-box'
|
|
@@ -1186,6 +1196,7 @@ Parser.prototype.onText = function (text) {
|
|
|
1186
1196
|
node.text = decodeEntity(text)
|
|
1187
1197
|
if (this.hook(node)) {
|
|
1188
1198
|
// #ifdef MP-WEIXIN
|
|
1199
|
+
initSystemInfo()
|
|
1189
1200
|
if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) {
|
|
1190
1201
|
this.expose()
|
|
1191
1202
|
}
|