uview-plus 3.4.29 → 3.4.31
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.
- package/changelog.md +12 -0
- package/components/u-modal/u-modal.vue +3 -0
- package/components/u-pagination/u-pagination.vue +283 -0
- package/components/u-parse/node/node.vue +39 -28
- package/components/u-parse/parse.js +5 -5
- package/components/u-parse/parser.js +78 -15
- package/components/u-parse/u-parse.vue +1 -1
- package/components/u-popup/u-popup.vue +1 -0
- package/libs/util/gcanvas/bridge/bridge-weex.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStyleLinearGradient.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStylePattern.js +0 -0
- package/libs/util/gcanvas/context-2d/FillStyleRadialGradient.js +0 -0
- package/libs/util/gcanvas/context-2d/RenderingContext.js +0 -0
- package/libs/util/gcanvas/context-webgl/ActiveInfo.js +0 -0
- package/libs/util/gcanvas/context-webgl/Buffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/Framebuffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLenum.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLmethod.js +0 -0
- package/libs/util/gcanvas/context-webgl/GLtype.js +0 -0
- package/libs/util/gcanvas/context-webgl/Program.js +0 -0
- package/libs/util/gcanvas/context-webgl/Renderbuffer.js +0 -0
- package/libs/util/gcanvas/context-webgl/RenderingContext.js +0 -0
- package/libs/util/gcanvas/context-webgl/Shader.js +0 -0
- package/libs/util/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -0
- package/libs/util/gcanvas/context-webgl/Texture.js +0 -0
- package/libs/util/gcanvas/context-webgl/UniformLocation.js +0 -0
- package/libs/util/gcanvas/context-webgl/classUtils.js +0 -0
- package/libs/util/gcanvas/env/canvas.js +0 -0
- package/libs/util/gcanvas/env/image.js +0 -0
- package/libs/util/gcanvas/env/tool.js +0 -0
- package/libs/util/gcanvas/index.js +0 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 3.4.31(2025-05-17)
|
|
2
|
+
fix: 修复parse富文本组件导致鸿蒙运行白屏
|
|
3
|
+
|
|
4
|
+
fix: 去除演示项目中uni.$u用法便于兼容鸿蒙
|
|
5
|
+
|
|
6
|
+
feat: modal新增popupBottom插槽适用类似关闭按钮与内容区域分离的场景
|
|
7
|
+
|
|
8
|
+
## 3.4.30(2025-05-16)
|
|
9
|
+
feat: 新增pagination分页器组件
|
|
10
|
+
|
|
11
|
+
feat: popup新增bottom插槽适用类似关闭按钮与内容区域分离的场景
|
|
12
|
+
|
|
1
13
|
## 3.4.29(2025-05-15)
|
|
2
14
|
fix: 修复table2横向滚动样式
|
|
3
15
|
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-pagination">
|
|
3
|
+
<!-- 上一页按钮 -->
|
|
4
|
+
<view
|
|
5
|
+
:class="[
|
|
6
|
+
'u-pagination-btn',
|
|
7
|
+
{ disabled: currentPage === 1 }
|
|
8
|
+
]"
|
|
9
|
+
:style="{ backgroundColor: buttonBgColor, borderColor: buttonBorderColor }"
|
|
10
|
+
@click="prev"
|
|
11
|
+
>
|
|
12
|
+
<template v-if="prevText">
|
|
13
|
+
{{ prevText }}
|
|
14
|
+
</template>
|
|
15
|
+
<up-icon v-else name="arrow-left"></up-icon>
|
|
16
|
+
</view>
|
|
17
|
+
|
|
18
|
+
<!-- 页码列表 -->
|
|
19
|
+
<block v-for="page in displayedPages" :key="page" v-if="layout.includes('pager')">
|
|
20
|
+
<view
|
|
21
|
+
:class="[
|
|
22
|
+
'u-pagination-item',
|
|
23
|
+
{ active: page === currentPage }
|
|
24
|
+
]"
|
|
25
|
+
@click="goTo(page)"
|
|
26
|
+
>
|
|
27
|
+
{{ page }}
|
|
28
|
+
</view>
|
|
29
|
+
</block>
|
|
30
|
+
|
|
31
|
+
<!-- 总数显示 -->
|
|
32
|
+
<view v-if="total > 0 && layout.includes('total')" class="u-pagination-total">
|
|
33
|
+
{{ currentPage }} / {{ totalPages }}
|
|
34
|
+
</view>
|
|
35
|
+
|
|
36
|
+
<!-- 每页数量选择器 -->
|
|
37
|
+
<!-- <picker
|
|
38
|
+
v-if="layout.includes('sizes')"
|
|
39
|
+
mode="selector"
|
|
40
|
+
:range="pageSizes"
|
|
41
|
+
range-key="label"
|
|
42
|
+
:value="pageSizeIndex"
|
|
43
|
+
@change="handleSizeChange"
|
|
44
|
+
class="u-pagination-sizes"
|
|
45
|
+
>
|
|
46
|
+
<view>{{ pageSizeLabel }}</view>
|
|
47
|
+
</picker> -->
|
|
48
|
+
|
|
49
|
+
<!-- 下一页按钮 -->
|
|
50
|
+
<view
|
|
51
|
+
:class="[
|
|
52
|
+
'u-pagination-btn',
|
|
53
|
+
{ disabled: currentPage === totalPages }
|
|
54
|
+
]"
|
|
55
|
+
:style="{ backgroundColor: buttonBgColor, borderColor: buttonBorderColor }"
|
|
56
|
+
@click="next"
|
|
57
|
+
>
|
|
58
|
+
<template v-if="nextText">
|
|
59
|
+
下一页
|
|
60
|
+
</template>
|
|
61
|
+
<up-icon v-else name="arrow-right"></up-icon>
|
|
62
|
+
</view>
|
|
63
|
+
|
|
64
|
+
<!-- 跳转输入框 -->
|
|
65
|
+
<!-- <view v-if="layout.includes('jumper')">
|
|
66
|
+
<text>前往</text>
|
|
67
|
+
<input
|
|
68
|
+
type="number"
|
|
69
|
+
class="u-pagination-jumper"
|
|
70
|
+
:value="currentPageInput"
|
|
71
|
+
@input="onInputPage"
|
|
72
|
+
@confirm="onConfirmPage"
|
|
73
|
+
/>
|
|
74
|
+
<text>页</text>
|
|
75
|
+
</view> -->
|
|
76
|
+
</view>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script>
|
|
80
|
+
export default {
|
|
81
|
+
name: 'u-pagination',
|
|
82
|
+
props: {
|
|
83
|
+
// 当前页码
|
|
84
|
+
currentPage: {
|
|
85
|
+
type: Number,
|
|
86
|
+
default: 1
|
|
87
|
+
},
|
|
88
|
+
// 每页条目数
|
|
89
|
+
pageSize: {
|
|
90
|
+
type: Number,
|
|
91
|
+
default: 10
|
|
92
|
+
},
|
|
93
|
+
// 总数据条目数
|
|
94
|
+
total: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 0
|
|
97
|
+
},
|
|
98
|
+
// 上一页按钮文案
|
|
99
|
+
prevText: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: ''
|
|
102
|
+
},
|
|
103
|
+
// 下一页按钮文案
|
|
104
|
+
nextText: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: ''
|
|
107
|
+
},
|
|
108
|
+
buttonBgColor: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '#f5f7fa'
|
|
111
|
+
},
|
|
112
|
+
buttonBorderColor: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: '#dcdfe6'
|
|
115
|
+
},
|
|
116
|
+
// 可选的每页条目数
|
|
117
|
+
pageSizes: {
|
|
118
|
+
type: Array,
|
|
119
|
+
default: () => [10, 20, 30, 40, 50]
|
|
120
|
+
},
|
|
121
|
+
// 布局方式(类似 el-pagination)
|
|
122
|
+
layout: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: 'prev, pager, next'
|
|
125
|
+
},
|
|
126
|
+
// 是否隐藏只有一个页面时的分页控件
|
|
127
|
+
hideOnSinglePage: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
emits: ['update:currentPage', 'update:pageSize', 'current-change', 'size-change'],
|
|
133
|
+
data() {
|
|
134
|
+
return {
|
|
135
|
+
currentPageInput: this.currentPage + ''
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
computed: {
|
|
139
|
+
totalPages() {
|
|
140
|
+
return Math.max(1, Math.ceil(this.total / this.pageSize));
|
|
141
|
+
},
|
|
142
|
+
pageSizeIndex() {
|
|
143
|
+
const index = this.pageSizes.findIndex(size => size.value === this.pageSize);
|
|
144
|
+
return index >= 0 ? index : 0;
|
|
145
|
+
},
|
|
146
|
+
pageSizeLabel() {
|
|
147
|
+
const found = this.pageSizes.find(size => size.value === this.pageSize);
|
|
148
|
+
return found?.label || this.pageSize;
|
|
149
|
+
},
|
|
150
|
+
displayedPages() {
|
|
151
|
+
const total = this.totalPages;
|
|
152
|
+
const current = this.currentPage;
|
|
153
|
+
|
|
154
|
+
if (total <= 4) {
|
|
155
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const pages = [];
|
|
159
|
+
|
|
160
|
+
// 当前页靠近头部
|
|
161
|
+
if (current <= 2) {
|
|
162
|
+
for (let i = 1; i <= 4; i++) {
|
|
163
|
+
pages.push(i);
|
|
164
|
+
}
|
|
165
|
+
pages.push('...');
|
|
166
|
+
pages.push(total);
|
|
167
|
+
}
|
|
168
|
+
// 当前页在尾部附近
|
|
169
|
+
else if (current >= total - 1) {
|
|
170
|
+
pages.push(1);
|
|
171
|
+
pages.push('...');
|
|
172
|
+
for (let i = total - 3; i <= total; i++) {
|
|
173
|
+
pages.push(i);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// 中间情况
|
|
177
|
+
else {
|
|
178
|
+
pages.push(1);
|
|
179
|
+
pages.push('...');
|
|
180
|
+
pages.push(current - 1);
|
|
181
|
+
pages.push(current);
|
|
182
|
+
pages.push(current + 1);
|
|
183
|
+
pages.push('...');
|
|
184
|
+
pages.push(total);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return pages;
|
|
188
|
+
}
|
|
189
|
+
// 控制是否隐藏
|
|
190
|
+
},
|
|
191
|
+
watch: {
|
|
192
|
+
currentPage(val) {
|
|
193
|
+
this.currentPageInput = val + '';
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
methods: {
|
|
197
|
+
handleSizeChange(e) {
|
|
198
|
+
const selected = e.detail.value;
|
|
199
|
+
const size = this.pageSizes[selected]?.value || this.pageSizes[0].value;
|
|
200
|
+
this.$emit('update:pageSize', size);
|
|
201
|
+
this.$emit('size-change', size);
|
|
202
|
+
},
|
|
203
|
+
prev() {
|
|
204
|
+
if (this.currentPage > 1) {
|
|
205
|
+
this.goTo(this.currentPage - 1);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
next() {
|
|
209
|
+
if (this.currentPage < this.totalPages) {
|
|
210
|
+
this.goTo(this.currentPage + 1);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
goTo(page) {
|
|
214
|
+
if (page === '...' || page === this.currentPage) return;
|
|
215
|
+
this.$emit('update:currentPage', page);
|
|
216
|
+
this.$emit('current-change', page);
|
|
217
|
+
},
|
|
218
|
+
onInputPage(e) {
|
|
219
|
+
this.currentPageInput = e.detail.value;
|
|
220
|
+
},
|
|
221
|
+
onConfirmPage(e) {
|
|
222
|
+
const num = parseInt(e.detail.value);
|
|
223
|
+
if (!isNaN(num) && num >= 1 && num <= this.totalPages) {
|
|
224
|
+
this.goTo(num);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
</script>
|
|
230
|
+
|
|
231
|
+
<style lang="scss" scoped>
|
|
232
|
+
.u-pagination {
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: row;
|
|
235
|
+
align-items: center;
|
|
236
|
+
justify-content: space-between;
|
|
237
|
+
flex-wrap: wrap;
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
color: #606266;
|
|
240
|
+
|
|
241
|
+
.u-pagination-total {
|
|
242
|
+
margin-right: 10px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.u-pagination-sizes {
|
|
246
|
+
margin-right: 10px;
|
|
247
|
+
padding: 4px 4px;
|
|
248
|
+
border: 1rpx solid #dcdfe6;
|
|
249
|
+
border-radius: 4px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.u-pagination-btn {
|
|
253
|
+
margin: 0 3px;
|
|
254
|
+
padding: 4px 4px;
|
|
255
|
+
border: 1rpx solid #dcdfe6;
|
|
256
|
+
border-radius: 4px;
|
|
257
|
+
background-color: #f5f7fa;
|
|
258
|
+
&.disabled {
|
|
259
|
+
opacity: 0.5;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.u-pagination-item {
|
|
264
|
+
margin: 0 2px;
|
|
265
|
+
padding: 4px 8px;
|
|
266
|
+
border-radius: 4px;
|
|
267
|
+
&.active {
|
|
268
|
+
background-color: #409eff;
|
|
269
|
+
color: white;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.u-pagination-jumper {
|
|
274
|
+
width: 40px;
|
|
275
|
+
height: 28px;
|
|
276
|
+
margin: 0 5px;
|
|
277
|
+
padding: 0 5px;
|
|
278
|
+
border: 1rpx solid #dcdfe6;
|
|
279
|
+
border-radius: 4px;
|
|
280
|
+
font-size: 14px;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
</style>
|
|
@@ -10,13 +10,19 @@
|
|
|
10
10
|
<!-- #endif -->
|
|
11
11
|
<!-- #ifndef H5 || (APP-PLUS && VUE2) -->
|
|
12
12
|
<!-- 表格中的图片,使用 rich-text 防止大小不正确 -->
|
|
13
|
-
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="
|
|
13
|
+
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style||'',src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" />
|
|
14
14
|
<!-- #endif -->
|
|
15
|
-
<!-- #
|
|
16
|
-
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+
|
|
15
|
+
<!-- #ifdef APP-HARMONY -->
|
|
16
|
+
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+ctrl[i]+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
17
|
+
<!-- #endif -->
|
|
18
|
+
<!-- #ifndef H5 || APP-PLUS || MP-KUAISHOU -->
|
|
19
|
+
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
20
|
+
<!-- #endif -->
|
|
21
|
+
<!-- #ifdef MP-KUAISHOU -->
|
|
22
|
+
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src" :lazy-load="opts[0]" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap"></image>
|
|
17
23
|
<!-- #endif -->
|
|
18
24
|
<!-- #ifdef APP-PLUS && VUE3 -->
|
|
19
|
-
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
25
|
+
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||''))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
|
|
20
26
|
<!-- #endif -->
|
|
21
27
|
<!-- 文本 -->
|
|
22
28
|
<!-- #ifdef MP-WEIXIN -->
|
|
@@ -25,14 +31,14 @@
|
|
|
25
31
|
<!-- #ifndef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-TOUTIAO -->
|
|
26
32
|
<text v-else-if="n.text" decode>{{n.text}}</text>
|
|
27
33
|
<!-- #endif -->
|
|
28
|
-
<text v-else-if="n.name==='br'"
|
|
34
|
+
<text v-else-if="n.name==='br'">{{'\n'}}</text>
|
|
29
35
|
<!-- 链接 -->
|
|
30
36
|
<view v-else-if="n.name==='a'" :id="n.attrs.id" :class="(n.attrs.href?'_a ':'')+n.attrs.class" hover-class="_hover" :style="'display:inline;'+n.attrs.style" :data-i="i" @tap.stop="linkTap">
|
|
31
37
|
<node name="span" :childs="n.children" :opts="opts" style="display:inherit" />
|
|
32
38
|
</view>
|
|
33
39
|
<!-- 视频 -->
|
|
34
40
|
<!-- #ifdef APP-PLUS -->
|
|
35
|
-
<view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" @vplay.stop="play" />
|
|
41
|
+
<view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" :data-i="i" @vplay.stop="play" />
|
|
36
42
|
<!-- #endif -->
|
|
37
43
|
<!-- #ifndef APP-PLUS -->
|
|
38
44
|
<video v-else-if="n.name==='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
|
|
@@ -61,13 +67,13 @@
|
|
|
61
67
|
</block>
|
|
62
68
|
</view>
|
|
63
69
|
</view>
|
|
64
|
-
|
|
70
|
+
<!-- insert -->
|
|
65
71
|
<!-- 富文本 -->
|
|
66
72
|
<!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
|
|
67
73
|
<rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
|
|
68
74
|
<!-- #endif -->
|
|
69
75
|
<!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
|
|
70
|
-
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="
|
|
76
|
+
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
|
|
71
77
|
<!-- #endif -->
|
|
72
78
|
<!-- 继续递归 -->
|
|
73
79
|
<view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
|
|
@@ -106,7 +112,6 @@ module.exports = {
|
|
|
106
112
|
}
|
|
107
113
|
</script>
|
|
108
114
|
<script>
|
|
109
|
-
|
|
110
115
|
import node from './node'
|
|
111
116
|
export default {
|
|
112
117
|
name: 'node',
|
|
@@ -122,7 +127,7 @@ export default {
|
|
|
122
127
|
return {
|
|
123
128
|
ctrl: {},
|
|
124
129
|
// #ifdef MP-WEIXIN
|
|
125
|
-
isiOS: uni.
|
|
130
|
+
isiOS: uni.getSystemInfoSync().system.includes('iOS')
|
|
126
131
|
// #endif
|
|
127
132
|
}
|
|
128
133
|
},
|
|
@@ -138,14 +143,13 @@ export default {
|
|
|
138
143
|
opts: Array
|
|
139
144
|
},
|
|
140
145
|
components: {
|
|
141
|
-
|
|
142
|
-
// #ifndef (H5 || APP-PLUS) && VUE3
|
|
146
|
+
// #ifndef ((H5 || APP-PLUS) && VUE3) || APP-HARMONY
|
|
143
147
|
node
|
|
144
148
|
// #endif
|
|
145
149
|
},
|
|
146
150
|
mounted () {
|
|
147
151
|
this.$nextTick(() => {
|
|
148
|
-
for (this.root = this.$parent; this.root.$options.name !== '
|
|
152
|
+
for (this.root = this.$parent; this.root.$options.name !== 'mp-html'; this.root = this.root.$parent);
|
|
149
153
|
})
|
|
150
154
|
// #ifdef H5 || APP-PLUS
|
|
151
155
|
if (this.opts[0]) {
|
|
@@ -168,14 +172,14 @@ export default {
|
|
|
168
172
|
}
|
|
169
173
|
// #endif
|
|
170
174
|
},
|
|
171
|
-
|
|
175
|
+
beforeDestroy () {
|
|
172
176
|
// #ifdef H5 || APP-PLUS
|
|
173
177
|
if (this.observer) {
|
|
174
178
|
this.observer.disconnect()
|
|
175
179
|
}
|
|
176
180
|
// #endif
|
|
177
181
|
},
|
|
178
|
-
methods:{
|
|
182
|
+
methods: {
|
|
179
183
|
// #ifdef MP-WEIXIN
|
|
180
184
|
toJSON () { return this },
|
|
181
185
|
// #endif
|
|
@@ -184,7 +188,15 @@ export default {
|
|
|
184
188
|
* @param {Event} e
|
|
185
189
|
*/
|
|
186
190
|
play (e) {
|
|
187
|
-
|
|
191
|
+
const i = e.currentTarget.dataset.i
|
|
192
|
+
const node = this.childs[i]
|
|
193
|
+
this.root.$emit('play', {
|
|
194
|
+
source: node.name,
|
|
195
|
+
attrs: {
|
|
196
|
+
...node.attrs,
|
|
197
|
+
src: node.src[this.ctrl[i] || 0]
|
|
198
|
+
}
|
|
199
|
+
})
|
|
188
200
|
// #ifndef APP-PLUS
|
|
189
201
|
if (this.root.pauseVideo) {
|
|
190
202
|
let flag = false
|
|
@@ -227,7 +239,14 @@ export default {
|
|
|
227
239
|
// #ifdef H5 || APP-PLUS
|
|
228
240
|
node.attrs.src = node.attrs.src || node.attrs['data-src']
|
|
229
241
|
// #endif
|
|
230
|
-
|
|
242
|
+
// #ifndef APP-HARMONY
|
|
243
|
+
this.root.$emit('imgtap', node.attrs)
|
|
244
|
+
// #endif
|
|
245
|
+
// #ifdef APP-HARMONY
|
|
246
|
+
this.root.$emit('imgtap', {
|
|
247
|
+
...node.attrs
|
|
248
|
+
})
|
|
249
|
+
// #endif
|
|
231
250
|
// 自动预览图片
|
|
232
251
|
if (this.root.previewImg) {
|
|
233
252
|
uni.previewImage({
|
|
@@ -299,7 +318,7 @@ export default {
|
|
|
299
318
|
* @description 检查是否所有图片加载完毕
|
|
300
319
|
*/
|
|
301
320
|
checkReady () {
|
|
302
|
-
if (!this.root.lazyLoad) {
|
|
321
|
+
if (this.root && !this.root.lazyLoad) {
|
|
303
322
|
this.root._unloadimgs -= 1
|
|
304
323
|
if (!this.root._unloadimgs) {
|
|
305
324
|
setTimeout(() => {
|
|
@@ -321,7 +340,7 @@ export default {
|
|
|
321
340
|
const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {}
|
|
322
341
|
const attrs = node.attrs || e
|
|
323
342
|
const href = attrs.href
|
|
324
|
-
this.root.$emit('
|
|
343
|
+
this.root.$emit('linktap', Object.assign({
|
|
325
344
|
innerText: this.root.getText(node.children || []) // 链接内的文本内容
|
|
326
345
|
}, attrs))
|
|
327
346
|
if (href) {
|
|
@@ -407,9 +426,7 @@ export default {
|
|
|
407
426
|
._a {
|
|
408
427
|
padding: 1.5px 0 1.5px 0;
|
|
409
428
|
color: #366092;
|
|
410
|
-
/* #ifndef APP-NVUE */
|
|
411
429
|
word-break: break-all;
|
|
412
|
-
/* #endif */
|
|
413
430
|
}
|
|
414
431
|
|
|
415
432
|
/* a 标签点击态效果 */
|
|
@@ -427,9 +444,7 @@ export default {
|
|
|
427
444
|
/* 内部样式 */
|
|
428
445
|
|
|
429
446
|
._block {
|
|
430
|
-
/* #ifndef APP-NVUE */
|
|
431
447
|
display: block;
|
|
432
|
-
/* #endif */
|
|
433
448
|
}
|
|
434
449
|
|
|
435
450
|
._b,
|
|
@@ -476,9 +491,7 @@ export default {
|
|
|
476
491
|
._h4,
|
|
477
492
|
._h5,
|
|
478
493
|
._h6 {
|
|
479
|
-
/* #ifndef APP-NVUE */
|
|
480
494
|
display: block;
|
|
481
|
-
/* #endif */
|
|
482
495
|
font-weight: bold;
|
|
483
496
|
}
|
|
484
497
|
|
|
@@ -500,9 +513,7 @@ export default {
|
|
|
500
513
|
|
|
501
514
|
._ol,
|
|
502
515
|
._ul {
|
|
503
|
-
/* #ifndef APP-NVUE */
|
|
504
516
|
display: block;
|
|
505
|
-
/* #endif */
|
|
506
517
|
padding-left: 40px;
|
|
507
518
|
margin: 1em 0;
|
|
508
519
|
}
|
|
@@ -581,4 +592,4 @@ export default {
|
|
|
581
592
|
height: 225px;
|
|
582
593
|
}
|
|
583
594
|
/* #endif */
|
|
584
|
-
</style>
|
|
595
|
+
</style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @Author :
|
|
2
|
+
* @Author : jry
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-05-17 17:17:33
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/parse.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// parse
|
|
@@ -71,19 +71,23 @@ const config = {
|
|
|
71
71
|
viewbox: 'viewBox',
|
|
72
72
|
attributename: 'attributeName',
|
|
73
73
|
repeatcount: 'repeatCount',
|
|
74
|
-
repeatdur: 'repeatDur'
|
|
74
|
+
repeatdur: 'repeatDur',
|
|
75
|
+
foreignobject: 'foreignObject'
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
const tagSelector={}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const tagSelector = {}
|
|
79
|
+
let windowWidth, system
|
|
80
|
+
// #ifdef MP-WEIXIN
|
|
81
|
+
if (uni.canIUse('getWindowInfo')) {
|
|
82
|
+
windowWidth = uni.getWindowInfo().windowWidth
|
|
83
|
+
system = uni.getDeviceInfo().system
|
|
84
|
+
} else {
|
|
81
85
|
// #endif
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
system
|
|
86
|
-
}
|
|
86
|
+
const systemInfo = uni.getSystemInfoSync()
|
|
87
|
+
windowWidth = systemInfo.windowWidth
|
|
88
|
+
// #ifdef MP-WEIXIN
|
|
89
|
+
system = systemInfo.system
|
|
90
|
+
}
|
|
87
91
|
// #endif
|
|
88
92
|
const blankChar = makeMap(' ,\r,\n,\t,\f')
|
|
89
93
|
let idIndex = 0
|
|
@@ -325,6 +329,7 @@ Parser.prototype.onTagName = function (name) {
|
|
|
325
329
|
this.tagName = this.xml ? name : name.toLowerCase()
|
|
326
330
|
if (this.tagName === 'svg') {
|
|
327
331
|
this.xml = (this.xml || 0) + 1 // svg 标签内大小写敏感
|
|
332
|
+
config.ignoreTags.style = undefined // svg 标签内 style 可用
|
|
328
333
|
}
|
|
329
334
|
}
|
|
330
335
|
|
|
@@ -335,12 +340,18 @@ Parser.prototype.onTagName = function (name) {
|
|
|
335
340
|
*/
|
|
336
341
|
Parser.prototype.onAttrName = function (name) {
|
|
337
342
|
name = this.xml ? name : name.toLowerCase()
|
|
343
|
+
// #ifdef (VUE3 && (H5 || APP-PLUS)) || APP-PLUS-NVUE
|
|
344
|
+
if (name.includes('?') || name.includes(';')) {
|
|
345
|
+
this.attrName = undefined
|
|
346
|
+
return
|
|
347
|
+
}
|
|
348
|
+
// #endif
|
|
338
349
|
if (name.substr(0, 5) === 'data-') {
|
|
339
350
|
if (name === 'data-src' && !this.attrs.src) {
|
|
340
351
|
// data-src 自动转为 src
|
|
341
352
|
this.attrName = 'src'
|
|
342
353
|
} else if (this.tagName === 'img' || this.tagName === 'a') {
|
|
343
|
-
// a 和 img 标签保留 data- 的属性,可以在
|
|
354
|
+
// a 和 img 标签保留 data- 的属性,可以在 imgtap 和 linktap 事件中使用
|
|
344
355
|
this.attrName = name
|
|
345
356
|
} else {
|
|
346
357
|
// 剩余的移除以减小大小
|
|
@@ -461,7 +472,7 @@ Parser.prototype.onOpenTag = function (selfClose) {
|
|
|
461
472
|
node.webp = 'T'
|
|
462
473
|
}
|
|
463
474
|
// data url 图片如果没有设置 original-src 默认为不可预览的小图片
|
|
464
|
-
if (attrs.src.includes('data:') && !attrs['original-src']) {
|
|
475
|
+
if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) {
|
|
465
476
|
attrs.ignore = 'T'
|
|
466
477
|
}
|
|
467
478
|
if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) {
|
|
@@ -555,6 +566,13 @@ Parser.prototype.onOpenTag = function (selfClose) {
|
|
|
555
566
|
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) {
|
|
556
567
|
node.h = 'T'
|
|
557
568
|
}
|
|
569
|
+
if (node.w && node.h && styleObj['object-fit']) {
|
|
570
|
+
if (styleObj['object-fit'] === 'contain') {
|
|
571
|
+
node.m = 'aspectFit'
|
|
572
|
+
} else if (styleObj['object-fit'] === 'cover') {
|
|
573
|
+
node.m = 'aspectFill'
|
|
574
|
+
}
|
|
575
|
+
}
|
|
558
576
|
} else if (node.name === 'svg') {
|
|
559
577
|
siblings.push(node)
|
|
560
578
|
this.stack.push(node)
|
|
@@ -681,11 +699,19 @@ Parser.prototype.popNode = function () {
|
|
|
681
699
|
return
|
|
682
700
|
}
|
|
683
701
|
const name = config.svgDict[node.name] || node.name
|
|
702
|
+
if (name === 'foreignObject') {
|
|
703
|
+
for (const child of (node.children || [])) {
|
|
704
|
+
if (child.attrs && !child.attrs.xmlns) {
|
|
705
|
+
child.attrs.xmlns = 'http://www.w3.org/1999/xhtml'
|
|
706
|
+
break
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
684
710
|
src += '<' + name
|
|
685
711
|
for (const item in node.attrs) {
|
|
686
712
|
const val = node.attrs[item]
|
|
687
713
|
if (val) {
|
|
688
|
-
src += ` ${config.svgDict[item] || item}="${val}"`
|
|
714
|
+
src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"`
|
|
689
715
|
}
|
|
690
716
|
}
|
|
691
717
|
if (!node.children) {
|
|
@@ -707,6 +733,7 @@ Parser.prototype.popNode = function () {
|
|
|
707
733
|
node.children = undefined
|
|
708
734
|
// #endif
|
|
709
735
|
this.xml = false
|
|
736
|
+
config.ignoreTags.style = true
|
|
710
737
|
return
|
|
711
738
|
}
|
|
712
739
|
|
|
@@ -843,6 +870,10 @@ Parser.prototype.popNode = function () {
|
|
|
843
870
|
if (node.flag && node.c) {
|
|
844
871
|
// 有 colspan 或 rowspan 且含有链接的表格通过 grid 布局实现
|
|
845
872
|
styleObj.display = 'grid'
|
|
873
|
+
if (styleObj['border-collapse'] === 'collapse') {
|
|
874
|
+
styleObj['border-collapse'] = undefined
|
|
875
|
+
spacing = 0
|
|
876
|
+
}
|
|
846
877
|
if (spacing) {
|
|
847
878
|
styleObj['grid-gap'] = spacing + 'px'
|
|
848
879
|
styleObj.padding = spacing + 'px'
|
|
@@ -860,6 +891,23 @@ Parser.prototype.popNode = function () {
|
|
|
860
891
|
for (let i = 0; i < nodes.length; i++) {
|
|
861
892
|
if (nodes[i].name === 'tr') {
|
|
862
893
|
trList.push(nodes[i])
|
|
894
|
+
} else if (nodes[i].name === 'colgroup') {
|
|
895
|
+
let colI = 1
|
|
896
|
+
for (const col of (nodes[i].children || [])) {
|
|
897
|
+
if (col.name === 'col') {
|
|
898
|
+
const style = col.attrs.style || ''
|
|
899
|
+
const start = style.indexOf('width') ? style.indexOf(';width') : 0
|
|
900
|
+
// 提取出宽度
|
|
901
|
+
if (start !== -1) {
|
|
902
|
+
let end = style.indexOf(';', start + 6)
|
|
903
|
+
if (end === -1) {
|
|
904
|
+
end = style.length
|
|
905
|
+
}
|
|
906
|
+
width[colI] = style.substring(start ? start + 7 : 6, end)
|
|
907
|
+
}
|
|
908
|
+
colI += 1
|
|
909
|
+
}
|
|
910
|
+
}
|
|
863
911
|
} else {
|
|
864
912
|
traversal(nodes[i].children || [])
|
|
865
913
|
}
|
|
@@ -986,11 +1034,26 @@ Parser.prototype.popNode = function () {
|
|
|
986
1034
|
node.children = [table]
|
|
987
1035
|
attrs = table.attrs
|
|
988
1036
|
}
|
|
1037
|
+
} else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) {
|
|
1038
|
+
node.flag = undefined;
|
|
1039
|
+
(function traversal (nodes) {
|
|
1040
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
1041
|
+
if (nodes[i].name === 'td') {
|
|
1042
|
+
// 颜色样式设置给单元格避免丢失
|
|
1043
|
+
for (const style of ['color', 'background', 'background-color']) {
|
|
1044
|
+
if (styleObj[style]) {
|
|
1045
|
+
nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '')
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
} else {
|
|
1049
|
+
traversal(nodes[i].children || [])
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
})(children)
|
|
989
1053
|
} else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) {
|
|
990
1054
|
for (let i = this.stack.length; i--;) {
|
|
991
|
-
if (this.stack[i].name === 'table') {
|
|
1055
|
+
if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') {
|
|
992
1056
|
this.stack[i].flag = 1 // 指示含有合并单元格
|
|
993
|
-
break
|
|
994
1057
|
}
|
|
995
1058
|
}
|
|
996
1059
|
} else if (node.name === 'ruby') {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED