uview-plus 3.8.55 → 3.8.106
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 +2147 -1828
- package/components/u-action-sheet/props.js +3 -1
- package/components/u-action-sheet/u-action-sheet.vue +22 -2
- package/components/u-album/props.js +3 -1
- package/components/u-alert/props.js +4 -2
- package/components/u-avatar/props.js +4 -1
- package/components/u-avatar-group/props.js +4 -1
- package/components/u-back-top/props.js +4 -1
- package/components/u-badge/props.js +4 -1
- package/components/u-barcode/u-barcode.vue +44 -15
- package/components/u-box/props.js +5 -2
- package/components/u-button/props.js +4 -1
- package/components/u-button/u-button.vue +2 -5
- package/components/u-button/vue.scss +3 -3
- package/components/u-calendar/calendar.js +8 -0
- package/components/u-calendar/props.js +43 -1
- package/components/u-calendar/u-calendar.vue +16 -0
- package/components/u-calendar-strip/props.js +3 -1
- package/components/u-canvas/u-canvas.vue +1028 -423
- package/components/u-car-keyboard/props.js +3 -1
- package/components/u-card/props.js +3 -1
- package/components/u-cell/props.js +4 -1
- package/components/u-cell/u-cell.vue +9 -1
- package/components/u-cell-group/props.js +4 -1
- package/components/u-checkbox/props.js +4 -1
- package/components/u-checkbox/u-checkbox.vue +7 -3
- package/components/u-checkbox-group/props.js +3 -1
- package/components/u-circle-progress/props.js +4 -1
- package/components/u-code/props.js +4 -1
- package/components/u-code-input/props.js +4 -1
- package/components/u-col/props.js +4 -1
- package/components/u-collapse/props.js +4 -1
- package/components/u-collapse-item/props.js +4 -1
- package/components/u-color-picker/u-color-picker.vue +1 -0
- package/components/u-column-notice/props.js +4 -1
- package/components/u-count-down/props.js +4 -1
- package/components/u-count-to/props.js +4 -1
- package/components/u-cropper/u-cropper.vue +95 -51
- package/components/u-datetime-picker/props.js +4 -1
- package/components/u-datetime-picker/u-datetime-picker.vue +53 -4
- package/components/u-divider/props.js +4 -1
- package/components/u-dragsort/u-dragsort.vue +57 -32
- package/components/u-dropdown/props.js +3 -1
- package/components/u-dropdown-item/props.js +3 -1
- package/components/u-empty/props.js +4 -1
- package/components/u-form/props.js +4 -1
- package/components/u-form-item/props.js +4 -1
- package/components/u-gap/props.js +4 -1
- package/components/u-grid/props.js +4 -1
- package/components/u-grid-item/props.js +4 -1
- package/components/u-guide/props.js +3 -1
- package/components/u-icon/props.js +4 -1
- package/components/u-icon/u-icon.vue +11 -2
- package/components/u-icon/upicon.ttf +0 -0
- package/components/u-icon/util.js +103 -10
- package/components/u-image/props.js +4 -1
- package/components/u-image/u-image.vue +280 -267
- package/components/u-index-anchor/props.js +4 -1
- package/components/u-index-item/props.js +2 -1
- package/components/u-index-item/u-index-item.vue +1 -1
- package/components/u-index-list/props.js +4 -1
- package/components/u-index-list/u-index-list.vue +1 -1
- package/components/u-input/props.js +3 -1
- package/components/u-keyboard/props.js +4 -1
- package/components/u-line/props.js +4 -1
- package/components/u-line-progress/props.js +6 -3
- package/components/u-link/props.js +4 -1
- package/components/u-list/props.js +4 -1
- package/components/u-list-item/props.js +4 -1
- package/components/u-loading-icon/props.js +4 -1
- package/components/u-loading-page/props.js +3 -1
- package/components/u-loadmore/props.js +4 -1
- package/components/u-markdown/u-markdown.vue +45 -3
- package/components/u-modal/props.js +4 -1
- package/components/u-navbar/props.js +4 -2
- package/components/u-navbar/u-navbar.vue +15 -9
- package/components/u-no-network/props.js +4 -1
- package/components/u-notice-bar/props.js +4 -1
- package/components/u-notify/props.js +4 -1
- package/components/u-novel-reader/content-normalizer.js +80 -0
- package/components/u-novel-reader/layout-engine.js +225 -0
- package/components/u-novel-reader/measure-adapter.js +69 -0
- package/components/u-novel-reader/novelReader.js +35 -0
- package/components/u-novel-reader/persistence.js +144 -0
- package/components/u-novel-reader/props.js +100 -0
- package/components/u-novel-reader/reader-catalog.vue +234 -0
- package/components/u-novel-reader/reader-content.vue +226 -0
- package/components/u-novel-reader/reader-core.js +151 -0
- package/components/u-novel-reader/reader-settings.vue +325 -0
- package/components/u-novel-reader/reader-toolbar.vue +313 -0
- package/components/u-novel-reader/theme-vars.scss +49 -0
- package/components/u-novel-reader/u-novel-reader.vue +836 -0
- package/components/u-number-box/props.js +4 -1
- package/components/u-number-box/u-number-box.vue +2 -2
- package/components/u-number-keyboard/props.js +4 -1
- package/components/u-overlay/props.js +4 -1
- package/components/u-pagination/u-pagination.vue +60 -39
- package/components/u-parse/props.js +4 -1
- package/components/u-picker/props.js +4 -1
- package/components/u-picker-column/props.js +3 -1
- package/components/u-popover/props.js +2 -1
- package/components/u-popup/props.js +4 -1
- package/components/u-poster/u-poster.vue +246 -214
- package/components/u-qrcode/qrcode.js +105 -97
- package/components/u-qrcode/u-qrcode.vue +242 -289
- package/components/u-radio/props.js +4 -1
- package/components/u-radio/u-radio.vue +7 -3
- package/components/u-radio-group/props.js +4 -1
- package/components/u-rate/props.js +4 -1
- package/components/u-read-more/props.js +4 -1
- package/components/u-row/props.js +4 -1
- package/components/u-row-notice/props.js +4 -1
- package/components/u-safe-bottom/props.js +2 -1
- package/components/u-scroll-list/props.js +4 -1
- package/components/u-scroll-list/scrollWxs.wxs +1 -1
- package/components/u-search/props.js +3 -1
- package/components/u-skeleton/props.js +4 -1
- package/components/u-slider/props.js +3 -1
- package/components/u-slider/u-slider.vue +71 -29
- package/components/u-status-bar/props.js +4 -1
- package/components/u-steps/props.js +4 -1
- package/components/u-steps-item/props.js +4 -1
- package/components/u-sticky/props.js +4 -1
- package/components/u-sticky/u-sticky.vue +11 -0
- package/components/u-subsection/props.js +3 -1
- package/components/u-swipe-action/props.js +4 -1
- package/components/u-swipe-action-item/index.wxs +43 -25
- package/components/u-swipe-action-item/nvue.js +9 -0
- package/components/u-swipe-action-item/other.js +32 -21
- package/components/u-swipe-action-item/props.js +9 -1
- package/components/u-swipe-action-item/swipeActionItem.js +1 -0
- package/components/u-swipe-action-item/u-swipe-action-item.vue +42 -4
- package/components/u-swiper/props.js +9 -1
- package/components/u-swiper/swiper.js +1 -0
- package/components/u-swiper/u-swiper.vue +2 -0
- package/components/u-swiper-indicator/props.js +4 -1
- package/components/u-switch/props.js +4 -1
- package/components/u-switch/u-switch.vue +1 -1
- package/components/u-tabbar/props.js +3 -1
- package/components/u-tabbar/u-tabbar.vue +2 -1
- package/components/u-tabbar-item/props.js +4 -1
- package/components/u-tabbar-item/u-tabbar-item.vue +64 -21
- package/components/u-table/props.js +3 -1
- package/components/u-table2/tableRow.vue +155 -69
- package/components/u-table2/u-table2.vue +327 -137
- package/components/u-tabs/props.js +4 -1
- package/components/u-tabs/u-tabs.vue +11 -8
- package/components/u-tabs-item/props.js +3 -1
- package/components/u-tabs-pro/u-tabs-pro.vue +212 -0
- package/components/u-tag/props.js +4 -1
- package/components/u-td/props.js +3 -1
- package/components/u-text/props.js +4 -1
- package/components/u-text/text.js +1 -1
- package/components/u-text/u-text.vue +18 -6
- package/components/u-textarea/props.js +3 -1
- package/components/u-textarea/u-textarea.vue +16 -5
- package/components/u-th/props.js +3 -1
- package/components/u-toolbar/props.js +4 -1
- package/components/u-tooltip/props.js +10 -2
- package/components/u-tooltip/tooltip.js +2 -1
- package/components/u-tooltip/u-tooltip.vue +31 -3
- package/components/u-tr/props.js +3 -1
- package/components/u-transition/nvue-ani-map.js +75 -68
- package/components/u-transition/props.js +4 -1
- package/components/u-transition/transitionMixin.js +164 -163
- package/components/u-upload/props.js +4 -1
- package/components/u-upload/u-upload.vue +48 -41
- package/components/u-waterfall/u-waterfall.vue +162 -110
- package/index.js +65 -8
- package/libs/config/config.js +1 -1
- package/libs/config/props.js +180 -204
- package/libs/css/components.scss +3 -0
- package/libs/function/index.js +66 -0
- package/libs/function/uni-api-shims.js +29 -0
- package/libs/i18n/index.js +71 -36
- package/libs/i18n/locale-packs.js +11 -0
- package/libs/i18n/locales/all.js +23 -0
- package/libs/i18n/locales/{de.json → de.js} +1 -1
- package/libs/i18n/locales/{en.json → en.js} +2 -2
- package/libs/i18n/locales/{es.json → es.js} +1 -1
- package/libs/i18n/locales/{fr.json → fr.js} +2 -2
- package/libs/i18n/locales/{ja.json → ja.js} +1 -1
- package/libs/i18n/locales/{ko.json → ko.js} +1 -1
- package/libs/i18n/locales/{ru.json → ru.js} +1 -1
- package/libs/i18n/locales/{th.json → th.js} +1 -1
- package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
- package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
- package/libs/mixin/mixin.js +18 -54
- package/libs/root/index.js +78 -5
- package/libs/root/page.js +7 -7
- package/libs/root/root.js +73 -3
- package/libs/util/app-nvue-webview-canvas.js +486 -0
- package/libs/util/gcanvas/bridge/bridge-weex.js +10 -7
- 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 +3 -3
- package/package.json +4 -5
- package/tsconfig.json +18 -0
- package/types/comps/calendar.d.ts +38 -0
- package/types/comps/checkbox.d.ts +12 -0
- package/types/comps/lineProgress.d.ts +5 -0
- package/types/comps/navbar.d.ts +3 -3
- package/types/comps/swipeActionItem.d.ts +13 -0
- package/types/comps/swiper.d.ts +5 -0
- package/types/comps/tabs.d.ts +2 -1
- package/types/comps/text.d.ts +1 -1
- package/types/comps/tooltip.d.ts +36 -1
- package/types/func.d.ts +23 -0
- package/types/index.d.ts +1 -0
- /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
|
@@ -1,68 +1,75 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
// 无动画模式:直接显示/隐藏,供 pageInline 等常驻场景使用
|
|
3
|
+
none: {
|
|
4
|
+
enter: { opacity: 1 },
|
|
5
|
+
'enter-to': { opacity: 1 },
|
|
6
|
+
leave: { opacity: 1 },
|
|
7
|
+
'leave-to': { opacity: 0 }
|
|
8
|
+
},
|
|
9
|
+
fade: {
|
|
10
|
+
enter: { opacity: 0 },
|
|
11
|
+
'enter-to': { opacity: 1 },
|
|
12
|
+
leave: { opacity: 1 },
|
|
13
|
+
'leave-to': { opacity: 0 }
|
|
14
|
+
},
|
|
15
|
+
'fade-up': {
|
|
16
|
+
enter: { opacity: 0, transform: 'translateY(100%)' },
|
|
17
|
+
'enter-to': { opacity: 1, transform: 'translateY(0)' },
|
|
18
|
+
leave: { opacity: 1, transform: 'translateY(0)' },
|
|
19
|
+
'leave-to': { opacity: 0, transform: 'translateY(100%)' }
|
|
20
|
+
},
|
|
21
|
+
'fade-down': {
|
|
22
|
+
enter: { opacity: 0, transform: 'translateY(-100%)' },
|
|
23
|
+
'enter-to': { opacity: 1, transform: 'translateY(0)' },
|
|
24
|
+
leave: { opacity: 1, transform: 'translateY(0)' },
|
|
25
|
+
'leave-to': { opacity: 0, transform: 'translateY(-100%)' }
|
|
26
|
+
},
|
|
27
|
+
'fade-left': {
|
|
28
|
+
enter: { opacity: 0, transform: 'translateX(-100%)' },
|
|
29
|
+
'enter-to': { opacity: 1, transform: 'translateY(0)' },
|
|
30
|
+
leave: { opacity: 1, transform: 'translateY(0)' },
|
|
31
|
+
'leave-to': { opacity: 0, transform: 'translateX(-100%)' }
|
|
32
|
+
},
|
|
33
|
+
'fade-right': {
|
|
34
|
+
enter: { opacity: 0, transform: 'translateX(100%)' },
|
|
35
|
+
'enter-to': { opacity: 1, transform: 'translateY(0)' },
|
|
36
|
+
leave: { opacity: 1, transform: 'translateY(0)' },
|
|
37
|
+
'leave-to': { opacity: 0, transform: 'translateX(100%)' }
|
|
38
|
+
},
|
|
39
|
+
'slide-up': {
|
|
40
|
+
enter: { transform: 'translateY(100%)' },
|
|
41
|
+
'enter-to': { transform: 'translateY(0)' },
|
|
42
|
+
leave: { transform: 'translateY(0)' },
|
|
43
|
+
'leave-to': { transform: 'translateY(100%)' }
|
|
44
|
+
},
|
|
45
|
+
'slide-down': {
|
|
46
|
+
enter: { transform: 'translateY(-100%)' },
|
|
47
|
+
'enter-to': { transform: 'translateY(0)' },
|
|
48
|
+
leave: { transform: 'translateY(0)' },
|
|
49
|
+
'leave-to': { transform: 'translateY(-100%)' }
|
|
50
|
+
},
|
|
51
|
+
'slide-left': {
|
|
52
|
+
enter: { transform: 'translateX(-100%)' },
|
|
53
|
+
'enter-to': { transform: 'translateY(0)' },
|
|
54
|
+
leave: { transform: 'translateY(0)' },
|
|
55
|
+
'leave-to': { transform: 'translateX(-100%)' }
|
|
56
|
+
},
|
|
57
|
+
'slide-right': {
|
|
58
|
+
enter: { transform: 'translateX(100%)' },
|
|
59
|
+
'enter-to': { transform: 'translateY(0)' },
|
|
60
|
+
leave: { transform: 'translateY(0)' },
|
|
61
|
+
'leave-to': { transform: 'translateX(100%)' }
|
|
62
|
+
},
|
|
63
|
+
zoom: {
|
|
64
|
+
enter: { transform: 'scale(0.95)' },
|
|
65
|
+
'enter-to': { transform: 'scale(1)' },
|
|
66
|
+
leave: { transform: 'scale(1)' },
|
|
67
|
+
'leave-to': { transform: 'scale(0.95)' }
|
|
68
|
+
},
|
|
69
|
+
'fade-zoom': {
|
|
70
|
+
enter: { opacity: 0, transform: 'scale(0.95)' },
|
|
71
|
+
'enter-to': { opacity: 1, transform: 'scale(1)' },
|
|
72
|
+
leave: { opacity: 1, transform: 'scale(1)' },
|
|
73
|
+
'leave-to': { opacity: 0, transform: 'scale(0.95)' }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import TransitionDefaultProps from './transition'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(TransitionDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 是否展示组件
|
|
@@ -1,163 +1,164 @@
|
|
|
1
|
-
// 定义一个一定时间后自动成功的promise,让调用nextTick方法处,进入下一个then方法
|
|
2
|
-
const waitTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 50))
|
|
3
|
-
// nvue动画模块实现细节抽离在外部文件
|
|
4
|
-
// #ifdef APP-NVUE
|
|
5
|
-
import animationMap from './nvue-ani-map.js'
|
|
6
|
-
// #endif
|
|
7
|
-
|
|
8
|
-
// #ifndef APP-NVUE
|
|
9
|
-
// 定义类名,通过给元素动态切换类名,赋予元素一定的css动画样式
|
|
10
|
-
const getClassNames = (name) => ({
|
|
11
|
-
enter: `u-${name}-enter u-${name}-enter-active`,
|
|
12
|
-
'enter-to': `u-${name}-enter-to u-${name}-enter-active`,
|
|
13
|
-
leave: `u-${name}-leave u-${name}-leave-active`,
|
|
14
|
-
'leave-to': `u-${name}-leave-to u-${name}-leave-active`
|
|
15
|
-
})
|
|
16
|
-
// #endif
|
|
17
|
-
|
|
18
|
-
// #ifdef APP-NVUE
|
|
19
|
-
// 引入nvue(weex)的animation动画模块,文档见:
|
|
20
|
-
// https://weex.apache.org/zh/docs/modules/animation.html#transition
|
|
21
|
-
const animation = uni.requireNativePlugin('animation')
|
|
22
|
-
const getStyle = (name) => animationMap[name]
|
|
23
|
-
// #endif
|
|
24
|
-
|
|
25
|
-
import { nextTick } from 'vue'
|
|
26
|
-
import { sleep } from '../../libs/function/index';
|
|
27
|
-
export default {
|
|
28
|
-
methods: {
|
|
29
|
-
// 组件被点击发出事件
|
|
30
|
-
clickHandler() {
|
|
31
|
-
this.$emit('click')
|
|
32
|
-
},
|
|
33
|
-
// #ifndef APP-NVUE
|
|
34
|
-
// vue版本的组件进场处理
|
|
35
|
-
async vueEnter() {
|
|
36
|
-
// 动画进入时的类名
|
|
37
|
-
const classNames = getClassNames(this.mode)
|
|
38
|
-
// 定义状态和发出动画进入前事件
|
|
39
|
-
this.status = 'enter'
|
|
40
|
-
this.$emit('beforeEnter')
|
|
41
|
-
this.inited = true
|
|
42
|
-
this.display = true
|
|
43
|
-
this.classes = classNames.enter
|
|
44
|
-
await nextTick();
|
|
45
|
-
{
|
|
46
|
-
// https://github.com/umicro/uView2.0/issues/545
|
|
47
|
-
await sleep(20)
|
|
48
|
-
// 标识动画尚未结束
|
|
49
|
-
this.$emit('enter')
|
|
50
|
-
this.transitionEnded = false
|
|
51
|
-
// 组件动画进入后触发的事件
|
|
52
|
-
this.$emit('afterEnter')
|
|
53
|
-
// 赋予组件enter-to类名
|
|
54
|
-
this.classes = classNames['enter-to']
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
// 动画离场处理
|
|
58
|
-
async vueLeave() {
|
|
59
|
-
// 如果不是展示状态,无需执行逻辑
|
|
60
|
-
if (!this.display) return
|
|
61
|
-
const classNames = getClassNames(this.mode)
|
|
62
|
-
// 标记离开状态和发出事件
|
|
63
|
-
this.status = 'leave'
|
|
64
|
-
this.$emit('beforeLeave')
|
|
65
|
-
// 获得类名
|
|
66
|
-
this.classes = classNames.leave
|
|
67
|
-
|
|
68
|
-
await nextTick();
|
|
69
|
-
{
|
|
70
|
-
// 动画正在离场的状态
|
|
71
|
-
this.transitionEnded = false
|
|
72
|
-
this.$emit('leave')
|
|
73
|
-
// 组件执行动画,到了执行的执行时间后,执行一些额外处理
|
|
74
|
-
setTimeout(this.onTransitionEnd, this.duration)
|
|
75
|
-
this.classes = classNames['leave-to']
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
// #endif
|
|
79
|
-
// #ifdef APP-NVUE
|
|
80
|
-
// nvue版本动画进场
|
|
81
|
-
async nvueEnter() {
|
|
82
|
-
// 获得样式的名称
|
|
83
|
-
const currentStyle = getStyle(this.mode)
|
|
84
|
-
// 组件动画状态和发出事件
|
|
85
|
-
this.status = 'enter'
|
|
86
|
-
this.$emit('beforeEnter')
|
|
87
|
-
// 展示生成组件元素
|
|
88
|
-
this.inited = true
|
|
89
|
-
this.display = true
|
|
90
|
-
// 在nvue安卓上,由于渲染速度慢,在弹窗,键盘,日历等组件中,渲染其中的内容需要时间
|
|
91
|
-
// 导致出现弹窗卡顿,这里让其一开始为透明状态,等一定时间渲染完成后,再让其隐藏起来,再让其按正常逻辑出现
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
.then(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
.then(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
this.transitionEnded
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
1
|
+
// 定义一个一定时间后自动成功的promise,让调用nextTick方法处,进入下一个then方法
|
|
2
|
+
const waitTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 50))
|
|
3
|
+
// nvue动画模块实现细节抽离在外部文件
|
|
4
|
+
// #ifdef APP-NVUE
|
|
5
|
+
import animationMap from './nvue-ani-map.js'
|
|
6
|
+
// #endif
|
|
7
|
+
|
|
8
|
+
// #ifndef APP-NVUE
|
|
9
|
+
// 定义类名,通过给元素动态切换类名,赋予元素一定的css动画样式
|
|
10
|
+
const getClassNames = (name) => ({
|
|
11
|
+
enter: `u-${name}-enter u-${name}-enter-active`,
|
|
12
|
+
'enter-to': `u-${name}-enter-to u-${name}-enter-active`,
|
|
13
|
+
leave: `u-${name}-leave u-${name}-leave-active`,
|
|
14
|
+
'leave-to': `u-${name}-leave-to u-${name}-leave-active`
|
|
15
|
+
})
|
|
16
|
+
// #endif
|
|
17
|
+
|
|
18
|
+
// #ifdef APP-NVUE
|
|
19
|
+
// 引入nvue(weex)的animation动画模块,文档见:
|
|
20
|
+
// https://weex.apache.org/zh/docs/modules/animation.html#transition
|
|
21
|
+
const animation = uni.requireNativePlugin('animation')
|
|
22
|
+
const getStyle = (name) => animationMap[name]
|
|
23
|
+
// #endif
|
|
24
|
+
|
|
25
|
+
import { nextTick } from 'vue'
|
|
26
|
+
import { sleep } from '../../libs/function/index';
|
|
27
|
+
export default {
|
|
28
|
+
methods: {
|
|
29
|
+
// 组件被点击发出事件
|
|
30
|
+
clickHandler() {
|
|
31
|
+
this.$emit('click')
|
|
32
|
+
},
|
|
33
|
+
// #ifndef APP-NVUE
|
|
34
|
+
// vue版本的组件进场处理
|
|
35
|
+
async vueEnter() {
|
|
36
|
+
// 动画进入时的类名
|
|
37
|
+
const classNames = getClassNames(this.mode)
|
|
38
|
+
// 定义状态和发出动画进入前事件
|
|
39
|
+
this.status = 'enter'
|
|
40
|
+
this.$emit('beforeEnter')
|
|
41
|
+
this.inited = true
|
|
42
|
+
this.display = true
|
|
43
|
+
this.classes = classNames.enter
|
|
44
|
+
await nextTick();
|
|
45
|
+
{
|
|
46
|
+
// https://github.com/umicro/uView2.0/issues/545
|
|
47
|
+
await sleep(20)
|
|
48
|
+
// 标识动画尚未结束
|
|
49
|
+
this.$emit('enter')
|
|
50
|
+
this.transitionEnded = false
|
|
51
|
+
// 组件动画进入后触发的事件
|
|
52
|
+
this.$emit('afterEnter')
|
|
53
|
+
// 赋予组件enter-to类名
|
|
54
|
+
this.classes = classNames['enter-to']
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
// 动画离场处理
|
|
58
|
+
async vueLeave() {
|
|
59
|
+
// 如果不是展示状态,无需执行逻辑
|
|
60
|
+
if (!this.display) return
|
|
61
|
+
const classNames = getClassNames(this.mode)
|
|
62
|
+
// 标记离开状态和发出事件
|
|
63
|
+
this.status = 'leave'
|
|
64
|
+
this.$emit('beforeLeave')
|
|
65
|
+
// 获得类名
|
|
66
|
+
this.classes = classNames.leave
|
|
67
|
+
|
|
68
|
+
await nextTick();
|
|
69
|
+
{
|
|
70
|
+
// 动画正在离场的状态
|
|
71
|
+
this.transitionEnded = false
|
|
72
|
+
this.$emit('leave')
|
|
73
|
+
// 组件执行动画,到了执行的执行时间后,执行一些额外处理
|
|
74
|
+
setTimeout(this.onTransitionEnd, this.duration)
|
|
75
|
+
this.classes = classNames['leave-to']
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
// #endif
|
|
79
|
+
// #ifdef APP-NVUE
|
|
80
|
+
// nvue版本动画进场
|
|
81
|
+
async nvueEnter() {
|
|
82
|
+
// 获得样式的名称
|
|
83
|
+
const currentStyle = getStyle(this.mode) || getStyle('none')
|
|
84
|
+
// 组件动画状态和发出事件
|
|
85
|
+
this.status = 'enter'
|
|
86
|
+
this.$emit('beforeEnter')
|
|
87
|
+
// 展示生成组件元素
|
|
88
|
+
this.inited = true
|
|
89
|
+
this.display = true
|
|
90
|
+
// 在nvue安卓上,由于渲染速度慢,在弹窗,键盘,日历等组件中,渲染其中的内容需要时间
|
|
91
|
+
// 导致出现弹窗卡顿,这里让其一开始为透明状态,等一定时间渲染完成后,再让其隐藏起来,再让其按正常逻辑出现
|
|
92
|
+
// none 模式为页面内常驻展示,不需要预置透明
|
|
93
|
+
this.viewStyle = this.mode === 'none' ? { opacity: 1 } : {
|
|
94
|
+
opacity: 0
|
|
95
|
+
}
|
|
96
|
+
// 等待弹窗内容渲染完成
|
|
97
|
+
await nextTick();
|
|
98
|
+
{
|
|
99
|
+
// 合并样式
|
|
100
|
+
this.viewStyle = currentStyle.enter
|
|
101
|
+
Promise.resolve()
|
|
102
|
+
.then(waitTick)
|
|
103
|
+
.then(() => {
|
|
104
|
+
// 组件开始进入前的事件
|
|
105
|
+
this.$emit('enter')
|
|
106
|
+
// nvue的transition动画模块需要通过ref调用组件,注意此处的ref不同于vue的this.$refs['u-transition']用法
|
|
107
|
+
animation.transition(this.$refs['u-transition'].ref, {
|
|
108
|
+
styles: currentStyle['enter-to'],
|
|
109
|
+
duration: this.mode === 'none' ? 0 : this.duration,
|
|
110
|
+
timingFunction: this.timingFunction,
|
|
111
|
+
needLayout: false,
|
|
112
|
+
delay: 0
|
|
113
|
+
}, () => {
|
|
114
|
+
// 动画执行完毕,发出事件
|
|
115
|
+
this.$emit('afterEnter')
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
.catch(() => {})
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
nvueLeave() {
|
|
122
|
+
if (!this.display) {
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
const currentStyle = getStyle(this.mode) || getStyle('none')
|
|
126
|
+
// 定义状态和事件
|
|
127
|
+
this.status = 'leave'
|
|
128
|
+
this.$emit('beforeLeave')
|
|
129
|
+
// 合并样式
|
|
130
|
+
this.viewStyle = currentStyle.leave
|
|
131
|
+
// 放到promise中处理执行过程
|
|
132
|
+
Promise.resolve()
|
|
133
|
+
.then(waitTick) // 等待几十ms
|
|
134
|
+
.then(() => {
|
|
135
|
+
this.transitionEnded = false
|
|
136
|
+
// 动画正在离场的状态
|
|
137
|
+
this.$emit('leave')
|
|
138
|
+
animation.transition(this.$refs['u-transition'].ref, {
|
|
139
|
+
styles: currentStyle['leave-to'],
|
|
140
|
+
duration: this.mode === 'none' ? 0 : this.duration,
|
|
141
|
+
timingFunction: this.timingFunction,
|
|
142
|
+
needLayout: false,
|
|
143
|
+
delay: 0
|
|
144
|
+
}, () => {
|
|
145
|
+
this.onTransitionEnd()
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
.catch(() => {})
|
|
149
|
+
},
|
|
150
|
+
// #endif
|
|
151
|
+
// 完成过渡后触发
|
|
152
|
+
onTransitionEnd() {
|
|
153
|
+
// 如果已经是结束的状态,无需再处理
|
|
154
|
+
if (this.transitionEnded) return
|
|
155
|
+
this.transitionEnded = true
|
|
156
|
+
// 发出组件动画执行后的事件
|
|
157
|
+
this.$emit(this.status === 'leave' ? 'afterLeave' : 'afterEnter')
|
|
158
|
+
if (!this.show && this.display) {
|
|
159
|
+
this.display = false
|
|
160
|
+
this.inited = false
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import UploadDefaultProps from './upload'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(UploadDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 接受的文件类型, 可选值为all media image file video
|
|
@@ -141,8 +141,14 @@
|
|
|
141
141
|
</slot>
|
|
142
142
|
</view>
|
|
143
143
|
</template>
|
|
144
|
-
<canvas
|
|
145
|
-
|
|
144
|
+
<up-canvas
|
|
145
|
+
ref="videoThumbCanvas"
|
|
146
|
+
class="u-upload__hidden-canvas"
|
|
147
|
+
:canvas-id="videoThumbCanvasId"
|
|
148
|
+
:width="videoThumbCanvasWidth"
|
|
149
|
+
:height="videoThumbCanvasHeight"
|
|
150
|
+
bg-color="transparent"
|
|
151
|
+
></up-canvas>
|
|
146
152
|
<template v-if="isInCount">
|
|
147
153
|
<view
|
|
148
154
|
v-if="$slots.trigger"
|
|
@@ -257,7 +263,10 @@
|
|
|
257
263
|
lists: [],
|
|
258
264
|
isInCount: true,
|
|
259
265
|
popupShow: false,
|
|
260
|
-
currentItemIndex: -1
|
|
266
|
+
currentItemIndex: -1,
|
|
267
|
+
videoThumbCanvasId: 'u-upload-video-thumb-' + Math.random().toString(36).substr(2, 9),
|
|
268
|
+
videoThumbCanvasWidth: 100,
|
|
269
|
+
videoThumbCanvasHeight: 150
|
|
261
270
|
}
|
|
262
271
|
},
|
|
263
272
|
watch: {
|
|
@@ -314,47 +323,37 @@
|
|
|
314
323
|
return;
|
|
315
324
|
}
|
|
316
325
|
// 截取第一帧作为封面,oss等云存储场景直接使用拼接参数。
|
|
317
|
-
|
|
318
|
-
|
|
326
|
+
const w = this.lists[this.currentItemIndex].width;
|
|
327
|
+
const h = this.lists[this.currentItemIndex].height;
|
|
319
328
|
const dpr = uni.getSystemInfoSync().pixelRatio;
|
|
320
329
|
uni.createSelectorQuery().select('#myVideo').context(res => {
|
|
321
330
|
console.log('select video', res)
|
|
322
331
|
const myVideo = res.context
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
console.error('Failed to export image:', err)
|
|
349
|
-
}
|
|
350
|
-
})
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// Capture the first frame
|
|
354
|
-
setInterval(() => {
|
|
355
|
-
ctx1.drawImage(myVideo, 0, 0, w * dpr, h * dpr);
|
|
356
|
-
}, 1000 / 24)
|
|
357
|
-
}).exec()
|
|
332
|
+
this.videoThumbCanvasWidth = w
|
|
333
|
+
this.videoThumbCanvasHeight = h
|
|
334
|
+
this.$nextTick(async () => {
|
|
335
|
+
const canvas = this.$refs.videoThumbCanvas
|
|
336
|
+
if (!canvas || !myVideo) return
|
|
337
|
+
await canvas.initCanvas(true)
|
|
338
|
+
const ctx1 = canvas.getRawContext()
|
|
339
|
+
if (!ctx1) return
|
|
340
|
+
setTimeout(async () => {
|
|
341
|
+
try {
|
|
342
|
+
ctx1.drawImage(myVideo, 0, 0, w, h)
|
|
343
|
+
const result = await canvas.toTempFilePath({
|
|
344
|
+
width: w,
|
|
345
|
+
height: h,
|
|
346
|
+
destWidth: w * dpr,
|
|
347
|
+
destHeight: h * dpr
|
|
348
|
+
})
|
|
349
|
+
console.log('First frame image path:', result.tempFilePath)
|
|
350
|
+
this.fileList[this.currentItemIndex].thumb = result.tempFilePath
|
|
351
|
+
this.$emit('update:fileList', this.fileList)
|
|
352
|
+
} catch (err) {
|
|
353
|
+
console.error('Failed to export image:', err)
|
|
354
|
+
}
|
|
355
|
+
}, 500)
|
|
356
|
+
})
|
|
358
357
|
}).exec()
|
|
359
358
|
},
|
|
360
359
|
formatFileList() {
|
|
@@ -822,6 +821,14 @@
|
|
|
822
821
|
}
|
|
823
822
|
}
|
|
824
823
|
}
|
|
824
|
+
|
|
825
|
+
&__hidden-canvas {
|
|
826
|
+
position: fixed;
|
|
827
|
+
top: -10000px;
|
|
828
|
+
left: -10000px;
|
|
829
|
+
z-index: -1;
|
|
830
|
+
}
|
|
831
|
+
|
|
825
832
|
&__wrap__play {
|
|
826
833
|
position: absolute;
|
|
827
834
|
top: 0px;
|
|
@@ -868,7 +875,7 @@
|
|
|
868
875
|
bottom: $u-upload-success-bottom;
|
|
869
876
|
right: $u-upload-success-right;
|
|
870
877
|
@include flex;
|
|
871
|
-
// 由于weex(nvue)
|
|
878
|
+
// 由于weex(nvue)不支持css绘制三角形
|
|
872
879
|
// 所以在nvue下使用图片,非nvue下使用css实现
|
|
873
880
|
/* #ifndef APP-NVUE */
|
|
874
881
|
border-style: $u-upload-success-border-style;
|