uview-plus 3.3.6 → 3.3.8
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 +58 -0
- package/components/u-action-sheet/props.js +6 -1
- package/components/u-action-sheet/u-action-sheet.vue +4 -5
- package/components/u-cell/u-cell.vue +20 -1
- package/components/u-checkbox/u-checkbox.vue +29 -19
- package/components/u-code/u-code.vue +0 -5
- package/components/u-collapse-item/props.js +6 -1
- package/components/u-collapse-item/u-collapse-item.vue +5 -3
- package/components/u-count-down/u-count-down.vue +0 -5
- package/components/u-dropdown/u-dropdown.vue +1 -1
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-grid-item/u-grid-item.vue +0 -5
- package/components/u-index-list/props.js +6 -1
- package/components/u-index-list/u-index-list.vue +168 -42
- package/components/u-lazy-load/u-lazy-load.vue +10 -3
- package/components/u-loading-icon/u-loading-icon.vue +2 -0
- package/components/u-modal/u-modal.vue +6 -3
- package/components/u-notify/u-notify.vue +0 -5
- package/components/u-number-box/u-number-box.vue +1 -0
- package/components/u-parse/node/node.vue +9 -1
- package/components/u-parse/u-parse.vue +1 -7
- package/components/u-picker/u-picker.vue +1 -0
- package/components/u-popup/u-popup.vue +3 -1
- package/components/u-row-notice/u-row-notice.vue +1 -8
- package/components/u-scroll-list/nvue.js +1 -1
- package/components/u-scroll-list/u-scroll-list.vue +5 -2
- package/components/u-slider/props.js +45 -19
- package/components/u-slider/u-slider.vue +414 -7
- package/components/u-sticky/u-sticky.vue +0 -5
- package/components/u-swipe-action-item/nvue.js +0 -5
- package/components/u-tabbar-item/u-tabbar-item.vue +3 -0
- package/components/u-tabs/u-tabs.vue +21 -4
- package/components/u-toast/u-toast.vue +10 -10
- package/components/u-upload/u-upload.vue +9 -4
- package/components/u-upload/utils.js +10 -4
- package/components/u-waterfall/u-waterfall.vue +11 -5
- package/libs/config/props/actionSheet.js +2 -1
- package/libs/config/props/collapseItem.js +2 -1
- package/libs/config/props/indexList.js +2 -1
- package/libs/config/props/slider.js +3 -1
- package/libs/css/common.scss +1 -1
- package/libs/css/flex.scss +3 -0
- package/libs/mixin/mixin.js +23 -8
- package/package.json +1 -1
- package/types/index.d.ts +154 -29
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +0 -180
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-index-list">
|
|
2
|
+
<view ref="u-index-list" class="u-index-list">
|
|
3
3
|
<!-- #ifdef APP-NVUE -->
|
|
4
4
|
<list
|
|
5
5
|
:scrollTop="scrollTop"
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
maxHeight: addUnit(scrollViewHeight)
|
|
10
10
|
}"
|
|
11
11
|
@scroll="scrollHandler"
|
|
12
|
-
ref="
|
|
12
|
+
ref="u-index-list__scroll-view"
|
|
13
|
+
class="u-index-list__scroll-view"
|
|
13
14
|
>
|
|
14
15
|
<cell
|
|
15
16
|
v-if="$slots.header"
|
|
@@ -33,13 +34,14 @@
|
|
|
33
34
|
}"
|
|
34
35
|
scroll-y
|
|
35
36
|
@scroll="scrollHandler"
|
|
36
|
-
ref="
|
|
37
|
+
ref="u-index-list__scroll-view"
|
|
38
|
+
class="u-index-list__scroll-view"
|
|
37
39
|
>
|
|
38
|
-
<view v-if="$slots.header">
|
|
40
|
+
<view class="u-index-list__header" v-if="$slots.header">
|
|
39
41
|
<slot name="header" />
|
|
40
42
|
</view>
|
|
41
43
|
<slot />
|
|
42
|
-
<view v-if="$slots.footer">
|
|
44
|
+
<view class="u-index-list__footer" v-if="$slots.footer">
|
|
43
45
|
<slot name="footer" />
|
|
44
46
|
</view>
|
|
45
47
|
</scroll-view>
|
|
@@ -47,7 +49,7 @@
|
|
|
47
49
|
<view
|
|
48
50
|
class="u-index-list__letter"
|
|
49
51
|
ref="u-index-list__letter"
|
|
50
|
-
:style="{
|
|
52
|
+
:style="{top: addUnit(letterInfo.top) , transform: 'translateY(-50%)'}"
|
|
51
53
|
@touchstart.prevent="touchStart"
|
|
52
54
|
@touchmove.prevent="touchMove"
|
|
53
55
|
@touchend.prevent="touchEnd"
|
|
@@ -71,10 +73,10 @@
|
|
|
71
73
|
mode="fade"
|
|
72
74
|
:show="touching"
|
|
73
75
|
:customStyle="{
|
|
74
|
-
position: '
|
|
76
|
+
position: 'absolute',
|
|
75
77
|
right: '50px',
|
|
76
|
-
top: addUnit(indicatorTop),
|
|
77
|
-
zIndex:
|
|
78
|
+
top: addUnit(indicatorTop, 'px'),
|
|
79
|
+
zIndex: 3
|
|
78
80
|
}"
|
|
79
81
|
>
|
|
80
82
|
<view
|
|
@@ -104,6 +106,7 @@
|
|
|
104
106
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
105
107
|
import { mixin } from '../../libs/mixin/mixin';
|
|
106
108
|
import { addUnit, sys, sleep, getPx } from '../../libs/function/index';
|
|
109
|
+
|
|
107
110
|
// #ifdef APP-NVUE
|
|
108
111
|
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
109
112
|
const dom = uni.requireNativePlugin('dom')
|
|
@@ -152,6 +155,8 @@
|
|
|
152
155
|
sys: sys(),
|
|
153
156
|
scrolling: false,
|
|
154
157
|
scrollIntoView: '',
|
|
158
|
+
pageY: 0,
|
|
159
|
+
topOffset: 0
|
|
155
160
|
}
|
|
156
161
|
},
|
|
157
162
|
computed: {
|
|
@@ -163,17 +168,18 @@
|
|
|
163
168
|
indicatorTop() {
|
|
164
169
|
const {
|
|
165
170
|
top,
|
|
171
|
+
height,
|
|
166
172
|
itemHeight
|
|
167
173
|
} = this.letterInfo
|
|
168
|
-
return Math.floor(top + itemHeight * this.activeIndex + itemHeight
|
|
174
|
+
return Math.floor(top - (height / 2) + itemHeight * this.activeIndex + itemHeight - 70 / 2)
|
|
169
175
|
}
|
|
170
176
|
},
|
|
171
177
|
watch: {
|
|
172
178
|
// 监听字母索引的变化,重新设置尺寸
|
|
173
179
|
uIndexList: {
|
|
174
|
-
immediate:
|
|
180
|
+
immediate: false,
|
|
175
181
|
handler() {
|
|
176
|
-
sleep().then(() => {
|
|
182
|
+
sleep(30).then(() => {
|
|
177
183
|
this.setIndexListLetterInfo()
|
|
178
184
|
})
|
|
179
185
|
}
|
|
@@ -182,10 +188,12 @@
|
|
|
182
188
|
created() {
|
|
183
189
|
this.children = []
|
|
184
190
|
this.anchors = []
|
|
185
|
-
this.init()
|
|
186
191
|
},
|
|
187
192
|
mounted() {
|
|
188
|
-
this.
|
|
193
|
+
this.init()
|
|
194
|
+
sleep(50).then(() => {
|
|
195
|
+
this.setIndexListLetterInfo()
|
|
196
|
+
})
|
|
189
197
|
},
|
|
190
198
|
methods: {
|
|
191
199
|
addUnit,
|
|
@@ -194,19 +202,32 @@
|
|
|
194
202
|
//减去this.customNavHeight,并将this.scrollViewHeight设置为maxHeight
|
|
195
203
|
//解决当u-index-list组件放在tabbar页面时,scroll-view内容较少时,还能滚动
|
|
196
204
|
let customNavHeight = getPx(this.customNavHeight)
|
|
197
|
-
this.scrollViewHeight = this.sys.windowHeight - customNavHeight
|
|
205
|
+
// this.scrollViewHeight = this.sys.windowHeight - customNavHeight
|
|
206
|
+
this.getIndexListRect().then(async sizeScroll => {
|
|
207
|
+
this.scrollViewHeight = sizeScroll.height ? sizeScroll.height : this.sys.windowHeight - customNavHeight
|
|
208
|
+
this.topOffset = this.sys.windowHeight - this.scrollViewHeight
|
|
209
|
+
// console.log('scrollViewHeight', this.scrollViewHeight)
|
|
210
|
+
// console.log('topOffset', this.topOffset)
|
|
211
|
+
})
|
|
198
212
|
},
|
|
199
213
|
// 索引列表被触摸
|
|
200
214
|
touchStart(e) {
|
|
201
215
|
// 获取触摸点信息
|
|
202
|
-
const
|
|
203
|
-
if (!
|
|
216
|
+
const touchStartData = e.changedTouches[0]
|
|
217
|
+
if (!touchStartData) return
|
|
204
218
|
this.touching = true
|
|
205
219
|
const {
|
|
206
|
-
pageY
|
|
207
|
-
|
|
220
|
+
pageY,
|
|
221
|
+
screenY
|
|
222
|
+
} = touchStartData
|
|
208
223
|
// 根据当前触摸点的坐标,获取当前触摸的为第几个字母
|
|
224
|
+
// #ifdef APP-NVUE
|
|
225
|
+
// 使用screenY要减去导航栏44和状态栏24高度
|
|
226
|
+
const currentIndex = this.getIndexListLetter(screenY - 68)
|
|
227
|
+
// #endif
|
|
228
|
+
// #ifndef APP-NVUE
|
|
209
229
|
const currentIndex = this.getIndexListLetter(pageY)
|
|
230
|
+
// #endif
|
|
210
231
|
this.setValueForTouch(currentIndex)
|
|
211
232
|
},
|
|
212
233
|
// 索引字母列表被触摸滑动中
|
|
@@ -220,9 +241,17 @@
|
|
|
220
241
|
this.touching = true
|
|
221
242
|
}
|
|
222
243
|
const {
|
|
223
|
-
pageY
|
|
244
|
+
pageY,
|
|
245
|
+
screenY
|
|
224
246
|
} = touchMove
|
|
247
|
+
// #ifdef APP-NVUE
|
|
248
|
+
// 使用screenY要减去导航栏44和状态栏24高度
|
|
249
|
+
const currentIndex = this.getIndexListLetter(screenY - 68)
|
|
250
|
+
// #endif
|
|
251
|
+
// #ifndef APP-NVUE
|
|
225
252
|
const currentIndex = this.getIndexListLetter(pageY)
|
|
253
|
+
// #endif
|
|
254
|
+
|
|
226
255
|
this.setValueForTouch(currentIndex)
|
|
227
256
|
},
|
|
228
257
|
// 触摸结束
|
|
@@ -250,9 +279,44 @@
|
|
|
250
279
|
// #endif
|
|
251
280
|
})
|
|
252
281
|
},
|
|
282
|
+
getIndexListScrollViewRect() {
|
|
283
|
+
return new Promise(resolve => {
|
|
284
|
+
// 延时一定时间,以获取dom尺寸
|
|
285
|
+
// #ifndef APP-NVUE
|
|
286
|
+
this.$uGetRect('.u-index-list__scroll-view').then(size => {
|
|
287
|
+
resolve(size)
|
|
288
|
+
})
|
|
289
|
+
// #endif
|
|
290
|
+
|
|
291
|
+
// #ifdef APP-NVUE
|
|
292
|
+
const ref = this.$refs['u-index-list__scroll-view']
|
|
293
|
+
dom.getComponentRect(ref, res => {
|
|
294
|
+
resolve(res.size)
|
|
295
|
+
})
|
|
296
|
+
// #endif
|
|
297
|
+
})
|
|
298
|
+
},
|
|
299
|
+
getIndexListRect() {
|
|
300
|
+
return new Promise(resolve => {
|
|
301
|
+
// 延时一定时间,以获取dom尺寸
|
|
302
|
+
// #ifndef APP-NVUE
|
|
303
|
+
this.$uGetRect('.u-index-list').then(size => {
|
|
304
|
+
resolve(size)
|
|
305
|
+
})
|
|
306
|
+
// #endif
|
|
307
|
+
|
|
308
|
+
// #ifdef APP-NVUE
|
|
309
|
+
const ref = this.$refs['u-index-list']
|
|
310
|
+
dom.getComponentRect(ref, res => {
|
|
311
|
+
resolve(res.size)
|
|
312
|
+
})
|
|
313
|
+
// #endif
|
|
314
|
+
})
|
|
315
|
+
},
|
|
253
316
|
// 设置indexList索引的尺寸信息
|
|
254
317
|
setIndexListLetterInfo() {
|
|
255
318
|
this.getIndexListLetterRect().then(size => {
|
|
319
|
+
// console.log('getIndexListLetterRect', size)
|
|
256
320
|
const {
|
|
257
321
|
height
|
|
258
322
|
} = size
|
|
@@ -271,38 +335,56 @@
|
|
|
271
335
|
} else {
|
|
272
336
|
customNavHeight = getPx(this.customNavHeight)
|
|
273
337
|
}
|
|
274
|
-
this.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
338
|
+
this.getIndexListScrollViewRect().then(sizeScroll => {
|
|
339
|
+
// console.log('sizeScroll', sizeScroll)
|
|
340
|
+
this.letterInfo = {
|
|
341
|
+
height,
|
|
342
|
+
// 为了让字母列表对屏幕绝对居中,让其对导航栏进行修正,也即往上偏移导航栏的一半高度
|
|
343
|
+
top: sizeScroll.height / 2,
|
|
344
|
+
// top: (this.scrollViewHeight - height) / 2 + customNavHeight / 2,
|
|
345
|
+
itemHeight: Math.floor(height / this.uIndexList.length)
|
|
346
|
+
}
|
|
347
|
+
})
|
|
280
348
|
})
|
|
281
349
|
},
|
|
282
350
|
// 获取当前被触摸的索引字母
|
|
283
351
|
getIndexListLetter(pageY) {
|
|
284
|
-
|
|
352
|
+
this.pageY = pageY
|
|
353
|
+
let {
|
|
285
354
|
top,
|
|
286
355
|
height,
|
|
287
356
|
itemHeight
|
|
288
357
|
} = this.letterInfo
|
|
358
|
+
let index = this.currentIndex;
|
|
289
359
|
// 对H5的pageY进行修正,这是由于uni-app自作多情在H5中将触摸点的坐标跟H5的导航栏结合导致的问题
|
|
290
360
|
// #ifdef H5
|
|
291
|
-
pageY += sys().windowTop
|
|
361
|
+
// pageY += sys().windowTop
|
|
292
362
|
// #endif
|
|
293
363
|
// 对第一和最后一个字母做边界处理,因为用户可能在字母列表上触摸到两端的尽头后依然继续滑动
|
|
364
|
+
// console.log('top1', top)
|
|
365
|
+
// console.log('height', height)
|
|
366
|
+
top = top - (height / 2) // 减去transfrom的translateY值导致的高度
|
|
367
|
+
pageY = pageY - this.topOffset
|
|
368
|
+
// if (this.safeBottomFix) {
|
|
369
|
+
// pageY = pageY + 34
|
|
370
|
+
// }
|
|
371
|
+
// console.log('topOffset', this.topOffset)
|
|
372
|
+
// console.log('pageY', pageY)
|
|
373
|
+
// console.log('top2', top)
|
|
294
374
|
if (pageY < top) {
|
|
295
|
-
|
|
375
|
+
index = 0
|
|
296
376
|
} else if (pageY >= top + height) {
|
|
297
377
|
// 如果超出了,取最后一个字母
|
|
298
|
-
|
|
378
|
+
index = this.uIndexList.length - 1
|
|
299
379
|
} else {
|
|
300
380
|
// 将触摸点的Y轴偏移值,减去索引字母的top值,除以每个字母的高度,即可得到当前触摸点落在哪个字母上
|
|
301
|
-
|
|
381
|
+
index = Math.floor((pageY - top) / itemHeight)
|
|
302
382
|
}
|
|
383
|
+
// console.log(index)
|
|
384
|
+
return index
|
|
303
385
|
},
|
|
304
386
|
// 设置各项由触摸而导致变化的值
|
|
305
|
-
setValueForTouch(currentIndex) {
|
|
387
|
+
async setValueForTouch(currentIndex) {
|
|
306
388
|
// 如果偏移量太小,前后得出的会是同一个索引字母,为了防抖,进行返回
|
|
307
389
|
if (currentIndex === this.activeIndex) return
|
|
308
390
|
this.activeIndex = currentIndex
|
|
@@ -310,14 +392,39 @@
|
|
|
310
392
|
// 在非nvue中,由于anchor和item都在u-index-item中,所以需要对index-item进行偏移
|
|
311
393
|
this.scrollIntoView = `u-index-item-${this.uIndexList[currentIndex].charCodeAt(0)}`
|
|
312
394
|
// #endif
|
|
395
|
+
|
|
313
396
|
// #ifdef MP-WEIXIN
|
|
314
397
|
// 微信小程序下,scroll-view的scroll-into-view属性无法对slot中的内容的id生效,只能通过设置scrollTop的形式去移动滚动条
|
|
315
398
|
const customNavHeight = this.customNavHeight
|
|
316
|
-
|
|
399
|
+
|
|
400
|
+
// 获取header slot的尺寸信息
|
|
401
|
+
const header = await this.getHeaderRect()
|
|
402
|
+
// item的top值,在nvue下,模拟出的anchor的top,类似非nvue下的index-item的top
|
|
403
|
+
let top = header.height
|
|
404
|
+
console.log(top)
|
|
405
|
+
const anchors = this.anchors
|
|
406
|
+
// 由于list组件无法获取cell的top值,这里通过header slot和各个item之间的height,模拟出类似非nvue下的位置信息
|
|
407
|
+
let children = this.children.map((item, index) => {
|
|
408
|
+
const child = {
|
|
409
|
+
height: item.height,
|
|
410
|
+
top: top
|
|
411
|
+
}
|
|
412
|
+
// 进行累加,给下一个item提供计算依据
|
|
413
|
+
top = top + item.height
|
|
414
|
+
// #ifdef APP-NVUE
|
|
415
|
+
// 只有nvue下,需要将锚点的高度也累加,非nvue下锚点高度是包含在index-item中的。
|
|
416
|
+
top = top + anchors[index].height
|
|
417
|
+
// #endif
|
|
418
|
+
return child
|
|
419
|
+
})
|
|
420
|
+
// console.log('this.children[currentIndex].top', children[currentIndex].top)
|
|
421
|
+
this.scrollTop = children[currentIndex].top - getPx(customNavHeight)
|
|
317
422
|
// #endif
|
|
423
|
+
|
|
318
424
|
// #ifdef APP-NVUE
|
|
319
425
|
// 在nvue中,由于cell和header为同级元素,所以实际是需要对header(anchor)进行偏移
|
|
320
426
|
const anchor = `u-index-anchor-${this.uIndexList[currentIndex]}`
|
|
427
|
+
console.log(anchor)
|
|
321
428
|
dom.scrollToElement(this.anchors[currentIndex].$refs[anchor], {
|
|
322
429
|
offset: 0,
|
|
323
430
|
animated: false
|
|
@@ -327,9 +434,18 @@
|
|
|
327
434
|
getHeaderRect() {
|
|
328
435
|
// 获取header slot的高度,因为list组件中获取元素的尺寸是没有top值的
|
|
329
436
|
return new Promise(resolve => {
|
|
437
|
+
// #ifndef APP-NVUE
|
|
438
|
+
this.$uGetRect('.u-index-list__header').then(size => {
|
|
439
|
+
resolve(size)
|
|
440
|
+
})
|
|
441
|
+
// #endif
|
|
442
|
+
|
|
443
|
+
// #ifdef APP-NVUE
|
|
330
444
|
dom.getComponentRect(this.$refs.header, res => {
|
|
331
445
|
resolve(res.size)
|
|
332
446
|
})
|
|
447
|
+
// #endif
|
|
448
|
+
|
|
333
449
|
})
|
|
334
450
|
},
|
|
335
451
|
// scroll-view的滚动事件
|
|
@@ -343,36 +459,45 @@
|
|
|
343
459
|
let scrollTop = 0
|
|
344
460
|
const len = this.children.length
|
|
345
461
|
let children = this.children
|
|
346
|
-
const anchors = this.anchors
|
|
347
462
|
// #ifdef APP-NVUE
|
|
348
463
|
// nvue下获取的滚动条偏移为负数,需要转为正数
|
|
349
|
-
|
|
464
|
+
let sys = uni.getSystemInfoSync()
|
|
465
|
+
scrollTop = Math.abs(e.contentOffset.y) / 10
|
|
466
|
+
// console.log('native', e)
|
|
467
|
+
// #endif
|
|
468
|
+
|
|
350
469
|
// 获取header slot的尺寸信息
|
|
351
470
|
const header = await this.getHeaderRect()
|
|
352
471
|
// item的top值,在nvue下,模拟出的anchor的top,类似非nvue下的index-item的top
|
|
353
472
|
let top = header.height
|
|
473
|
+
const anchors = this.anchors
|
|
354
474
|
// 由于list组件无法获取cell的top值,这里通过header slot和各个item之间的height,模拟出类似非nvue下的位置信息
|
|
355
475
|
children = this.children.map((item, index) => {
|
|
356
476
|
const child = {
|
|
357
477
|
height: item.height,
|
|
358
|
-
top
|
|
478
|
+
top: top
|
|
359
479
|
}
|
|
360
480
|
// 进行累加,给下一个item提供计算依据
|
|
361
|
-
top
|
|
481
|
+
top = top + item.height
|
|
482
|
+
// #ifdef APP-NVUE
|
|
483
|
+
// 只有nvue下,需要将锚点的高度也累加,非nvue下锚点高度是包含在index-item中的。
|
|
484
|
+
top = top + anchors[index].height
|
|
485
|
+
// #endif
|
|
362
486
|
return child
|
|
363
487
|
})
|
|
364
|
-
|
|
488
|
+
|
|
365
489
|
// #ifndef APP-NVUE
|
|
366
490
|
// 非nvue通过detail获取滚动条位移
|
|
367
491
|
scrollTop = e.detail.scrollTop
|
|
492
|
+
// console.log('scrollTop', scrollTop, this.customNavHeight)
|
|
368
493
|
// #endif
|
|
369
|
-
|
|
494
|
+
// 在弹窗中需要加上弹窗距离顶部的高度topOffset
|
|
495
|
+
scrollTop = scrollTop + getPx(this.customNavHeight)
|
|
370
496
|
for (let i = 0; i < len; i++) {
|
|
371
497
|
const item = children[i],
|
|
372
498
|
nextItem = children[i + 1]
|
|
373
499
|
// 如果滚动条高度小于第一个item的top值,此时无需设置任意字母为高亮
|
|
374
|
-
if (scrollTop <= children[0].top || scrollTop >= children[len - 1].top + children[len -
|
|
375
|
-
1].height) {
|
|
500
|
+
if (scrollTop <= children[0].top || scrollTop >= children[len - 1].top + children[len - 1].height) {
|
|
376
501
|
this.activeIndex = -1
|
|
377
502
|
break
|
|
378
503
|
} else if (!nextItem) {
|
|
@@ -395,11 +520,12 @@
|
|
|
395
520
|
.u-index-list {
|
|
396
521
|
|
|
397
522
|
&__letter {
|
|
398
|
-
position:
|
|
523
|
+
position: absolute;
|
|
399
524
|
right: 0;
|
|
400
525
|
text-align: center;
|
|
401
526
|
z-index: 3;
|
|
402
527
|
padding: 0 6px;
|
|
528
|
+
width: 30px;
|
|
403
529
|
|
|
404
530
|
&__item {
|
|
405
531
|
width: 16px;
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
// 图片高度,单位rpx
|
|
98
98
|
height: {
|
|
99
99
|
type: [Number, String],
|
|
100
|
-
default: '
|
|
100
|
+
default: '200'
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
data() {
|
|
@@ -207,9 +207,12 @@
|
|
|
207
207
|
});
|
|
208
208
|
})
|
|
209
209
|
// mounted的时候,不一定挂载了这个元素,延时30ms,否则会报错或者不报错,但是也没有效果
|
|
210
|
+
|
|
210
211
|
setTimeout(() => {
|
|
212
|
+
// #ifndef APP-NVUE
|
|
211
213
|
// 这里是组件内获取布局状态,不能用uni.createIntersectionObserver,而必须用this.createIntersectionObserver
|
|
212
214
|
// this.disconnectObserver('contentObserver');
|
|
215
|
+
// nvue 里不支持
|
|
213
216
|
const contentObserver = uni.createIntersectionObserver(this);
|
|
214
217
|
// 要理解这里怎么计算的,请看这个:
|
|
215
218
|
// https://blog.csdn.net/qq_25324335/article/details/83687695
|
|
@@ -225,6 +228,10 @@
|
|
|
225
228
|
}
|
|
226
229
|
})
|
|
227
230
|
this.contentObserver = contentObserver;
|
|
231
|
+
// #endif
|
|
232
|
+
// #ifdef APP-NVUE
|
|
233
|
+
this.isShow = true;
|
|
234
|
+
// #endif
|
|
228
235
|
}, 30)
|
|
229
236
|
}
|
|
230
237
|
}
|
|
@@ -239,13 +246,13 @@
|
|
|
239
246
|
}
|
|
240
247
|
|
|
241
248
|
.u-lazy-item {
|
|
242
|
-
width: 100%;
|
|
243
249
|
// 骗系统开启硬件加速
|
|
244
250
|
transform: transition3d(0, 0, 0);
|
|
251
|
+
/* #ifndef APP-NVUE */
|
|
245
252
|
// 防止图片加载“闪一下”
|
|
246
253
|
will-change: transform;
|
|
247
|
-
/* #ifndef APP-NVUE */
|
|
248
254
|
display: block;
|
|
255
|
+
width: 100%;
|
|
249
256
|
/* #endif */
|
|
250
257
|
}
|
|
251
258
|
</style>
|
|
@@ -315,7 +315,9 @@
|
|
|
315
315
|
height: $u-loading-icon-dot-height;
|
|
316
316
|
|
|
317
317
|
&:before {
|
|
318
|
+
/* #ifndef APP-NVUE */
|
|
318
319
|
display: block;
|
|
320
|
+
/* #endif */
|
|
319
321
|
width: $u-loading-icon-dot-before-width;
|
|
320
322
|
height: $u-loading-icon-dot-before-height;
|
|
321
323
|
margin: $u-loading-icon-dot-before-margin;
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
width: addUnit(width),
|
|
21
21
|
}"
|
|
22
22
|
>
|
|
23
|
-
<
|
|
23
|
+
<view
|
|
24
24
|
class="u-modal__title"
|
|
25
25
|
v-if="title"
|
|
26
|
-
>{{ title }}</
|
|
26
|
+
>{{ title }}</view>
|
|
27
27
|
<view
|
|
28
28
|
class="u-modal__content"
|
|
29
29
|
:style="{
|
|
@@ -174,7 +174,10 @@
|
|
|
174
174
|
overflow: hidden;
|
|
175
175
|
|
|
176
176
|
&__title {
|
|
177
|
-
display:
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
align-items: center;
|
|
178
181
|
font-size: 16px;
|
|
179
182
|
font-weight: bold;
|
|
180
183
|
color: $u-content-color;
|
|
@@ -168,7 +168,7 @@ export default {
|
|
|
168
168
|
}
|
|
169
169
|
// #endif
|
|
170
170
|
},
|
|
171
|
-
|
|
171
|
+
beforeUnmount () {
|
|
172
172
|
// #ifdef H5 || APP-PLUS
|
|
173
173
|
if (this.observer) {
|
|
174
174
|
this.observer.disconnect()
|
|
@@ -407,7 +407,9 @@ export default {
|
|
|
407
407
|
._a {
|
|
408
408
|
padding: 1.5px 0 1.5px 0;
|
|
409
409
|
color: #366092;
|
|
410
|
+
/* #ifndef APP-NVUE */
|
|
410
411
|
word-break: break-all;
|
|
412
|
+
/* #endif */
|
|
411
413
|
}
|
|
412
414
|
|
|
413
415
|
/* a 标签点击态效果 */
|
|
@@ -425,7 +427,9 @@ export default {
|
|
|
425
427
|
/* 内部样式 */
|
|
426
428
|
|
|
427
429
|
._block {
|
|
430
|
+
/* #ifndef APP-NVUE */
|
|
428
431
|
display: block;
|
|
432
|
+
/* #endif */
|
|
429
433
|
}
|
|
430
434
|
|
|
431
435
|
._b,
|
|
@@ -472,7 +476,9 @@ export default {
|
|
|
472
476
|
._h4,
|
|
473
477
|
._h5,
|
|
474
478
|
._h6 {
|
|
479
|
+
/* #ifndef APP-NVUE */
|
|
475
480
|
display: block;
|
|
481
|
+
/* #endif */
|
|
476
482
|
font-weight: bold;
|
|
477
483
|
}
|
|
478
484
|
|
|
@@ -494,7 +500,9 @@ export default {
|
|
|
494
500
|
|
|
495
501
|
._ol,
|
|
496
502
|
._ul {
|
|
503
|
+
/* #ifndef APP-NVUE */
|
|
497
504
|
display: block;
|
|
505
|
+
/* #endif */
|
|
498
506
|
padding-left: 40px;
|
|
499
507
|
margin: 1em 0;
|
|
500
508
|
}
|
|
@@ -126,13 +126,7 @@ export default {
|
|
|
126
126
|
this.setContent(this.content)
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
|
-
|
|
130
|
-
// beforeDestroy()
|
|
131
|
-
// #endif
|
|
132
|
-
// #ifdef VUE3
|
|
133
|
-
beforeUnmount()
|
|
134
|
-
// #endif
|
|
135
|
-
{
|
|
129
|
+
beforeUnmount() {
|
|
136
130
|
this._hook('onDetached')
|
|
137
131
|
},
|
|
138
132
|
methods: {
|
|
@@ -177,15 +177,17 @@
|
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
179
|
},
|
|
180
|
-
emits: ["open", "close", "click"],
|
|
180
|
+
emits: ["open", "close", "click", "update:show"],
|
|
181
181
|
methods: {
|
|
182
182
|
// 点击遮罩
|
|
183
183
|
overlayClick() {
|
|
184
184
|
if (this.closeOnClickOverlay) {
|
|
185
|
+
this.$emit('update:show', false)
|
|
185
186
|
this.$emit('close')
|
|
186
187
|
}
|
|
187
188
|
},
|
|
188
189
|
close(e) {
|
|
190
|
+
this.$emit('update:show', false)
|
|
189
191
|
this.$emit('close')
|
|
190
192
|
},
|
|
191
193
|
afterEnter() {
|
|
@@ -275,16 +275,9 @@
|
|
|
275
275
|
this.$emit('close')
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
|
-
// #ifdef APP-NVUE
|
|
279
|
-
// #ifdef VUE2
|
|
280
|
-
beforeDestroy() {
|
|
281
|
-
// #endif
|
|
282
|
-
// #ifdef VUE3
|
|
283
278
|
beforeUnmount() {
|
|
284
|
-
// #endif
|
|
285
279
|
this.stopAnimation = true
|
|
286
|
-
}
|
|
287
|
-
// #endif
|
|
280
|
+
}
|
|
288
281
|
};
|
|
289
282
|
</script>
|
|
290
283
|
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
// 此处不写注释,请自行体会
|
|
7
7
|
nvueScrollHandler(e) {
|
|
8
8
|
const anchor = this.$refs['u-scroll-list__scroll-view'].ref
|
|
9
|
-
|
|
9
|
+
let element = {}
|
|
10
10
|
if (this.$refs['u-scroll-list__indicator__line__bar']) {
|
|
11
11
|
element = this.$refs['u-scroll-list__indicator__line__bar'].ref
|
|
12
12
|
}
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
<!-- #ifdef MP-WEIXIN || APP-VUE || H5 || MP-QQ -->
|
|
23
23
|
<!-- 以上平台,支持wxs -->
|
|
24
24
|
<scroll-view
|
|
25
|
-
class="u-scroll-list__scroll-view"
|
|
25
|
+
class="u-scroll-list__scroll-view scroll-view-native"
|
|
26
26
|
scroll-x
|
|
27
|
+
enable-flex
|
|
27
28
|
@scroll="wxs.scroll"
|
|
28
29
|
@scrolltoupper="wxs.scrolltoupper"
|
|
29
30
|
@scrolltolower="wxs.scrolltolower"
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
<!-- #ifndef APP-NVUE || MP-WEIXIN || H5 || APP-VUE || MP-QQ -->
|
|
39
40
|
<!-- 非以上平台,只能使用普通js实现 -->
|
|
40
41
|
<scroll-view
|
|
41
|
-
class="u-scroll-list__scroll-view"
|
|
42
|
+
class="u-scroll-list__scroll-view scroll-view-js"
|
|
42
43
|
scroll-x
|
|
43
44
|
@scroll="scrollHandler"
|
|
44
45
|
@scrolltoupper="scrolltoupperHandler"
|
|
@@ -204,6 +205,8 @@ export default {
|
|
|
204
205
|
|
|
205
206
|
&__scroll-view {
|
|
206
207
|
@include flex;
|
|
208
|
+
// 缺少会在enable-flex模式下高度异常
|
|
209
|
+
align-items: flex-start;
|
|
207
210
|
|
|
208
211
|
&__content {
|
|
209
212
|
@include flex;
|