@10yun/cv-mobile-ui 0.5.30 → 0.5.32
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/package.json +5 -1
- package/ui-cv/components/cv-btn-base/cv-btn-base.vue +1 -1
- package/uview-plus/README.md +1 -1
- package/uview-plus/components/u-action-sheet/u-action-sheet.vue +8 -8
- package/uview-plus/components/u-album/u-album.vue +1 -1
- package/uview-plus/components/u-alert/u-alert.vue +5 -5
- package/uview-plus/components/u-app-update/u-app-update.vue +2 -2
- package/uview-plus/components/u-avatar/u-avatar.vue +2 -2
- package/uview-plus/components/u-avatar-group/u-avatar-group.vue +79 -3
- package/uview-plus/components/u-back-top/u-back-top.vue +4 -4
- package/uview-plus/components/u-badge/u-badge.vue +1 -1
- package/uview-plus/components/u-button/u-button.vue +8 -8
- package/uview-plus/components/u-button-wu/u-button-wu.vue +9 -9
- package/uview-plus/components/u-calendar/u-calendar.vue +5 -6
- package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +2 -2
- package/uview-plus/components/u-card/u-card.vue +139 -3
- package/uview-plus/components/u-cell/u-cell.vue +4 -4
- package/uview-plus/components/u-cell-group/u-cell-group.vue +2 -2
- package/uview-plus/components/u-checkbox/u-checkbox.vue +4 -4
- package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +1 -1
- package/uview-plus/components/u-code/u-code.vue +1 -1
- package/uview-plus/components/u-code-input/u-code-input.vue +1 -1
- package/uview-plus/components/u-col/u-col.vue +1 -1
- package/uview-plus/components/u-collapse/u-collapse.vue +2 -2
- package/uview-plus/components/u-collapse-item/u-collapse-item.vue +218 -3
- package/uview-plus/components/u-column-notice/u-column-notice.vue +3 -3
- package/uview-plus/components/u-copy/u-copy.vue +68 -1
- package/uview-plus/components/u-count-down/u-count-down.vue +1 -1
- package/uview-plus/components/u-count-to/u-count-to.vue +1 -1
- package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +3 -3
- package/uview-plus/components/u-divider/u-divider.vue +3 -3
- package/uview-plus/components/u-dropdown/u-dropdown.vue +3 -3
- package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +1 -1
- package/uview-plus/components/u-empty/u-empty.vue +3 -3
- package/uview-plus/components/u-form/u-form.vue +243 -1
- package/uview-plus/components/u-form-item/u-form-item.vue +4 -4
- package/uview-plus/components/u-gap/u-gap.vue +1 -1
- package/uview-plus/components/u-grid/u-grid.vue +1 -1
- package/uview-plus/components/u-grid-item/u-grid-item.vue +1 -1
- package/uview-plus/components/u-icon/u-icon.vue +1 -1
- package/uview-plus/components/u-icon/u-icon2.vue +1 -1
- package/uview-plus/components/u-image/u-image.vue +5 -5
- package/uview-plus/components/u-image-wu/u-image-wu.vue +5 -5
- package/uview-plus/components/u-index-anchor/u-index-anchor.vue +1 -1
- package/uview-plus/components/u-index-list/u-index-list.vue +2 -2
- package/uview-plus/components/u-input/u-input.vue +4 -4
- package/uview-plus/components/u-keyboard/u-keyboard.vue +6 -6
- package/uview-plus/components/u-lazy-load/u-lazy-load.vue +257 -3
- package/uview-plus/components/u-line/u-line.vue +1 -1
- package/uview-plus/components/u-line-progress/u-line-progress.vue +1 -1
- package/uview-plus/components/u-link/u-link.vue +1 -1
- package/uview-plus/components/u-list/u-list.vue +1 -1
- package/uview-plus/components/u-list-item/u-list-item.vue +1 -1
- package/uview-plus/components/u-loading-icon/u-loading-icon.vue +191 -3
- package/uview-plus/components/u-loading-page/u-loading-page.vue +4 -4
- package/uview-plus/components/u-loadmore/u-loadmore.vue +4 -4
- package/uview-plus/components/u-mask/u-mask.vue +120 -113
- package/uview-plus/components/u-message-input/u-message-input.vue +1 -1
- package/uview-plus/components/u-modal/u-modal.vue +6 -6
- package/uview-plus/components/u-navbar/u-navbar.vue +4 -4
- package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +2 -2
- package/uview-plus/components/u-navbar-wu/u-navbar-wu.vue +4 -4
- package/uview-plus/components/u-no-network/u-no-network.vue +5 -5
- package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -5
- package/uview-plus/components/u-notify/u-notify.vue +6 -6
- package/uview-plus/components/u-number-box/u-number-box.vue +9 -3
- package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +1 -1
- package/uview-plus/components/u-overlay/u-overlay.vue +3 -3
- package/uview-plus/components/u-picker/u-picker.vue +5 -5
- package/uview-plus/components/u-popup/u-popup.vue +8 -8
- package/uview-plus/components/u-popup-wu/u-popup-wu.vue +7 -7
- package/uview-plus/components/u-qrcode/u-qrcode.vue +275 -3
- package/uview-plus/components/u-radio/u-radio.vue +4 -4
- package/uview-plus/components/u-radio-group/u-radio-group.vue +1 -1
- package/uview-plus/components/u-rate/u-rate.vue +5 -5
- package/uview-plus/components/u-read-more/u-read-more.vue +126 -3
- package/uview-plus/components/u-row/u-row.vue +1 -1
- package/uview-plus/components/u-row-notice/u-row-notice.vue +3 -3
- package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +48 -3
- package/uview-plus/components/u-search/u-search.vue +4 -4
- package/uview-plus/components/u-select/u-select.vue +175 -3
- package/uview-plus/components/u-skeleton/u-skeleton.vue +3 -3
- package/uview-plus/components/u-sku-wu/u-sku-wu.vue +4 -4
- package/uview-plus/components/u-status-bar/u-status-bar.vue +1 -1
- package/uview-plus/components/u-steps/u-steps.vue +1 -1
- package/uview-plus/components/u-steps-item/u-steps-item.vue +7 -7
- package/uview-plus/components/u-sticky/u-sticky.vue +1 -1
- package/uview-plus/components/u-subsection/u-subsection.vue +1 -1
- package/uview-plus/components/u-swipe-action/u-swipe-action.vue +1 -1
- package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +3 -3
- package/uview-plus/components/u-swiper/u-swiper.vue +1 -1
- package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +1 -1
- package/uview-plus/components/u-switch/u-switch.vue +2 -2
- package/uview-plus/components/u-tabbar/u-tabbar.vue +2 -2
- package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +9 -4
- package/uview-plus/components/u-table/u-table.vue +1 -1
- package/uview-plus/components/u-tabs/u-tabs.vue +3 -3
- package/uview-plus/components/u-tag/u-tag.vue +5 -5
- package/uview-plus/components/u-text/u-text.vue +159 -3
- package/uview-plus/components/u-toast/u-toast.vue +8 -8
- package/uview-plus/components/u-tooltip/u-tooltip.vue +6 -6
- package/uview-plus/components/u-upload/u-upload.vue +10 -10
- package/uview-plus/components/u-waterfall/u-waterfall.vue +221 -3
- package/uview-plus/index.js +4 -2
- package/uview-plus/libs/ctocode/image.js +17 -0
- package/uview-plus/libs/ctocode/index.js +150 -0
- package/uview-plus/libs/ctocode/map.js +38 -0
- package/uview-plus/libs/function/index-wu.js +6 -34
- package/uview-plus/package.json +3 -3
- package/uview-plus/readme-wu.md +1 -1
- package/uview-plus/libs/function/cc.js +0 -66
|
@@ -73,7 +73,7 @@ const dom = uni.requireNativePlugin('dom');
|
|
|
73
73
|
* @property {String | Number} preLoadScreen 列表前后预渲染的屏数,1代表一个屏幕的高度,1.5代表1个半屏幕高度 (默认 1 )
|
|
74
74
|
* @property {Object} customStyle 定义需要用到的外部样式
|
|
75
75
|
*
|
|
76
|
-
* @example <
|
|
76
|
+
* @example <up-list @scrolltolower="scrolltolower"></up-list>
|
|
77
77
|
*/
|
|
78
78
|
export default {
|
|
79
79
|
name: 'u-list',
|
|
@@ -22,7 +22,7 @@ const dom = uni.requireNativePlugin('dom');
|
|
|
22
22
|
* @description 该组件为高性能列表组件
|
|
23
23
|
* @tutorial https://ijry.github.io/uview-plus/components/list.html
|
|
24
24
|
* @property {String | Number} anchor 用于滚动到指定item
|
|
25
|
-
* @example <
|
|
25
|
+
* @example <up-list-ite v-for="(item, index) in indexList" :key="index" ></up-list-item>
|
|
26
26
|
*/
|
|
27
27
|
export default {
|
|
28
28
|
name: 'u-list-item',
|
|
@@ -1,3 +1,191 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="u-loading-icon" :style="[addStyle(customStyle)]" :class="[vertical && 'u-loading-icon--vertical']" v-if="show">
|
|
3
2
|
<view
|
|
4
3
|
v-if="!webviewHide"
|
|
5
4
|
class="u-loading-icon__spinner"
|
|
6
5
|
:class="[`u-loading-icon__spinner--${mode}`]"
|
|
7
6
|
ref="ani"
|
|
8
7
|
:style="{
|
|
9
8
|
color: color,
|
|
10
9
|
width: addUnit(size),
|
|
11
10
|
height: addUnit(size),
|
|
12
11
|
borderTopColor: color,
|
|
13
12
|
borderBottomColor: otherBorderColor,
|
|
14
13
|
borderLeftColor: otherBorderColor,
|
|
15
14
|
borderRightColor: otherBorderColor,
|
|
16
15
|
'animation-duration': `${duration}ms`,
|
|
17
16
|
'animation-timing-function': mode === 'semicircle' || mode === 'circle' ? timingFunction : ''
|
|
18
17
|
}"
|
|
19
18
|
>
|
|
20
19
|
<block v-if="mode === 'spinner'">
|
|
21
20
|
<!-- #ifndef APP-NVUE -->
|
|
22
21
|
<view v-for="(item, index) in array12" :key="index" class="u-loading-icon__dot"></view>
|
|
23
22
|
<!-- #endif -->
|
|
24
23
|
<!-- #ifdef APP-NVUE -->
|
|
25
24
|
<!-- 此组件内部图标部分无法设置宽高,即使通过width和height配置了也无效 -->
|
|
26
25
|
<loading-indicator
|
|
27
26
|
v-if="!webviewHide"
|
|
28
27
|
class="u-loading-indicator"
|
|
29
28
|
:animating="true"
|
|
30
29
|
:style="{
|
|
31
30
|
color: color,
|
|
32
31
|
width: addUnit(size),
|
|
33
32
|
height: addUnit(size)
|
|
34
33
|
}"
|
|
35
34
|
/>
|
|
36
35
|
<!-- #endif -->
|
|
37
36
|
</block>
|
|
38
37
|
</view>
|
|
39
38
|
<text
|
|
40
39
|
v-if="text"
|
|
41
40
|
class="u-loading-icon__text"
|
|
42
41
|
:style="{
|
|
43
42
|
fontSize: addUnit(textSize),
|
|
44
43
|
color: textColor
|
|
45
44
|
}"
|
|
46
45
|
>
|
|
47
46
|
{{ text }}
|
|
48
47
|
</text>
|
|
49
48
|
</view>
|
|
50
49
|
* loading 加载动画
|
|
51
50
|
* @description 警此组件为一个小动画,目前用在uView的loadmore加载更多和switch开关等组件的正在加载状态场景。
|
|
52
51
|
* @tutorial https://ijry.github.io/uview-plus/components/loading.html
|
|
53
52
|
* @property {Boolean} show 是否显示组件 (默认 true)
|
|
54
53
|
* @property {String} color 动画活动区域的颜色,只对 mode = flower 模式有效(默认color['u-tips-color'])
|
|
55
54
|
* @property {String} textColor 提示文本的颜色(默认color['u-tips-color'])
|
|
56
55
|
* @property {Boolean} vertical 文字和图标是否垂直排列 (默认 false )
|
|
57
56
|
* @property {String} mode 模式选择,见官网说明(默认 'circle' )
|
|
58
57
|
* @property {String | Number} size 加载图标的大小,单位px (默认 24 )
|
|
59
58
|
* @property {String | Number} textSize 文字大小(默认 15 )
|
|
60
59
|
* @property {String | Number} text 文字内容
|
|
61
60
|
* @property {String} timingFunction 动画模式 (默认 'ease-in-out' )
|
|
62
61
|
* @property {String | Number} duration 动画执行周期时间(默认 1200)
|
|
63
62
|
* @property {String} inactiveColor mode=circle时的暗边颜色
|
|
64
63
|
* @property {Object} customStyle 定义需要用到的外部样式
|
|
65
64
|
* @example <u-loading mode="circle"></u-loading>
|
|
66
65
|
*/
|
|
67
66
|
name: 'u-loading-icon',
|
|
68
67
|
mixins: [mpMixin, mixin, props],
|
|
69
68
|
data() {
|
|
70
69
|
return {
|
|
71
70
|
// Array.form可以通过一个伪数组对象创建指定长度的数组
|
|
72
71
|
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/from
|
|
73
72
|
array12: Array.from({
|
|
74
73
|
length: 12
|
|
75
74
|
}),
|
|
76
75
|
// 这里需要设置默认值为360,否则在安卓nvue上,会延迟一个duration周期后才执行
|
|
77
76
|
// 在iOS nvue上,则会一开始默认执行两个周期的动画
|
|
78
77
|
aniAngel: 360, // 动画旋转角度
|
|
79
78
|
webviewHide: false, // 监听webview的状态,如果隐藏了页面,则停止动画,以免性能消耗
|
|
80
79
|
loading: false // 是否运行中,针对nvue使用
|
|
81
80
|
};
|
|
82
81
|
},
|
|
83
82
|
computed: {
|
|
84
83
|
// 当为circle类型时,给其另外三边设置一个更轻一些的颜色
|
|
85
84
|
// 之所以需要这么做的原因是,比如父组件传了color为红色,那么需要另外的三个边为浅红色
|
|
86
85
|
// 而不能是固定的某一个其他颜色(因为这个固定的颜色可能浅蓝,导致效果没有那么细腻良好)
|
|
87
86
|
otherBorderColor() {
|
|
88
87
|
const lightColor = colorGradient(this.color, '#ffffff', 100)[80];
|
|
89
88
|
if (this.mode === 'circle') {
|
|
90
89
|
return this.inactiveColor ? this.inactiveColor : lightColor;
|
|
91
90
|
} else {
|
|
92
91
|
return 'transparent';
|
|
93
92
|
}
|
|
94
93
|
// return this.mode === 'circle' ? this.inactiveColor ? this.inactiveColor : lightColor : 'transparent'
|
|
95
94
|
}
|
|
96
95
|
},
|
|
97
96
|
watch: {
|
|
98
97
|
show(n) {
|
|
99
98
|
// nvue中,show为true,且为非loading状态,就重新执行动画模块
|
|
100
99
|
// #ifdef APP-NVUE
|
|
101
100
|
if (n && !this.loading) {
|
|
102
101
|
setTimeout(() => {
|
|
103
102
|
this.startAnimate();
|
|
104
103
|
}, 30);
|
|
105
104
|
}
|
|
106
105
|
// #endif
|
|
107
106
|
}
|
|
108
107
|
},
|
|
109
108
|
mounted() {
|
|
110
109
|
this.init();
|
|
111
110
|
},
|
|
112
111
|
methods: {
|
|
113
112
|
addUnit,
|
|
114
113
|
addStyle,
|
|
115
114
|
init() {
|
|
116
115
|
setTimeout(() => {
|
|
117
116
|
// #ifdef APP-NVUE
|
|
118
117
|
this.show && this.nvueAnimate();
|
|
119
118
|
// #endif
|
|
120
119
|
// #ifdef APP-PLUS
|
|
121
120
|
this.show && this.addEventListenerToWebview();
|
|
122
121
|
// #endif
|
|
123
122
|
}, 20);
|
|
124
123
|
},
|
|
125
124
|
// 监听webview的显示与隐藏
|
|
126
125
|
addEventListenerToWebview() {
|
|
127
126
|
// webview的堆栈
|
|
128
127
|
const pages = getCurrentPages();
|
|
129
128
|
// 当前页面
|
|
130
129
|
const page = pages[pages.length - 1];
|
|
131
130
|
// 当前页面的webview实例
|
|
132
131
|
const currentWebview = page.$getAppWebview();
|
|
133
132
|
// 监听webview的显示与隐藏,从而停止或者开始动画(为了性能)
|
|
134
133
|
currentWebview.addEventListener('hide', () => {
|
|
135
134
|
this.webviewHide = true;
|
|
136
135
|
});
|
|
137
136
|
currentWebview.addEventListener('show', () => {
|
|
138
137
|
this.webviewHide = false;
|
|
139
138
|
});
|
|
140
139
|
},
|
|
141
140
|
// #ifdef APP-NVUE
|
|
142
141
|
nvueAnimate() {
|
|
143
142
|
// nvue下,非spinner类型时才需要旋转,因为nvue的spinner类型,使用了weex的
|
|
144
143
|
// loading-indicator组件,自带旋转功能
|
|
145
144
|
this.mode !== 'spinner' && this.startAnimate();
|
|
146
145
|
},
|
|
147
146
|
// 执行nvue的animate模块动画
|
|
148
147
|
startAnimate() {
|
|
149
148
|
this.loading = true;
|
|
150
149
|
const ani = this.$refs.ani;
|
|
151
150
|
if (!ani) return;
|
|
152
151
|
animation.transition(
|
|
153
152
|
ani,
|
|
154
153
|
{
|
|
155
154
|
// 进行角度旋转
|
|
156
155
|
styles: {
|
|
157
156
|
transform: `rotate(${this.aniAngel}deg)`,
|
|
158
157
|
transformOrigin: 'center center'
|
|
159
158
|
},
|
|
160
159
|
duration: this.duration,
|
|
161
160
|
timingFunction: this.timingFunction
|
|
162
161
|
// delay: 10
|
|
163
162
|
},
|
|
164
163
|
() => {
|
|
165
164
|
// 每次增加360deg,为了让其重新旋转一周
|
|
166
165
|
this.aniAngel += 360;
|
|
167
166
|
// 动画结束后,继续循环执行动画,需要同时判断webviewHide变量
|
|
168
167
|
// nvue安卓,页面隐藏后依然会继续执行startAnimate方法
|
|
169
168
|
this.show && !this.webviewHide ? this.startAnimate() : (this.loading = false);
|
|
170
169
|
}
|
|
171
170
|
);
|
|
172
171
|
}
|
|
173
172
|
// #endif
|
|
174
173
|
}
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
<template>
|
|
175
|
+
<view class="u-loading-icon" :style="[addStyle(customStyle)]" :class="[vertical && 'u-loading-icon--vertical']" v-if="show">
|
|
176
|
+
<view
|
|
177
|
+
v-if="!webviewHide"
|
|
178
|
+
class="u-loading-icon__spinner"
|
|
179
|
+
:class="[`u-loading-icon__spinner--${mode}`]"
|
|
180
|
+
ref="ani"
|
|
181
|
+
:style="{
|
|
182
|
+
color: color,
|
|
183
|
+
width: addUnit(size),
|
|
184
|
+
height: addUnit(size),
|
|
185
|
+
borderTopColor: color,
|
|
186
|
+
borderBottomColor: otherBorderColor,
|
|
187
|
+
borderLeftColor: otherBorderColor,
|
|
188
|
+
borderRightColor: otherBorderColor,
|
|
189
|
+
'animation-duration': `${duration}ms`,
|
|
190
|
+
'animation-timing-function': mode === 'semicircle' || mode === 'circle' ? timingFunction : ''
|
|
191
|
+
}"
|
|
192
|
+
>
|
|
193
|
+
<block v-if="mode === 'spinner'">
|
|
194
|
+
<!-- #ifndef APP-NVUE -->
|
|
195
|
+
<view v-for="(item, index) in array12" :key="index" class="u-loading-icon__dot"></view>
|
|
196
|
+
<!-- #endif -->
|
|
197
|
+
<!-- #ifdef APP-NVUE -->
|
|
198
|
+
<!-- 此组件内部图标部分无法设置宽高,即使通过width和height配置了也无效 -->
|
|
199
|
+
<loading-indicator
|
|
200
|
+
v-if="!webviewHide"
|
|
201
|
+
class="u-loading-indicator"
|
|
202
|
+
:animating="true"
|
|
203
|
+
:style="{
|
|
204
|
+
color: color,
|
|
205
|
+
width: addUnit(size),
|
|
206
|
+
height: addUnit(size)
|
|
207
|
+
}"
|
|
208
|
+
/>
|
|
209
|
+
<!-- #endif -->
|
|
210
|
+
</block>
|
|
211
|
+
</view>
|
|
212
|
+
<text
|
|
213
|
+
v-if="text"
|
|
214
|
+
class="u-loading-icon__text"
|
|
215
|
+
:style="{
|
|
216
|
+
fontSize: addUnit(textSize),
|
|
217
|
+
color: textColor
|
|
218
|
+
}"
|
|
219
|
+
>
|
|
220
|
+
{{ text }}
|
|
221
|
+
</text>
|
|
222
|
+
</view>
|
|
223
|
+
</template>
|
|
224
|
+
<script>
|
|
225
|
+
import { props } from './props';
|
|
226
|
+
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
227
|
+
import { mixin } from '../../libs/mixin/mixin';
|
|
228
|
+
import { addUnit, addStyle } from '../../libs/function/index';
|
|
229
|
+
import { colorGradient } from '../../libs/function/colorGradient';
|
|
230
|
+
// #ifdef APP-NVUE
|
|
231
|
+
const animation = weex.requireModule('animation');
|
|
232
|
+
// #endif
|
|
233
|
+
/**
|
|
234
|
+
* loading 加载动画
|
|
235
|
+
* @description 警此组件为一个小动画,目前用在uView的loadmore加载更多和switch开关等组件的正在加载状态场景。
|
|
236
|
+
* @tutorial https://ijry.github.io/uview-plus/components/loading.html
|
|
237
|
+
* @property {Boolean} show 是否显示组件 (默认 true)
|
|
238
|
+
* @property {String} color 动画活动区域的颜色,只对 mode = flower 模式有效(默认color['u-tips-color'])
|
|
239
|
+
* @property {String} textColor 提示文本的颜色(默认color['u-tips-color'])
|
|
240
|
+
* @property {Boolean} vertical 文字和图标是否垂直排列 (默认 false )
|
|
241
|
+
* @property {String} mode 模式选择,见官网说明(默认 'circle' )
|
|
242
|
+
* @property {String | Number} size 加载图标的大小,单位px (默认 24 )
|
|
243
|
+
* @property {String | Number} textSize 文字大小(默认 15 )
|
|
244
|
+
* @property {String | Number} text 文字内容
|
|
245
|
+
* @property {String} timingFunction 动画模式 (默认 'ease-in-out' )
|
|
246
|
+
* @property {String | Number} duration 动画执行周期时间(默认 1200)
|
|
247
|
+
* @property {String} inactiveColor mode=circle时的暗边颜色
|
|
248
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
249
|
+
* @example <up-loading mode="circle"></up-loading>
|
|
250
|
+
*/
|
|
251
|
+
export default {
|
|
252
|
+
name: 'u-loading-icon',
|
|
253
|
+
mixins: [mpMixin, mixin, props],
|
|
254
|
+
data() {
|
|
255
|
+
return {
|
|
256
|
+
// Array.form可以通过一个伪数组对象创建指定长度的数组
|
|
257
|
+
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/from
|
|
258
|
+
array12: Array.from({
|
|
259
|
+
length: 12
|
|
260
|
+
}),
|
|
261
|
+
// 这里需要设置默认值为360,否则在安卓nvue上,会延迟一个duration周期后才执行
|
|
262
|
+
// 在iOS nvue上,则会一开始默认执行两个周期的动画
|
|
263
|
+
aniAngel: 360, // 动画旋转角度
|
|
264
|
+
webviewHide: false, // 监听webview的状态,如果隐藏了页面,则停止动画,以免性能消耗
|
|
265
|
+
loading: false // 是否运行中,针对nvue使用
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
computed: {
|
|
269
|
+
// 当为circle类型时,给其另外三边设置一个更轻一些的颜色
|
|
270
|
+
// 之所以需要这么做的原因是,比如父组件传了color为红色,那么需要另外的三个边为浅红色
|
|
271
|
+
// 而不能是固定的某一个其他颜色(因为这个固定的颜色可能浅蓝,导致效果没有那么细腻良好)
|
|
272
|
+
otherBorderColor() {
|
|
273
|
+
const lightColor = colorGradient(this.color, '#ffffff', 100)[80];
|
|
274
|
+
if (this.mode === 'circle') {
|
|
275
|
+
return this.inactiveColor ? this.inactiveColor : lightColor;
|
|
276
|
+
} else {
|
|
277
|
+
return 'transparent';
|
|
278
|
+
}
|
|
279
|
+
// return this.mode === 'circle' ? this.inactiveColor ? this.inactiveColor : lightColor : 'transparent'
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
watch: {
|
|
283
|
+
show(n) {
|
|
284
|
+
// nvue中,show为true,且为非loading状态,就重新执行动画模块
|
|
285
|
+
// #ifdef APP-NVUE
|
|
286
|
+
if (n && !this.loading) {
|
|
287
|
+
setTimeout(() => {
|
|
288
|
+
this.startAnimate();
|
|
289
|
+
}, 30);
|
|
290
|
+
}
|
|
291
|
+
// #endif
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
mounted() {
|
|
295
|
+
this.init();
|
|
296
|
+
},
|
|
297
|
+
methods: {
|
|
298
|
+
addUnit,
|
|
299
|
+
addStyle,
|
|
300
|
+
init() {
|
|
301
|
+
setTimeout(() => {
|
|
302
|
+
// #ifdef APP-NVUE
|
|
303
|
+
this.show && this.nvueAnimate();
|
|
304
|
+
// #endif
|
|
305
|
+
// #ifdef APP-PLUS
|
|
306
|
+
this.show && this.addEventListenerToWebview();
|
|
307
|
+
// #endif
|
|
308
|
+
}, 20);
|
|
309
|
+
},
|
|
310
|
+
// 监听webview的显示与隐藏
|
|
311
|
+
addEventListenerToWebview() {
|
|
312
|
+
// webview的堆栈
|
|
313
|
+
const pages = getCurrentPages();
|
|
314
|
+
// 当前页面
|
|
315
|
+
const page = pages[pages.length - 1];
|
|
316
|
+
// 当前页面的webview实例
|
|
317
|
+
const currentWebview = page.$getAppWebview();
|
|
318
|
+
// 监听webview的显示与隐藏,从而停止或者开始动画(为了性能)
|
|
319
|
+
currentWebview.addEventListener('hide', () => {
|
|
320
|
+
this.webviewHide = true;
|
|
321
|
+
});
|
|
322
|
+
currentWebview.addEventListener('show', () => {
|
|
323
|
+
this.webviewHide = false;
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
// #ifdef APP-NVUE
|
|
327
|
+
nvueAnimate() {
|
|
328
|
+
// nvue下,非spinner类型时才需要旋转,因为nvue的spinner类型,使用了weex的
|
|
329
|
+
// loading-indicator组件,自带旋转功能
|
|
330
|
+
this.mode !== 'spinner' && this.startAnimate();
|
|
331
|
+
},
|
|
332
|
+
// 执行nvue的animate模块动画
|
|
333
|
+
startAnimate() {
|
|
334
|
+
this.loading = true;
|
|
335
|
+
const ani = this.$refs.ani;
|
|
336
|
+
if (!ani) return;
|
|
337
|
+
animation.transition(
|
|
338
|
+
ani,
|
|
339
|
+
{
|
|
340
|
+
// 进行角度旋转
|
|
341
|
+
styles: {
|
|
342
|
+
transform: `rotate(${this.aniAngel}deg)`,
|
|
343
|
+
transformOrigin: 'center center'
|
|
344
|
+
},
|
|
345
|
+
duration: this.duration,
|
|
346
|
+
timingFunction: this.timingFunction
|
|
347
|
+
// delay: 10
|
|
348
|
+
},
|
|
349
|
+
() => {
|
|
350
|
+
// 每次增加360deg,为了让其重新旋转一周
|
|
351
|
+
this.aniAngel += 360;
|
|
352
|
+
// 动画结束后,继续循环执行动画,需要同时判断webviewHide变量
|
|
353
|
+
// nvue安卓,页面隐藏后依然会继续执行startAnimate方法
|
|
354
|
+
this.show && !this.webviewHide ? this.startAnimate() : (this.loading = false);
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
// #endif
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
</script>
|
|
362
|
+
<style scoped>
|
|
363
|
+
@import './style.css';
|
|
364
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<up-transition
|
|
3
3
|
:show="loading"
|
|
4
4
|
:custom-style="{
|
|
5
5
|
position: 'fixed',
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
height: addUnit(iconSize)
|
|
27
27
|
}"
|
|
28
28
|
></image>
|
|
29
|
-
<
|
|
29
|
+
<up-loading-icon v-else :mode="loadingMode" :size="addUnit(iconSize)" :color="loadingColor"></up-loading-icon>
|
|
30
30
|
</view>
|
|
31
31
|
<slot>
|
|
32
32
|
<text
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</slot>
|
|
42
42
|
</view>
|
|
43
43
|
</view>
|
|
44
|
-
</
|
|
44
|
+
</up-transition>
|
|
45
45
|
</template>
|
|
46
46
|
<script>
|
|
47
47
|
import { props } from './props';
|
|
@@ -63,7 +63,7 @@ import { addUnit } from '../../libs/function/index';
|
|
|
63
63
|
* @property {String} loadingColor 加载中图标的颜色,只能rgb或者十六进制颜色值 (默认 '#C8C8C8' )
|
|
64
64
|
* @property {Number} zIndex z-index层级 (默认10 )
|
|
65
65
|
* @property {Object} customStyle 自定义样式
|
|
66
|
-
* @example <
|
|
66
|
+
* @example <up-loading mode="circle"></up-loading>
|
|
67
67
|
*/
|
|
68
68
|
export default {
|
|
69
69
|
name: 'u-loading-page',
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
}
|
|
12
12
|
]"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
14
|
+
<up-line length="140rpx" :color="lineColor" :hairline="false" :dashed="dashed" v-if="line"></up-line>
|
|
15
15
|
<!-- 加载中和没有更多的状态才显示两边的横线 -->
|
|
16
16
|
<view :class="status == 'loadmore' || status == 'nomore' ? 'u-more' : ''" class="u-loadmore__content">
|
|
17
17
|
<view class="u-loadmore__content__icon-wrap" v-if="status === 'loading' && icon">
|
|
18
|
-
<
|
|
18
|
+
<up-loading-icon :color="iconColor" :size="iconSize" :mode="loadingIcon"></up-loading-icon>
|
|
19
19
|
</view>
|
|
20
20
|
<!-- 如果没有更多的状态下,显示内容为dot(粗点),加载特定样式 -->
|
|
21
21
|
<text
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
{{ showText }}
|
|
28
28
|
</text>
|
|
29
29
|
</view>
|
|
30
|
-
<
|
|
30
|
+
<up-line length="140rpx" :color="lineColor" :hairline="false" :dashed="dashed" v-if="line"></up-line>
|
|
31
31
|
</view>
|
|
32
32
|
</template>
|
|
33
33
|
<script>
|
|
@@ -58,7 +58,7 @@ import { addUnit, addStyle } from '../../libs/function/index';
|
|
|
58
58
|
* @property {Boolean} line 是否显示左边分割线 (默认 false )
|
|
59
59
|
* @property {Boolean} dashed // 是否虚线,true-虚线,false-实线 (默认 false )
|
|
60
60
|
* @event {Function} loadmore status为loadmore时,点击组件会发出此事件
|
|
61
|
-
* @example <
|
|
61
|
+
* @example <up-loadmore :status="status" icon-type="iconType" load-text="loadText" />
|
|
62
62
|
*/
|
|
63
63
|
export default {
|
|
64
64
|
name: 'u-loadmore',
|