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
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
:lazy-load="lazyLoad"
|
|
20
20
|
class="u-image__image"
|
|
21
21
|
:style="{
|
|
22
|
-
borderRadius: shape == 'circle' ? '10000px' :
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
22
|
+
borderRadius: shape == 'circle' ? '10000px' : addUnit(radius),
|
|
23
|
+
width: addUnit(width),
|
|
24
|
+
height: addUnit(height)
|
|
25
25
|
}"
|
|
26
26
|
></image>
|
|
27
27
|
<view
|
|
28
28
|
v-if="showLoading && loading"
|
|
29
29
|
class="u-image__loading"
|
|
30
30
|
:style="{
|
|
31
|
-
borderRadius: shape == 'circle' ? '50%' :
|
|
31
|
+
borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
|
|
32
32
|
backgroundColor: this.bgColor,
|
|
33
|
-
width:
|
|
34
|
-
height:
|
|
33
|
+
width: addUnit(width),
|
|
34
|
+
height: addUnit(height)
|
|
35
35
|
}"
|
|
36
36
|
>
|
|
37
37
|
<slot name="loading">
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
v-if="showError && isError && !loading"
|
|
47
47
|
class="u-image__error"
|
|
48
48
|
:style="{
|
|
49
|
-
borderRadius: shape == 'circle' ? '50%' :
|
|
50
|
-
width:
|
|
51
|
-
height:
|
|
49
|
+
borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
|
|
50
|
+
width: addUnit(width),
|
|
51
|
+
height: addUnit(height)
|
|
52
52
|
}"
|
|
53
53
|
>
|
|
54
54
|
<slot name="error">
|
|
@@ -64,9 +64,10 @@
|
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<script>
|
|
67
|
-
import props from './props
|
|
68
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
69
|
-
import mixin from '../../libs/mixin/mixin
|
|
67
|
+
import props from './props';
|
|
68
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
69
|
+
import mixin from '../../libs/mixin/mixin';
|
|
70
|
+
import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
|
|
70
71
|
/**
|
|
71
72
|
* Image 图片
|
|
72
73
|
* @description 此组件为uni-app的image组件的加强版,在继承了原有功能外,还支持淡入动画、加载中、加载失败提示、圆角值和形状等。
|
|
@@ -131,10 +132,10 @@
|
|
|
131
132
|
wrapStyle() {
|
|
132
133
|
let style = {};
|
|
133
134
|
// 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
|
|
134
|
-
style.width =
|
|
135
|
-
style.height =
|
|
135
|
+
style.width = addUnit(this.width);
|
|
136
|
+
style.height = addUnit(this.height);
|
|
136
137
|
// 如果是显示圆形,设置一个很多的半径值即可
|
|
137
|
-
style.borderRadius = this.shape == 'circle' ? '10000px' :
|
|
138
|
+
style.borderRadius = this.shape == 'circle' ? '10000px' : addUnit(this.radius)
|
|
138
139
|
// 如果设置圆角,必须要有hidden,否则可能圆角无效
|
|
139
140
|
style.overflow = this.radius > 0 ? 'hidden' : 'visible'
|
|
140
141
|
// if (this.fade) {
|
|
@@ -144,7 +145,7 @@
|
|
|
144
145
|
// style.transitionTimingFunction = 'ease-in-out'
|
|
145
146
|
// style.transitionProperty = 'opacity'
|
|
146
147
|
// }
|
|
147
|
-
return
|
|
148
|
+
return deepMerge(style, addStyle(this.customStyle));
|
|
148
149
|
|
|
149
150
|
}
|
|
150
151
|
},
|
|
@@ -153,6 +154,7 @@
|
|
|
153
154
|
},
|
|
154
155
|
emits: ['click', 'error', 'load'],
|
|
155
156
|
methods: {
|
|
157
|
+
addUnit,
|
|
156
158
|
// 点击图片
|
|
157
159
|
onClick() {
|
|
158
160
|
this.$emit('click')
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
class="u-index-anchor u-border-bottom"
|
|
7
7
|
:ref="`u-index-anchor-${text}`"
|
|
8
8
|
:style="{
|
|
9
|
-
height:
|
|
9
|
+
height: addUnit(height),
|
|
10
10
|
backgroundColor: bgColor
|
|
11
11
|
}"
|
|
12
12
|
>
|
|
13
13
|
<text
|
|
14
14
|
class="u-index-anchor__text"
|
|
15
15
|
:style="{
|
|
16
|
-
fontSize:
|
|
16
|
+
fontSize: addUnit(size),
|
|
17
17
|
color: color
|
|
18
18
|
}"
|
|
19
19
|
>{{ text }}</text>
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import props from './props
|
|
28
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
29
|
-
import mixin from '../../libs/mixin/mixin
|
|
27
|
+
import props from './props';
|
|
28
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
29
|
+
import mixin from '../../libs/mixin/mixin';
|
|
30
|
+
import { addUnit, $parent, error } from '../../libs/function/index';
|
|
30
31
|
// #ifdef APP-NVUE
|
|
31
32
|
const dom = uni.requireNativePlugin('dom')
|
|
32
33
|
// #endif
|
|
@@ -52,19 +53,20 @@
|
|
|
52
53
|
this.init()
|
|
53
54
|
},
|
|
54
55
|
methods: {
|
|
56
|
+
addUnit,
|
|
55
57
|
init() {
|
|
56
58
|
// 此处会活动父组件实例,并赋值给实例的parent属性
|
|
57
|
-
const indexList =
|
|
59
|
+
const indexList = $parent.call(this, 'u-index-list')
|
|
58
60
|
if (!indexList) {
|
|
59
|
-
return
|
|
61
|
+
return error('u-index-anchor必须要搭配u-index-list组件使用')
|
|
60
62
|
}
|
|
61
63
|
// 将当前实例放入到u-index-list中
|
|
62
64
|
indexList.anchors.push(this)
|
|
63
|
-
const indexListItem =
|
|
65
|
+
const indexListItem = $parent.call(this, 'u-index-item')
|
|
64
66
|
// #ifndef APP-NVUE
|
|
65
67
|
// 只有在非nvue下,u-index-anchor才是嵌套在u-index-item中的
|
|
66
68
|
if (!indexListItem) {
|
|
67
|
-
return
|
|
69
|
+
return error('u-index-anchor必须要搭配u-index-item组件使用')
|
|
68
70
|
}
|
|
69
71
|
// 设置u-index-item的id为anchor的text标识符,因为非nvue下滚动列表需要依赖scroll-view滚动到元素的特性
|
|
70
72
|
indexListItem.id = this.text.charCodeAt(0)
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script>
|
|
18
|
-
import props from './props
|
|
19
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
20
|
-
import mixin from '../../libs/mixin/mixin
|
|
18
|
+
import props from './props';
|
|
19
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
20
|
+
import mixin from '../../libs/mixin/mixin';
|
|
21
|
+
import { sleep, error } from '../../libs/function/index';
|
|
21
22
|
// #ifdef APP-NVUE
|
|
22
23
|
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
23
24
|
const dom = uni.requireNativePlugin('dom')
|
|
@@ -53,9 +54,9 @@
|
|
|
53
54
|
// 此处会活动父组件实例,并赋值给实例的parent属性
|
|
54
55
|
this.getParentData('u-index-list')
|
|
55
56
|
if (!this.parent) {
|
|
56
|
-
return
|
|
57
|
+
return error('u-index-item必须要搭配u-index-list组件使用')
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
sleep().then(() =>{
|
|
59
60
|
this.getIndexItemRect().then(size => {
|
|
60
61
|
// 由于对象的引用特性,此处会同时生效到父组件的children数组的本实例的top属性中,供父组件判断读取
|
|
61
62
|
this.top = Math.ceil(size.top)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
enable-back-to-top
|
|
7
7
|
:offset-accuracy="1"
|
|
8
8
|
:style="{
|
|
9
|
-
maxHeight:
|
|
9
|
+
maxHeight: addUnit(scrollViewHeight)
|
|
10
10
|
}"
|
|
11
11
|
@scroll="scrollHandler"
|
|
12
12
|
ref="uList"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
:scrollIntoView="scrollIntoView"
|
|
30
30
|
:offset-accuracy="1"
|
|
31
31
|
:style="{
|
|
32
|
-
maxHeight:
|
|
32
|
+
maxHeight: addUnit(scrollViewHeight)
|
|
33
33
|
}"
|
|
34
34
|
scroll-y
|
|
35
35
|
@scroll="scrollHandler"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<view
|
|
48
48
|
class="u-index-list__letter"
|
|
49
49
|
ref="u-index-list__letter"
|
|
50
|
-
:style="{ top:
|
|
50
|
+
:style="{ top: addUnit(letterInfo.top || 100) }"
|
|
51
51
|
@touchstart.prevent="touchStart"
|
|
52
52
|
@touchmove.prevent="touchMove"
|
|
53
53
|
@touchend.prevent="touchEnd"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
:customStyle="{
|
|
74
74
|
position: 'fixed',
|
|
75
75
|
right: '50px',
|
|
76
|
-
top:
|
|
76
|
+
top: addUnit(indicatorTop),
|
|
77
77
|
zIndex: 2
|
|
78
78
|
}"
|
|
79
79
|
>
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
class="u-index-list__indicator"
|
|
82
82
|
:class="['u-index-list__indicator--show']"
|
|
83
83
|
:style="{
|
|
84
|
-
height:
|
|
85
|
-
width:
|
|
84
|
+
height: addUnit(indicatorHeight),
|
|
85
|
+
width: addUnit(indicatorHeight)
|
|
86
86
|
}"
|
|
87
87
|
>
|
|
88
88
|
<text class="u-index-list__indicator__text">{{ uIndexList[activeIndex] }}</text>
|
|
@@ -100,9 +100,10 @@
|
|
|
100
100
|
}
|
|
101
101
|
return indexList;
|
|
102
102
|
}
|
|
103
|
-
import props from './props
|
|
104
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
105
|
-
import mixin from '../../libs/mixin/mixin
|
|
103
|
+
import props from './props';
|
|
104
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
105
|
+
import mixin from '../../libs/mixin/mixin';
|
|
106
|
+
import { addUnit, sys, sleep, getPx } from '../../libs/function/index';
|
|
106
107
|
// #ifdef APP-NVUE
|
|
107
108
|
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
108
109
|
const dom = uni.requireNativePlugin('dom')
|
|
@@ -148,7 +149,7 @@
|
|
|
148
149
|
// scroll-view的高度
|
|
149
150
|
scrollViewHeight: 0,
|
|
150
151
|
// 系统信息
|
|
151
|
-
sys:
|
|
152
|
+
sys: sys(),
|
|
152
153
|
scrolling: false,
|
|
153
154
|
scrollIntoView: '',
|
|
154
155
|
}
|
|
@@ -172,7 +173,7 @@
|
|
|
172
173
|
uIndexList: {
|
|
173
174
|
immediate: true,
|
|
174
175
|
handler() {
|
|
175
|
-
|
|
176
|
+
sleep().then(() => {
|
|
176
177
|
this.setIndexListLetterInfo()
|
|
177
178
|
})
|
|
178
179
|
}
|
|
@@ -187,11 +188,12 @@
|
|
|
187
188
|
this.setIndexListLetterInfo()
|
|
188
189
|
},
|
|
189
190
|
methods: {
|
|
191
|
+
addUnit,
|
|
190
192
|
init() {
|
|
191
193
|
// 设置列表的高度为整个屏幕的高度
|
|
192
194
|
//减去this.customNavHeight,并将this.scrollViewHeight设置为maxHeight
|
|
193
195
|
//解决当u-index-list组件放在tabbar页面时,scroll-view内容较少时,还能滚动
|
|
194
|
-
let customNavHeight =
|
|
196
|
+
let customNavHeight = getPx(this.customNavHeight)
|
|
195
197
|
this.scrollViewHeight = this.sys.windowHeight - customNavHeight
|
|
196
198
|
},
|
|
197
199
|
// 索引列表被触摸
|
|
@@ -226,7 +228,7 @@
|
|
|
226
228
|
// 触摸结束
|
|
227
229
|
touchEnd(e) {
|
|
228
230
|
// 延时一定时间后再隐藏指示器,为了让用户看的更直观,同时也是为了消除快速切换u-transition的show带来的影响
|
|
229
|
-
|
|
231
|
+
sleep(300).then(() => {
|
|
230
232
|
this.touching = false
|
|
231
233
|
})
|
|
232
234
|
},
|
|
@@ -254,7 +256,7 @@
|
|
|
254
256
|
const {
|
|
255
257
|
height
|
|
256
258
|
} = size
|
|
257
|
-
const sys =
|
|
259
|
+
const sys = sys()
|
|
258
260
|
const windowHeight = sys.windowHeight
|
|
259
261
|
let customNavHeight = 0
|
|
260
262
|
// 消除各端导航栏非原生和原生导致的差异,让索引列表字母对屏幕垂直居中
|
|
@@ -267,7 +269,7 @@
|
|
|
267
269
|
customNavHeight = -(sys.statusBarHeight + 44)
|
|
268
270
|
// #endif
|
|
269
271
|
} else {
|
|
270
|
-
customNavHeight =
|
|
272
|
+
customNavHeight = getPx(this.customNavHeight)
|
|
271
273
|
}
|
|
272
274
|
this.letterInfo = {
|
|
273
275
|
height,
|
|
@@ -286,7 +288,7 @@
|
|
|
286
288
|
} = this.letterInfo
|
|
287
289
|
// 对H5的pageY进行修正,这是由于uni-app自作多情在H5中将触摸点的坐标跟H5的导航栏结合导致的问题
|
|
288
290
|
// #ifdef H5
|
|
289
|
-
pageY +=
|
|
291
|
+
pageY += sys().windowTop
|
|
290
292
|
// #endif
|
|
291
293
|
// 对第一和最后一个字母做边界处理,因为用户可能在字母列表上触摸到两端的尽头后依然继续滑动
|
|
292
294
|
if (pageY < top) {
|
|
@@ -311,7 +313,7 @@
|
|
|
311
313
|
// #ifdef MP-WEIXIN
|
|
312
314
|
// 微信小程序下,scroll-view的scroll-into-view属性无法对slot中的内容的id生效,只能通过设置scrollTop的形式去移动滚动条
|
|
313
315
|
const customNavHeight = this.customNavHeight
|
|
314
|
-
this.scrollTop = this.children[currentIndex].top -
|
|
316
|
+
this.scrollTop = this.children[currentIndex].top - getPx(customNavHeight)
|
|
315
317
|
// #endif
|
|
316
318
|
// #ifdef APP-NVUE
|
|
317
319
|
// 在nvue中,由于cell和header为同级元素,所以实际是需要对header(anchor)进行偏移
|
|
@@ -335,7 +337,7 @@
|
|
|
335
337
|
if (this.touching || this.scrolling) return
|
|
336
338
|
// 每过一定时间取样一次,减少资源损耗以及可能带来的卡顿
|
|
337
339
|
this.scrolling = true
|
|
338
|
-
|
|
340
|
+
sleep(10).then(() => {
|
|
339
341
|
this.scrolling = false
|
|
340
342
|
})
|
|
341
343
|
let scrollTop = 0
|
|
@@ -77,8 +77,9 @@
|
|
|
77
77
|
|
|
78
78
|
<script>
|
|
79
79
|
import props from "./props.js";
|
|
80
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
81
|
-
import mixin from '../../libs/mixin/mixin
|
|
80
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
81
|
+
import mixin from '../../libs/mixin/mixin';
|
|
82
|
+
import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '../../libs/function/index';
|
|
82
83
|
/**
|
|
83
84
|
* Input 输入框
|
|
84
85
|
* @description 此组件为一个输入框,默认没有边框和样式,是专门为配合表单组件u-form而设计的,利用它可以快速实现表单验证,输入内容,下拉选择等功能。
|
|
@@ -153,7 +154,7 @@ export default {
|
|
|
153
154
|
this.valueChange();
|
|
154
155
|
} else {
|
|
155
156
|
// 尝试调用u-form的验证方法
|
|
156
|
-
|
|
157
|
+
formValidate(this, "change");
|
|
157
158
|
}
|
|
158
159
|
/* #endif */
|
|
159
160
|
this.firstChange = false;
|
|
@@ -176,7 +177,7 @@ export default {
|
|
|
176
177
|
this.valueChange();
|
|
177
178
|
} else {
|
|
178
179
|
// 尝试调用u-form的验证方法
|
|
179
|
-
|
|
180
|
+
formValidate(this, "change");
|
|
180
181
|
}
|
|
181
182
|
/* #endif */
|
|
182
183
|
this.firstChange = false;
|
|
@@ -223,13 +224,13 @@ export default {
|
|
|
223
224
|
style.paddingLeft = "9px";
|
|
224
225
|
style.paddingRight = "9px";
|
|
225
226
|
}
|
|
226
|
-
return
|
|
227
|
+
return deepMerge(style, addStyle(this.customStyle));
|
|
227
228
|
},
|
|
228
229
|
// 输入框的样式
|
|
229
230
|
inputStyle() {
|
|
230
231
|
const style = {
|
|
231
232
|
color: this.color,
|
|
232
|
-
fontSize:
|
|
233
|
+
fontSize: addUnit(this.fontSize),
|
|
233
234
|
textAlign: this.inputAlign
|
|
234
235
|
};
|
|
235
236
|
return style;
|
|
@@ -261,11 +262,11 @@ export default {
|
|
|
261
262
|
this.$emit("blur", event.detail.value);
|
|
262
263
|
// H5端的blur会先于点击清除控件的点击click事件触发,导致focused
|
|
263
264
|
// 瞬间为false,从而隐藏了清除控件而无法被点击到
|
|
264
|
-
|
|
265
|
+
sleep(150).then(() => {
|
|
265
266
|
this.focused = false;
|
|
266
267
|
});
|
|
267
268
|
// 尝试调用u-form的验证方法
|
|
268
|
-
|
|
269
|
+
formValidate(this, "blur");
|
|
269
270
|
},
|
|
270
271
|
// 输入框聚焦时触发
|
|
271
272
|
onFocus(event) {
|
|
@@ -295,7 +296,7 @@ export default {
|
|
|
295
296
|
this.changeFromInner = true;
|
|
296
297
|
this.$emit("change", value);
|
|
297
298
|
// 尝试调用u-form的验证方法
|
|
298
|
-
|
|
299
|
+
formValidate(this, "change");
|
|
299
300
|
});
|
|
300
301
|
},
|
|
301
302
|
// 点击清除控件
|
|
@@ -313,8 +314,8 @@ export default {
|
|
|
313
314
|
*/
|
|
314
315
|
clickHandler() {
|
|
315
316
|
// #ifdef APP-NVUE
|
|
316
|
-
if (
|
|
317
|
-
const formItem =
|
|
317
|
+
if (os() === "android") {
|
|
318
|
+
const formItem = $parent.call(this, "u-form-item");
|
|
318
319
|
if (formItem) {
|
|
319
320
|
formItem.clickHandler();
|
|
320
321
|
}
|
|
@@ -68,9 +68,9 @@
|
|
|
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
74
|
|
|
75
75
|
/**
|
|
76
76
|
* keyboard 键盘
|
|
@@ -8,9 +8,10 @@
|
|
|
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
|
+
import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
|
|
14
15
|
/**
|
|
15
16
|
* line 线条
|
|
16
17
|
* @description 此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单
|
|
@@ -36,18 +37,18 @@
|
|
|
36
37
|
// 此处采用兼容分开写,兼容nvue的写法
|
|
37
38
|
style.borderBottomWidth = '1px'
|
|
38
39
|
style.borderBottomStyle = this.dashed ? 'dashed' : 'solid'
|
|
39
|
-
style.width =
|
|
40
|
+
style.width = addUnit(this.length)
|
|
40
41
|
if (this.hairline) style.transform = 'scaleY(0.5)'
|
|
41
42
|
} else {
|
|
42
43
|
// 如果是竖向线条,边框宽度为1px,再通过transform缩小一半,就是0.5px了
|
|
43
44
|
style.borderLeftWidth = '1px'
|
|
44
45
|
style.borderLeftStyle = this.dashed ? 'dashed' : 'solid'
|
|
45
|
-
style.height =
|
|
46
|
+
style.height = addUnit(this.length)
|
|
46
47
|
if (this.hairline) style.transform = 'scaleX(0.5)'
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
style.borderColor = this.color
|
|
50
|
-
return
|
|
51
|
+
return deepMerge(style, addStyle(this.customStyle))
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-line-progress"
|
|
4
|
-
:style="[
|
|
4
|
+
:style="[addStyle(customStyle)]"
|
|
5
5
|
>
|
|
6
6
|
<view
|
|
7
7
|
class="u-line-progress__background"
|
|
8
8
|
ref="u-line-progress__background"
|
|
9
9
|
:style="[{
|
|
10
10
|
backgroundColor: inactiveColor,
|
|
11
|
-
height:
|
|
11
|
+
height: addUnit(height),
|
|
12
12
|
}]"
|
|
13
13
|
>
|
|
14
14
|
</view>
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import props from './props
|
|
28
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
29
|
-
import mixin from '../../libs/mixin/mixin
|
|
27
|
+
import props from './props';
|
|
28
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
29
|
+
import mixin from '../../libs/mixin/mixin';
|
|
30
|
+
import { addUnit, addStyle, sleep, range } from '../../libs/function/index';
|
|
30
31
|
// #ifdef APP-NVUE
|
|
31
32
|
const dom = uni.requireNativePlugin('dom')
|
|
32
33
|
// #endif
|
|
@@ -60,20 +61,22 @@
|
|
|
60
61
|
let style = {}
|
|
61
62
|
style.width = this.lineWidth
|
|
62
63
|
style.backgroundColor = this.activeColor
|
|
63
|
-
style.height =
|
|
64
|
+
style.height = addUnit(this.height)
|
|
64
65
|
return style
|
|
65
66
|
},
|
|
66
67
|
innserPercentage() {
|
|
67
68
|
// 控制范围在0-100之间
|
|
68
|
-
return
|
|
69
|
+
return range(0, 100, this.percentage)
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
72
|
mounted() {
|
|
72
73
|
this.init()
|
|
73
74
|
},
|
|
74
75
|
methods: {
|
|
76
|
+
addStyle,
|
|
77
|
+
addUnit,
|
|
75
78
|
init() {
|
|
76
|
-
|
|
79
|
+
sleep(20).then(() => {
|
|
77
80
|
this.resizeProgressWidth()
|
|
78
81
|
})
|
|
79
82
|
},
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<text
|
|
3
3
|
class="u-link"
|
|
4
4
|
@tap.stop="openLink"
|
|
5
|
-
:style="[linkStyle,
|
|
5
|
+
:style="[linkStyle, addStyle(customStyle)]"
|
|
6
6
|
>{{text}}</text>
|
|
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
|
|
13
|
-
|
|
10
|
+
import props from './props';
|
|
11
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
12
|
+
import mixin from '../../libs/mixin/mixin';
|
|
13
|
+
import { addStyle, addUnit, getPx, toast } from '../../libs/function/index';
|
|
14
14
|
/**
|
|
15
15
|
* link 超链接
|
|
16
16
|
* @description 该组件为超链接组件,在不同平台有不同表现形式:在APP平台会通过plus环境打开内置浏览器,在小程序中把链接复制到粘贴板,同时提示信息,在H5中通过window.open打开链接。
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
linkStyle() {
|
|
34
34
|
const style = {
|
|
35
35
|
color: this.color,
|
|
36
|
-
fontSize:
|
|
36
|
+
fontSize: addUnit(this.fontSize),
|
|
37
37
|
// line-height设置为比字体大小多2px
|
|
38
|
-
lineHeight:
|
|
38
|
+
lineHeight: addUnit(getPx(this.fontSize) + 2),
|
|
39
39
|
textDecoration: this.underLine ? 'underline' : 'none'
|
|
40
40
|
}
|
|
41
41
|
// if (this.underLine) {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
emits: ["click"],
|
|
49
49
|
methods: {
|
|
50
|
+
addStyle,
|
|
50
51
|
openLink() {
|
|
51
52
|
// #ifdef APP-PLUS
|
|
52
53
|
plus.runtime.openURL(this.href)
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
success: () => {
|
|
61
62
|
uni.hideToast();
|
|
62
63
|
this.$nextTick(() => {
|
|
63
|
-
|
|
64
|
+
toast(this.mpTips);
|
|
64
65
|
})
|
|
65
66
|
}
|
|
66
67
|
});
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
39
|
<script>
|
|
40
|
-
import props from './props
|
|
41
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
42
|
-
import mixin from '../../libs/mixin/mixin
|
|
40
|
+
import props from './props';
|
|
41
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
42
|
+
import mixin from '../../libs/mixin/mixin';
|
|
43
|
+
import { addUnit, addStyle, deepMerge, sleep, sys } from '../../libs/function/index';
|
|
43
44
|
// #ifdef APP-NVUE
|
|
44
45
|
const dom = uni.requireNativePlugin('dom')
|
|
45
46
|
// #endif
|
|
@@ -79,18 +80,17 @@
|
|
|
79
80
|
innerScrollTop: 0,
|
|
80
81
|
// vue下,scroll-view在上拉加载时的偏移值
|
|
81
82
|
offset: 0,
|
|
82
|
-
sys:
|
|
83
|
+
sys: sys()
|
|
83
84
|
}
|
|
84
85
|
},
|
|
85
86
|
computed: {
|
|
86
87
|
listStyle() {
|
|
87
|
-
const style = {}
|
|
88
|
-
addUnit = uni.$u.addUnit
|
|
88
|
+
const style = {};
|
|
89
89
|
if (this.width != 0) style.width = addUnit(this.width)
|
|
90
90
|
if (this.height != 0) style.height = addUnit(this.height)
|
|
91
91
|
// 如果没有定义列表高度,则默认使用屏幕高度
|
|
92
92
|
if (!style.height) style.height = addUnit(this.sys.windowHeight, 'px')
|
|
93
|
-
return
|
|
93
|
+
return deepMerge(style, addStyle(this.customStyle))
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
provide() {
|
|
@@ -132,14 +132,14 @@
|
|
|
132
132
|
},
|
|
133
133
|
// 滚动到底部触发事件
|
|
134
134
|
scrolltolower(e) {
|
|
135
|
-
|
|
135
|
+
sleep(30).then(() => {
|
|
136
136
|
this.$emit('scrolltolower')
|
|
137
137
|
})
|
|
138
138
|
},
|
|
139
139
|
// #ifndef APP-NVUE
|
|
140
140
|
// 滚动到底部时触发,非nvue有效
|
|
141
141
|
scrolltoupper(e) {
|
|
142
|
-
|
|
142
|
+
sleep(30).then(() => {
|
|
143
143
|
this.$emit('scrolltoupper')
|
|
144
144
|
// 这一句很重要,能绝对保证在性功能障碍的webview,滚动条到顶时,取消偏移值,让页面置顶
|
|
145
145
|
this.offset = 0
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script>
|
|
19
|
-
import props from './props
|
|
20
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
21
|
-
import mixin from '../../libs/mixin/mixin
|
|
19
|
+
import props from './props';
|
|
20
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
21
|
+
import mixin from '../../libs/mixin/mixin';
|
|
22
|
+
import { sys } from '../../libs/function/index';
|
|
22
23
|
// #ifdef APP-NVUE
|
|
23
24
|
const dom = uni.requireNativePlugin('dom')
|
|
24
25
|
// #endif
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
rect: {},
|
|
39
40
|
index: 0,
|
|
40
41
|
show: true,
|
|
41
|
-
sys:
|
|
42
|
+
sys: sys()
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
computed: {
|