uview-plus 3.2.7 → 3.2.9
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 +7 -0
- package/components/u--form/u--form.vue +7 -7
- package/components/u--image/u--image.vue +3 -3
- package/components/u--input/u--input.vue +9 -9
- package/components/u--textarea/u--textarea.vue +3 -3
- package/components/u-action-sheet/u-action-sheet.vue +5 -4
- package/components/u-album/u-album.vue +9 -7
- package/components/u-alert/u-alert.vue +9 -6
- package/components/u-avatar/props.js +2 -1
- package/components/u-avatar/u-avatar.vue +15 -11
- package/components/u-avatar-group/u-avatar-group.vue +9 -5
- package/components/u-back-top/u-back-top.vue +9 -8
- package/components/u-badge/u-badge.vue +10 -6
- package/components/u-button/u-button.vue +13 -9
- package/components/u-calendar/header.vue +3 -3
- package/components/u-calendar/month.vue +17 -15
- package/components/u-calendar/u-calendar.vue +10 -8
- package/components/u-car-keyboard/u-car-keyboard.vue +7 -6
- package/components/u-cell/u-cell.vue +9 -6
- package/components/u-cell-group/u-cell-group.vue +8 -4
- package/components/u-checkbox/u-checkbox.vue +13 -11
- package/components/u-checkbox-group/u-checkbox-group.vue +3 -3
- package/components/u-circle-progress/u-circle-progress.vue +5 -4
- package/components/u-code/u-code.vue +3 -3
- package/components/u-code-input/u-code-input.vue +9 -8
- package/components/u-col/u-col.vue +9 -8
- package/components/u-collapse/u-collapse.vue +3 -3
- package/components/u-collapse-item/u-collapse-item.vue +32 -15
- package/components/u-column-notice/u-column-notice.vue +8 -6
- package/components/u-count-down/u-count-down.vue +3 -3
- package/components/u-count-to/u-count-to.vue +6 -4
- package/components/u-datetime-picker/u-datetime-picker.vue +15 -15
- package/components/u-divider/u-divider.vue +7 -5
- package/components/u-dropdown/u-dropdown.vue +12 -10
- package/components/u-dropdown-item/u-dropdown-item.vue +7 -5
- package/components/u-empty/u-empty.vue +12 -8
- package/components/u-form/u-form.vue +12 -10
- package/components/u-form-item/u-form-item.vue +17 -11
- package/components/u-gap/u-gap.vue +3 -3
- package/components/u-grid/u-grid.vue +18 -7
- package/components/u-grid-item/u-grid-item.vue +14 -9
- package/components/u-icon/u-icon.vue +21 -19
- package/components/u-image/u-image.vue +18 -16
- package/components/u-index-anchor/u-index-anchor.vue +11 -9
- package/components/u-index-item/u-index-item.vue +6 -5
- package/components/u-index-list/u-index-list.vue +20 -18
- package/components/u-input/u-input.vue +12 -11
- package/components/u-keyboard/u-keyboard.vue +3 -3
- package/components/u-line/u-line.vue +7 -6
- package/components/u-line-progress/u-line-progress.vue +11 -8
- package/components/u-link/u-link.vue +9 -8
- package/components/u-list/u-list.vue +9 -9
- package/components/u-list-item/u-list-item.vue +5 -4
- package/components/u-loading-icon/u-loading-icon.vue +14 -10
- package/components/u-loading-page/u-loading-page.vue +10 -7
- package/components/u-loadmore/u-loadmore.vue +12 -10
- package/components/u-modal/u-modal.vue +7 -5
- package/components/u-navbar/u-navbar.vue +12 -7
- package/components/u-no-network/u-no-network.vue +6 -6
- package/components/u-notice-bar/u-notice-bar.vue +6 -5
- package/components/u-notify/u-notify.vue +19 -15
- package/components/u-number-box/u-number-box.vue +8 -7
- package/components/u-number-keyboard/u-number-keyboard.vue +7 -7
- package/components/u-overlay/u-overlay.vue +5 -5
- package/components/u-picker/u-picker.vue +19 -15
- package/components/u-picker-column/u-picker-column.vue +3 -3
- package/components/u-popup/u-popup.vue +13 -13
- package/components/u-radio/u-radio.vue +12 -12
- package/components/u-radio-group/u-radio-group.vue +3 -3
- package/components/u-rate/u-rate.vue +16 -14
- package/components/u-read-more/u-read-more.vue +9 -7
- package/components/u-row/u-row.vue +8 -7
- package/components/u-row-notice/u-row-notice.vue +14 -12
- package/components/u-safe-bottom/u-safe-bottom.vue +5 -4
- package/components/u-scroll-list/nvue.js +4 -4
- package/components/u-scroll-list/u-scroll-list.vue +13 -10
- package/components/u-search/u-search.vue +8 -6
- package/components/u-skeleton/u-skeleton.vue +20 -17
- package/components/u-slider/mpwxs.js +3 -2
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +2 -2
- package/components/u-slider/nvue.js +2 -2
- package/components/u-slider/u-slider.vue +8 -5
- package/components/u-status-bar/u-status-bar.vue +6 -5
- package/components/u-steps/u-steps.vue +5 -4
- package/components/u-steps-item/u-steps-item.vue +9 -7
- package/components/u-sticky/u-sticky.vue +12 -10
- package/components/u-subsection/u-subsection.vue +8 -6
- package/components/u-swipe-action/u-swipe-action.vue +3 -3
- package/components/u-swipe-action-item/nvue - backup.js +3 -3
- package/components/u-swipe-action-item/nvue.js +3 -3
- package/components/u-swipe-action-item/u-swipe-action-item.vue +8 -5
- package/components/u-swiper/u-swiper.vue +35 -24
- package/components/u-swiper-indicator/u-swiper-indicator.vue +10 -7
- package/components/u-switch/u-switch.vue +15 -13
- package/components/u-tabbar/u-tabbar.vue +6 -5
- package/components/u-tabbar-item/u-tabbar-item.vue +7 -5
- package/components/u-table/u-table.vue +3 -3
- package/components/u-tabs/u-tabs.vue +18 -14
- package/components/u-tabs-item/u-tabs-item.vue +3 -3
- package/components/u-tag/props.js +2 -2
- package/components/u-tag/u-tag.vue +6 -4
- package/components/u-td/u-td.vue +3 -3
- package/components/u-text/u-text.vue +12 -10
- package/components/u-text/value.js +14 -12
- package/components/u-textarea/u-textarea.vue +11 -8
- package/components/u-toast/u-toast.vue +12 -9
- package/components/u-toolbar/u-toolbar.vue +3 -3
- package/components/u-tooltip/u-tooltip.vue +18 -17
- package/components/u-tr/u-tr.vue +3 -3
- package/components/u-transition/transition.js +2 -2
- package/components/u-transition/u-transition.vue +6 -5
- package/components/u-upload/mixin.js +4 -3
- package/components/u-upload/u-upload.vue +20 -17
- package/index.js +0 -5
- package/libs/function/index.js +27 -20
- package/libs/function/throttle.js +2 -2
- package/libs/mixin/mixin.js +14 -6
- package/libs/mixin/style.js +23 -4
- package/libs/util/route.js +6 -6
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
></uHeader>
|
|
17
17
|
<scroll-view
|
|
18
18
|
:style="{
|
|
19
|
-
height:
|
|
19
|
+
height: addUnit(listHeight)
|
|
20
20
|
}"
|
|
21
21
|
scroll-y
|
|
22
22
|
@scroll="onScroll"
|
|
@@ -68,11 +68,12 @@ import uHeader from './header.vue'
|
|
|
68
68
|
import uMonth from './month.vue'
|
|
69
69
|
import props from './props.js'
|
|
70
70
|
import util from './util.js'
|
|
71
|
-
// import dayjs from '../../libs/util/dayjs.min.js'
|
|
72
71
|
import dayjs from 'dayjs/esm/index'
|
|
73
72
|
import Calendar from '../../libs/util/calendar.js'
|
|
74
73
|
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
75
74
|
import mixin from '../../libs/mixin/mixin.js'
|
|
75
|
+
import { addUnit, range, error, padZero } from '../../libs/function/index';
|
|
76
|
+
import test from '../../libs/function/test';
|
|
76
77
|
/**
|
|
77
78
|
* Calendar 日历
|
|
78
79
|
* @description 此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中.
|
|
@@ -152,12 +153,12 @@ export default {
|
|
|
152
153
|
computed: {
|
|
153
154
|
// 由于maxDate和minDate可以为字符串(2021-10-10),或者数值(时间戳),但是dayjs如果接受字符串形式的时间戳会有问题,这里进行处理
|
|
154
155
|
innerMaxDate() {
|
|
155
|
-
return
|
|
156
|
+
return test.number(this.maxDate)
|
|
156
157
|
? Number(this.maxDate)
|
|
157
158
|
: this.maxDate
|
|
158
159
|
},
|
|
159
160
|
innerMinDate() {
|
|
160
|
-
return
|
|
161
|
+
return test.number(this.minDate)
|
|
161
162
|
? Number(this.minDate)
|
|
162
163
|
: this.minDate
|
|
163
164
|
},
|
|
@@ -194,6 +195,7 @@ export default {
|
|
|
194
195
|
},
|
|
195
196
|
emits: ["confirm", "close"],
|
|
196
197
|
methods: {
|
|
198
|
+
addUnit,
|
|
197
199
|
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
|
|
198
200
|
setFormatter(e) {
|
|
199
201
|
this.innerFormatter = e
|
|
@@ -224,7 +226,7 @@ export default {
|
|
|
224
226
|
this.innerMinDate &&
|
|
225
227
|
new Date(this.innerMaxDate).getTime() < new Date(this.innerMinDate).getTime()
|
|
226
228
|
) {
|
|
227
|
-
return
|
|
229
|
+
return error('maxDate不能小于minDate时间')
|
|
228
230
|
}
|
|
229
231
|
// 滚动区域的高度
|
|
230
232
|
this.listHeight = this.rowHeight * 5 + 30
|
|
@@ -258,7 +260,7 @@ export default {
|
|
|
258
260
|
.add(this.monthNum - 1, 'month')
|
|
259
261
|
.valueOf()
|
|
260
262
|
// 最大最小月份之间的共有多少个月份,
|
|
261
|
-
const months =
|
|
263
|
+
const months = range(
|
|
262
264
|
1,
|
|
263
265
|
this.monthNum,
|
|
264
266
|
this.getMonths(minDate, maxDate)
|
|
@@ -330,7 +332,7 @@ export default {
|
|
|
330
332
|
year,
|
|
331
333
|
month
|
|
332
334
|
}) => {
|
|
333
|
-
month =
|
|
335
|
+
month = padZero(month)
|
|
334
336
|
return `${year}-${month}` === selected
|
|
335
337
|
})
|
|
336
338
|
if (_index !== -1) {
|
|
@@ -371,7 +373,7 @@ export default {
|
|
|
371
373
|
}
|
|
372
374
|
let selected = dayjs().format("YYYY-MM");
|
|
373
375
|
// 单选模式,可以是字符串或数组,Date对象等
|
|
374
|
-
if (!
|
|
376
|
+
if (!test.array(this.defaultDate)) {
|
|
375
377
|
selected = dayjs(this.defaultDate).format("YYYY-MM")
|
|
376
378
|
} else {
|
|
377
379
|
selected = dayjs(this.defaultDate[0]).format("YYYY-MM");
|
|
@@ -68,9 +68,10 @@
|
|
|
68
68
|
</template>
|
|
69
69
|
|
|
70
70
|
<script>
|
|
71
|
-
import props from './props
|
|
72
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
73
|
-
import mixin from '../../libs/mixin/mixin
|
|
71
|
+
import props from './props';
|
|
72
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
73
|
+
import mixin from '../../libs/mixin/mixin';
|
|
74
|
+
import { randomArray, sleep } from '../../libs/function/index';
|
|
74
75
|
/**
|
|
75
76
|
* keyboard 键盘组件
|
|
76
77
|
* @description 此为uView自定义的键盘面板,内含了数字键盘,车牌号键,身份证号键盘3种模式,都有可以打乱按键顺序的选项。
|
|
@@ -131,7 +132,7 @@
|
|
|
131
132
|
];
|
|
132
133
|
let tmp = [];
|
|
133
134
|
// 打乱顺序
|
|
134
|
-
if (this.random) data =
|
|
135
|
+
if (this.random) data = randomArray(data);
|
|
135
136
|
// 切割成二维数组
|
|
136
137
|
tmp[0] = data.slice(0, 10);
|
|
137
138
|
tmp[1] = data.slice(10, 20);
|
|
@@ -179,7 +180,7 @@
|
|
|
179
180
|
'M'
|
|
180
181
|
];
|
|
181
182
|
let tmp = [];
|
|
182
|
-
if (this.random) data =
|
|
183
|
+
if (this.random) data = randomArray(data);
|
|
183
184
|
tmp[0] = data.slice(0, 10);
|
|
184
185
|
tmp[1] = data.slice(10, 20);
|
|
185
186
|
tmp[2] = data.slice(20, 30);
|
|
@@ -196,7 +197,7 @@
|
|
|
196
197
|
if (this.abc) value = this.engKeyBoardList[i][j];
|
|
197
198
|
else value = this.areaList[i][j];
|
|
198
199
|
// 如果允许自动切换,则将中文状态切换为英文
|
|
199
|
-
if (!this.abc && this.autoChange)
|
|
200
|
+
if (!this.abc && this.autoChange) sleep(200).then(() => this.abc = true)
|
|
200
201
|
this.$emit('change', value);
|
|
201
202
|
},
|
|
202
203
|
// 修改汽车牌键盘的输入模式,中文|英文
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-cell" :class="[customClass]" :style="[
|
|
2
|
+
<view class="u-cell" :class="[customClass]" :style="[addStyle(customStyle)]"
|
|
3
3
|
:hover-class="(!disabled && (clickable || isLink)) ? 'u-cell--clickable' : ''" :hover-stay-time="250"
|
|
4
4
|
@tap="clickHandler">
|
|
5
5
|
<view class="u-cell__body" :class="[ center && 'u-cell--center', size === 'large' && 'u-cell__body--large']">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<slot name="value">
|
|
27
27
|
<text class="u-cell__value"
|
|
28
28
|
:class="[disabled && 'u-cell--disabled', size === 'large' && 'u-cell__value--large']"
|
|
29
|
-
v-if="
|
|
29
|
+
v-if="!testEmpty(value)">{{ value }}</text>
|
|
30
30
|
</slot>
|
|
31
31
|
<view class="u-cell__right-icon-wrap" v-if="$slots['right-icon'] || isLink"
|
|
32
32
|
:class="[`u-cell__right-icon-wrap--${arrowDirection}`]">
|
|
@@ -46,10 +46,11 @@
|
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script>
|
|
49
|
-
import props from './props
|
|
50
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
51
|
-
import mixin from '../../libs/mixin/mixin
|
|
52
|
-
import { addStyle } from '../../libs/function/index
|
|
49
|
+
import props from './props';
|
|
50
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
51
|
+
import mixin from '../../libs/mixin/mixin';
|
|
52
|
+
import { addStyle } from '../../libs/function/index';
|
|
53
|
+
import test from '../../libs/function/test';
|
|
53
54
|
/**
|
|
54
55
|
* cell 单元格
|
|
55
56
|
* @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。
|
|
@@ -93,6 +94,8 @@
|
|
|
93
94
|
},
|
|
94
95
|
emits: ['click'],
|
|
95
96
|
methods: {
|
|
97
|
+
addStyle,
|
|
98
|
+
testEmpty: test.empty,
|
|
96
99
|
// 点击cell
|
|
97
100
|
clickHandler(e) {
|
|
98
101
|
if (this.disabled) return
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :style="[
|
|
2
|
+
<view :style="[addStyle(customStyle)]" :class="[customClass]" class="u-cell-group">
|
|
3
3
|
<view v-if="title" class="u-cell-group__title">
|
|
4
4
|
<slot name="title">
|
|
5
5
|
<text class="u-cell-group__title__text">{{ title }}</text>
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
-
import props from './props
|
|
17
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
18
|
-
import mixin from '../../libs/mixin/mixin
|
|
16
|
+
import props from './props';
|
|
17
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
18
|
+
import mixin from '../../libs/mixin/mixin';
|
|
19
|
+
import { addStyle } from '../../libs/function/index';
|
|
19
20
|
/**
|
|
20
21
|
* cellGroup 单元格
|
|
21
22
|
* @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。
|
|
@@ -31,6 +32,9 @@
|
|
|
31
32
|
export default {
|
|
32
33
|
name: 'u-cell-group',
|
|
33
34
|
mixins: [mpMixin, mixin, props],
|
|
35
|
+
methods: {
|
|
36
|
+
addStyle
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
</script>
|
|
36
40
|
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
</template>
|
|
33
33
|
|
|
34
34
|
<script>
|
|
35
|
-
import props from './props
|
|
36
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
37
|
-
import mixin from '../../libs/mixin/mixin
|
|
35
|
+
import props from './props';
|
|
36
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
37
|
+
import mixin from '../../libs/mixin/mixin';
|
|
38
|
+
import { addStyle, addUnit, deepMerge, formValidate, error } from '../../libs/function/index';
|
|
39
|
+
import test from '../../libs/function/test';
|
|
38
40
|
/**
|
|
39
41
|
* checkbox 复选框
|
|
40
42
|
* @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
|
|
@@ -123,7 +125,7 @@
|
|
|
123
125
|
},
|
|
124
126
|
// label大小
|
|
125
127
|
elLabelSize() {
|
|
126
|
-
return
|
|
128
|
+
return addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
|
|
127
129
|
'15'))
|
|
128
130
|
},
|
|
129
131
|
elIconColor() {
|
|
@@ -158,8 +160,8 @@
|
|
|
158
160
|
const style = {}
|
|
159
161
|
style.backgroundColor = this.isChecked && !this.elDisabled ? this.elActiveColor : '#ffffff'
|
|
160
162
|
style.borderColor = this.isChecked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor
|
|
161
|
-
style.width =
|
|
162
|
-
style.height =
|
|
163
|
+
style.width = addUnit(this.elSize)
|
|
164
|
+
style.height = addUnit(this.elSize)
|
|
163
165
|
// 如果是图标在右边的话,移除它的右边距
|
|
164
166
|
if (!this.usedAlone) {
|
|
165
167
|
if (this.parentData.iconPlacement === 'right') {
|
|
@@ -172,14 +174,14 @@
|
|
|
172
174
|
const style = {}
|
|
173
175
|
if (!this.usedAlone) {
|
|
174
176
|
if (this.parentData.borderBottom && this.parentData.placement === 'row') {
|
|
175
|
-
|
|
177
|
+
error('检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效')
|
|
176
178
|
}
|
|
177
179
|
// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
|
|
178
180
|
if (this.parentData.borderBottom && this.parentData.placement === 'column') {
|
|
179
181
|
style.paddingBottom = '8px'
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
return
|
|
184
|
+
return deepMerge(style, addStyle(this.customStyle))
|
|
183
185
|
}
|
|
184
186
|
},
|
|
185
187
|
mounted() {
|
|
@@ -192,7 +194,7 @@
|
|
|
192
194
|
// 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
|
|
193
195
|
this.updateParentData()
|
|
194
196
|
if (!this.parent) {
|
|
195
|
-
|
|
197
|
+
error('u-checkbox必须搭配u-checkbox-group组件使用')
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
// #ifdef VUE2
|
|
@@ -204,7 +206,7 @@
|
|
|
204
206
|
// 设置初始化时,是否默认选中的状态,父组件u-checkbox-group的value可能是array,所以额外判断
|
|
205
207
|
if (this.checked) {
|
|
206
208
|
this.isChecked = true
|
|
207
|
-
} else if (!this.usedAlone &&
|
|
209
|
+
} else if (!this.usedAlone && test.array(value)) {
|
|
208
210
|
// 查找数组是是否存在this.name元素值
|
|
209
211
|
this.isChecked = value.some(item => {
|
|
210
212
|
return item === this.name
|
|
@@ -242,7 +244,7 @@
|
|
|
242
244
|
this.$emit('change', this.isChecked)
|
|
243
245
|
// 尝试调用u-form的验证方法,进行一定延迟,否则微信小程序更新可能会不及时
|
|
244
246
|
this.$nextTick(() => {
|
|
245
|
-
|
|
247
|
+
formValidate(this, 'change')
|
|
246
248
|
})
|
|
247
249
|
},
|
|
248
250
|
// 改变组件选中状态
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
-
import props from './props
|
|
12
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
13
|
-
import mixin from '../../libs/mixin/mixin
|
|
11
|
+
import props from './props';
|
|
12
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
13
|
+
import mixin from '../../libs/mixin/mixin';
|
|
14
14
|
/**
|
|
15
15
|
* checkboxGroup 复选框组
|
|
16
16
|
* @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
|
|
@@ -27,9 +27,10 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script>
|
|
30
|
-
import props from './props
|
|
31
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
32
|
-
import mixin from '../../libs/mixin/mixin
|
|
30
|
+
import props from './props';
|
|
31
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
32
|
+
import mixin from '../../libs/mixin/mixin';
|
|
33
|
+
import {sleep } from '../../libs/function/index';
|
|
33
34
|
// #ifdef APP-NVUE
|
|
34
35
|
const animation = uni.requireNativePlugin('animation')
|
|
35
36
|
// #endif
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
mounted() {
|
|
67
|
-
|
|
68
|
+
sleep().then(() => {
|
|
68
69
|
this.rightBorderColor = 'rgb(66, 185, 131)'
|
|
69
70
|
// this.init()
|
|
70
71
|
})
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import props from './props
|
|
9
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
10
|
-
import mixin from '../../libs/mixin/mixin
|
|
8
|
+
import props from './props';
|
|
9
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
10
|
+
import mixin from '../../libs/mixin/mixin';
|
|
11
11
|
/**
|
|
12
12
|
* Code 验证码输入框
|
|
13
13
|
* @description 考虑到用户实际发送验证码的场景,可能是一个按钮,也可能是一段文字,提示语各有不同,所以本组件 不提供界面显示,只提供提示语,由用户将提示语嵌入到具体的场景
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<text
|
|
14
14
|
v-else
|
|
15
15
|
:style="{
|
|
16
|
-
fontSize:
|
|
16
|
+
fontSize: addUnit(fontSize),
|
|
17
17
|
fontWeight: bold ? 'bold' : 'normal',
|
|
18
18
|
color: color
|
|
19
19
|
}"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
class="u-code-input__input"
|
|
38
38
|
@input="inputHandler"
|
|
39
39
|
:style="{
|
|
40
|
-
height:
|
|
40
|
+
height: addUnit(size)
|
|
41
41
|
}"
|
|
42
42
|
@focus="isFocus = true"
|
|
43
43
|
@blur="isFocus = false"
|
|
@@ -46,9 +46,10 @@
|
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script>
|
|
49
|
-
import props from './props
|
|
50
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
51
|
-
import mixin from '../../libs/mixin/mixin
|
|
49
|
+
import props from './props';
|
|
50
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
51
|
+
import mixin from '../../libs/mixin/mixin';
|
|
52
|
+
import { addUnit, getPx } from '../../libs/function/index';
|
|
52
53
|
/**
|
|
53
54
|
* CodeInput 验证码输入
|
|
54
55
|
* @description 该组件一般用于验证用户短信验证码的场景,也可以结合uview-plus的键盘组件使用
|
|
@@ -103,7 +104,6 @@
|
|
|
103
104
|
// 循环item的样式
|
|
104
105
|
itemStyle() {
|
|
105
106
|
return index => {
|
|
106
|
-
const addUnit = uni.$u.addUnit
|
|
107
107
|
const style = {
|
|
108
108
|
width: addUnit(this.size),
|
|
109
109
|
height: addUnit(this.size)
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
// 设置盒子的边框,如果是细边框,则设置为0.5px宽度
|
|
114
114
|
style.border = `${this.hairline ? 0.5 : 1}px solid ${this.borderColor}`
|
|
115
115
|
// 如果盒子间距为0的话
|
|
116
|
-
if (
|
|
116
|
+
if (getPx(this.space) === 0) {
|
|
117
117
|
// 给第一和最后一个盒子设置圆角
|
|
118
118
|
if (index === 0) {
|
|
119
119
|
style.borderTopLeftRadius = '3px'
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
lineStyle() {
|
|
149
149
|
const style = {}
|
|
150
150
|
style.height = this.hairline ? '2px' : '4px'
|
|
151
|
-
style.width =
|
|
151
|
+
style.width = addUnit(this.size)
|
|
152
152
|
// 线条模式下,背景色即为边框颜色
|
|
153
153
|
style.backgroundColor = this.borderColor
|
|
154
154
|
return style
|
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
emits: ["change", 'finish', "update:modelValue"],
|
|
158
158
|
methods: {
|
|
159
|
+
addUnit,
|
|
159
160
|
// 监听输入框的值发生变化
|
|
160
161
|
inputHandler(e) {
|
|
161
162
|
const value = e.detail.value
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
-
import props from './props
|
|
17
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
18
|
-
import mixin from '../../libs/mixin/mixin
|
|
16
|
+
import props from './props';
|
|
17
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
18
|
+
import mixin from '../../libs/mixin/mixin';
|
|
19
|
+
import { addStyle, addUnit, deepMerge, getPx } from '../../libs/function/index';
|
|
19
20
|
/**
|
|
20
21
|
* CodeInput 栅格系统的列
|
|
21
22
|
* @description 该组件一般用于Layout 布局 通过基础的 12 分栏,迅速简便地创建布局
|
|
@@ -59,8 +60,8 @@
|
|
|
59
60
|
colStyle() {
|
|
60
61
|
const style = {
|
|
61
62
|
// 这里写成"padding: 0 10px"的形式是因为nvue的需要
|
|
62
|
-
paddingLeft:
|
|
63
|
-
paddingRight:
|
|
63
|
+
paddingLeft: addUnit(getPx(this.parentData.gutter)/2),
|
|
64
|
+
paddingRight: addUnit(getPx(this.parentData.gutter)/2),
|
|
64
65
|
alignItems: this.uAlignItem,
|
|
65
66
|
justifyContent: this.uJustify,
|
|
66
67
|
textAlign: this.textAlign,
|
|
@@ -71,11 +72,11 @@
|
|
|
71
72
|
// #endif
|
|
72
73
|
// #ifdef APP-NVUE
|
|
73
74
|
// 在nvue上,由于无法使用百分比单位,这里需要获取父组件的宽度,再计算得出该有对应的百分比尺寸
|
|
74
|
-
width:
|
|
75
|
-
marginLeft:
|
|
75
|
+
width: addUnit(Math.floor(this.width / this.gridNum * Number(this.span))),
|
|
76
|
+
marginLeft: addUnit(Math.floor(this.width / this.gridNum * Number(this.offset))),
|
|
76
77
|
// #endif
|
|
77
78
|
}
|
|
78
|
-
return
|
|
79
|
+
return deepMerge(style, addStyle(this.customStyle))
|
|
79
80
|
}
|
|
80
81
|
},
|
|
81
82
|
mounted() {
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script>
|
|
9
|
-
import props from './props
|
|
10
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
11
|
-
import mixin from '../../libs/mixin/mixin
|
|
9
|
+
import props from './props';
|
|
10
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
11
|
+
import mixin from '../../libs/mixin/mixin';
|
|
12
12
|
/**
|
|
13
13
|
* collapse 折叠面板
|
|
14
14
|
* @description 通过折叠面板收纳内容区域
|
|
@@ -13,14 +13,28 @@
|
|
|
13
13
|
:disabled="disabled"
|
|
14
14
|
>
|
|
15
15
|
<!-- 微信小程序不支持,因为微信中不支持 <slot name="title" slot="title" />的写法 -->
|
|
16
|
-
<template #title>
|
|
17
|
-
<slot name="
|
|
16
|
+
<template #title>
|
|
17
|
+
<slot name="title">
|
|
18
|
+
<text v-if="!$slots.title && title">
|
|
19
|
+
{{title}}
|
|
20
|
+
</text>
|
|
21
|
+
</slot>
|
|
22
|
+
</template>
|
|
23
|
+
<template #icon>
|
|
24
|
+
<slot name="icon">
|
|
25
|
+
<u-icon v-if="!$slots.icon && icon" :size="22" :name="icon"></u-icon>
|
|
26
|
+
</slot>
|
|
18
27
|
</template>
|
|
19
28
|
<template #value>
|
|
20
|
-
<slot name="value">
|
|
29
|
+
<slot name="value">
|
|
30
|
+
<text v-if="!$slots.value && value">
|
|
31
|
+
{{value}}
|
|
32
|
+
</text>
|
|
33
|
+
</slot>
|
|
21
34
|
</template>
|
|
22
35
|
<template #right-icon>
|
|
23
|
-
<slot name="right-icon">
|
|
36
|
+
<slot name="right-icon">
|
|
37
|
+
</slot>
|
|
24
38
|
</template>
|
|
25
39
|
</u-cell>
|
|
26
40
|
<view
|
|
@@ -40,9 +54,11 @@
|
|
|
40
54
|
|
|
41
55
|
<script>
|
|
42
56
|
import props from './props.js';
|
|
43
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
44
|
-
import mixin from '../../libs/mixin/mixin
|
|
45
|
-
import { nextTick } from 'vue'
|
|
57
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
58
|
+
import mixin from '../../libs/mixin/mixin';
|
|
59
|
+
import { nextTick } from 'vue';
|
|
60
|
+
import { guid, sleep, error } from '../../libs/function/index';
|
|
61
|
+
import test from '../../libs/function/test';
|
|
46
62
|
// #ifdef APP-NVUE
|
|
47
63
|
const animation = uni.requireNativePlugin('animation')
|
|
48
64
|
const dom = uni.requireNativePlugin('dom')
|
|
@@ -69,7 +85,7 @@
|
|
|
69
85
|
mixins: [mpMixin, mixin, props],
|
|
70
86
|
data() {
|
|
71
87
|
return {
|
|
72
|
-
elId:
|
|
88
|
+
elId: guid(),
|
|
73
89
|
// uni.createAnimation的导出数据
|
|
74
90
|
animationData: {},
|
|
75
91
|
// 是否展开状态
|
|
@@ -96,7 +112,8 @@
|
|
|
96
112
|
}
|
|
97
113
|
},
|
|
98
114
|
mounted() {
|
|
99
|
-
this.init()
|
|
115
|
+
this.init()
|
|
116
|
+
console.log('$slots', this.$slots)
|
|
100
117
|
},
|
|
101
118
|
methods: {
|
|
102
119
|
// 异步获取内容,或者动态修改了内容时,需要重新初始化
|
|
@@ -104,7 +121,7 @@
|
|
|
104
121
|
// 初始化数据
|
|
105
122
|
this.updateParentData()
|
|
106
123
|
if (!this.parent) {
|
|
107
|
-
return
|
|
124
|
+
return error('u-collapse-item必须要搭配u-collapse组件使用')
|
|
108
125
|
}
|
|
109
126
|
const {
|
|
110
127
|
value,
|
|
@@ -113,13 +130,13 @@
|
|
|
113
130
|
} = this.parent
|
|
114
131
|
|
|
115
132
|
if (accordion) {
|
|
116
|
-
if (
|
|
117
|
-
return
|
|
133
|
+
if (test.array(value)) {
|
|
134
|
+
return error('手风琴模式下,u-collapse组件的value参数不能为数组')
|
|
118
135
|
}
|
|
119
136
|
this.expanded = this.name == value
|
|
120
137
|
} else {
|
|
121
|
-
if (!
|
|
122
|
-
return
|
|
138
|
+
if (!test.array(value) && value !== null) {
|
|
139
|
+
return error('非手风琴模式下,u-collapse组件的value参数必须为数组')
|
|
123
140
|
}
|
|
124
141
|
this.expanded = (value || []).some(item => item == this.name)
|
|
125
142
|
}
|
|
@@ -165,7 +182,7 @@
|
|
|
165
182
|
// 导出动画数据给面板的animationData值
|
|
166
183
|
this.animationData = animation.export()
|
|
167
184
|
// 标识动画结束
|
|
168
|
-
|
|
185
|
+
sleep(this.duration).then(() => {
|
|
169
186
|
this.animating = false
|
|
170
187
|
})
|
|
171
188
|
// #endif
|
|
@@ -57,9 +57,11 @@
|
|
|
57
57
|
</template>
|
|
58
58
|
|
|
59
59
|
<script>
|
|
60
|
-
import props from './props
|
|
61
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
62
|
-
import mixin from '../../libs/mixin/mixin
|
|
60
|
+
import props from './props';
|
|
61
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
62
|
+
import mixin from '../../libs/mixin/mixin';
|
|
63
|
+
import { addUnit, error } from '../../libs/function/index';
|
|
64
|
+
import test from '../../libs/function/test';
|
|
63
65
|
/**
|
|
64
66
|
* ColumnNotice 滚动通知中的垂直滚动 内部组件
|
|
65
67
|
* @description 该组件用于滚动通告场景,是其中的垂直滚动方式
|
|
@@ -82,8 +84,8 @@
|
|
|
82
84
|
text: {
|
|
83
85
|
immediate: true,
|
|
84
86
|
handler(newValue, oldValue) {
|
|
85
|
-
if(!
|
|
86
|
-
|
|
87
|
+
if(!test.array(newValue)) {
|
|
88
|
+
error('noticebar组件direction为column时,要求text参数为数组形式')
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
}
|
|
@@ -93,7 +95,7 @@
|
|
|
93
95
|
textStyle() {
|
|
94
96
|
let style = {}
|
|
95
97
|
style.color = this.color
|
|
96
|
-
style.fontSize =
|
|
98
|
+
style.fontSize = addUnit(this.fontSize)
|
|
97
99
|
return style
|
|
98
100
|
},
|
|
99
101
|
// 垂直或者水平滚动
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
|
-
import props from './props
|
|
11
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
12
|
-
import mixin from '../../libs/mixin/mixin
|
|
10
|
+
import props from './props';
|
|
11
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
12
|
+
import mixin from '../../libs/mixin/mixin';
|
|
13
13
|
import {
|
|
14
14
|
isSameSecond,
|
|
15
15
|
parseFormat,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<text
|
|
3
3
|
class="u-count-num"
|
|
4
4
|
:style="{
|
|
5
|
-
fontSize:
|
|
5
|
+
fontSize: addUnit(fontSize),
|
|
6
6
|
fontWeight: bold ? 'bold' : 'normal',
|
|
7
7
|
color: color
|
|
8
8
|
}"
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import props from './props';
|
|
14
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
15
|
+
import mixin from '../../libs/mixin/mixin';
|
|
16
|
+
import { addUnit } from '../../libs/function/index';
|
|
16
17
|
/**
|
|
17
18
|
* countTo 数字滚动
|
|
18
19
|
* @description 该组件一般用于需要滚动数字到某一个值的场景,目标要求是一个递增的值。
|
|
@@ -66,6 +67,7 @@ export default {
|
|
|
66
67
|
},
|
|
67
68
|
emits: ["end"],
|
|
68
69
|
methods: {
|
|
70
|
+
addUnit,
|
|
69
71
|
easingFn(t, b, c, d) {
|
|
70
72
|
return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
|
|
71
73
|
},
|