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
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
v-if="avatar"
|
|
12
12
|
:class="[`u-skeleton__wrapper__avatar--${avatarShape}`, animate && 'animate']"
|
|
13
13
|
:style="{
|
|
14
|
-
height:
|
|
15
|
-
width:
|
|
14
|
+
height: addUnit(avatarSize),
|
|
15
|
+
width: addUnit(avatarSize)
|
|
16
16
|
}"
|
|
17
17
|
></view>
|
|
18
18
|
<view
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
v-if="title"
|
|
26
26
|
:style="{
|
|
27
27
|
width: uTitleWidth,
|
|
28
|
-
height:
|
|
28
|
+
height: addUnit(titleHeight),
|
|
29
29
|
}"
|
|
30
30
|
:class="[animate && 'animate']"
|
|
31
31
|
></view>
|
|
@@ -49,9 +49,11 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<script>
|
|
52
|
-
import props from './props
|
|
53
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
54
|
-
import mixin from '../../libs/mixin/mixin
|
|
52
|
+
import props from './props';
|
|
53
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
54
|
+
import mixin from '../../libs/mixin/mixin';
|
|
55
|
+
import { addUnit, sleep, error } from '../../libs/function/index';
|
|
56
|
+
import test from '../../libs/function/test';
|
|
55
57
|
// #ifdef APP-NVUE
|
|
56
58
|
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
57
59
|
const dom = uni.requireNativePlugin('dom')
|
|
@@ -90,26 +92,26 @@
|
|
|
90
92
|
computed: {
|
|
91
93
|
rowsArray() {
|
|
92
94
|
if (/%$/.test(this.rowsHeight)) {
|
|
93
|
-
|
|
95
|
+
error('rowsHeight参数不支持百分比单位')
|
|
94
96
|
}
|
|
95
97
|
const rows = []
|
|
96
98
|
for (let i = 0; i < this.rows; i++) {
|
|
97
99
|
let item = {},
|
|
98
100
|
// 需要预防超出数组边界的情况
|
|
99
|
-
rowWidth =
|
|
101
|
+
rowWidth = test.array(this.rowsWidth) ? (this.rowsWidth[i] || (i === this.rows - 1 ? '70%' : '100%')) : i ===
|
|
100
102
|
this.rows - 1 ? '70%' : this.rowsWidth,
|
|
101
|
-
rowHeight =
|
|
103
|
+
rowHeight = test.array(this.rowsHeight) ? (this.rowsHeight[i] || '18px') : this.rowsHeight
|
|
102
104
|
// 如果有title占位图,第一个段落占位图的外边距需要大一些,如果没有title占位图,第一个段落占位图则无需外边距
|
|
103
105
|
// 之所以需要这么做,是因为weex的无能,以提升性能为借口不支持css的一些伪类
|
|
104
106
|
item.marginTop = !this.title && i === 0 ? 0 : this.title && i === 0 ? '20px' : '12px'
|
|
105
107
|
// 如果设置的为百分比的宽度,转换为px值,因为nvue不支持百分比单位
|
|
106
108
|
if (/%$/.test(rowWidth)) {
|
|
107
109
|
// 通过parseInt提取出百分比单位中的数值部分,除以100得到百分比的小数值
|
|
108
|
-
item.width =
|
|
110
|
+
item.width = addUnit(this.width * parseInt(rowWidth) / 100)
|
|
109
111
|
} else {
|
|
110
|
-
item.width =
|
|
112
|
+
item.width = addUnit(rowWidth)
|
|
111
113
|
}
|
|
112
|
-
item.height =
|
|
114
|
+
item.height = addUnit(rowHeight)
|
|
113
115
|
rows.push(item)
|
|
114
116
|
}
|
|
115
117
|
// console.log(rows);
|
|
@@ -119,11 +121,11 @@
|
|
|
119
121
|
let tWidth = 0
|
|
120
122
|
if (/%$/.test(this.titleWidth)) {
|
|
121
123
|
// 通过parseInt提取出百分比单位中的数值部分,除以100得到百分比的小数值
|
|
122
|
-
tWidth =
|
|
124
|
+
tWidth = addUnit(this.width * parseInt(this.titleWidth) / 100)
|
|
123
125
|
} else {
|
|
124
|
-
tWidth =
|
|
126
|
+
tWidth = addUnit(this.titleWidth)
|
|
125
127
|
}
|
|
126
|
-
return
|
|
128
|
+
return addUnit(tWidth)
|
|
127
129
|
},
|
|
128
130
|
|
|
129
131
|
},
|
|
@@ -131,6 +133,7 @@
|
|
|
131
133
|
this.init()
|
|
132
134
|
},
|
|
133
135
|
methods: {
|
|
136
|
+
addUnit,
|
|
134
137
|
init() {
|
|
135
138
|
this.getComponentWidth()
|
|
136
139
|
// #ifdef APP-NVUE
|
|
@@ -140,7 +143,7 @@
|
|
|
140
143
|
async setNvueAnimation() {
|
|
141
144
|
// #ifdef APP-NVUE
|
|
142
145
|
// 为了让opacity:1的状态保持一定时间,这里做一个延时
|
|
143
|
-
await
|
|
146
|
+
await sleep(500)
|
|
144
147
|
const skeleton = this.$refs['u-skeleton__wrapper'];
|
|
145
148
|
skeleton && this.loading && this.animate && animation.transition(skeleton, {
|
|
146
149
|
styles: {
|
|
@@ -165,7 +168,7 @@
|
|
|
165
168
|
// 获取组件的宽度
|
|
166
169
|
async getComponentWidth() {
|
|
167
170
|
// 延时一定时间,以获取dom尺寸
|
|
168
|
-
await
|
|
171
|
+
await sleep(20)
|
|
169
172
|
// #ifndef APP-NVUE
|
|
170
173
|
this.$uGetRect('.u-skeleton__wrapper__content').then(size => {
|
|
171
174
|
this.width = size.width
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sleep } from '../../libs/function/index';
|
|
1
2
|
export default {
|
|
2
3
|
data() {
|
|
3
4
|
return {
|
|
@@ -23,7 +24,7 @@ export default {
|
|
|
23
24
|
// 获取slider尺寸
|
|
24
25
|
getSliderRect() {
|
|
25
26
|
// 获取滑块条的尺寸信息
|
|
26
|
-
|
|
27
|
+
sleep().then(() => {
|
|
27
28
|
this.$uGetRect('.u-slider').then((rect) => {
|
|
28
29
|
this.info.width = rect.width
|
|
29
30
|
this.info.left = rect.left
|
|
@@ -39,4 +40,4 @@ export default {
|
|
|
39
40
|
this.$emit(e.event, e.value ? e.value : this.value)
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
}
|
|
43
|
+
}
|
|
@@ -8,7 +8,7 @@ const BindingX = uni.requireNativePlugin('bindingx')
|
|
|
8
8
|
const dom = uni.requireNativePlugin('dom')
|
|
9
9
|
// nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
|
|
10
10
|
const animation = uni.requireNativePlugin('animation')
|
|
11
|
-
|
|
11
|
+
import { range } from '../../libs/function/index';
|
|
12
12
|
export default {
|
|
13
13
|
data() {
|
|
14
14
|
return {
|
|
@@ -141,7 +141,7 @@ export default {
|
|
|
141
141
|
}, (e) => {
|
|
142
142
|
if (e.state === 'end' || e.state === 'exit') {
|
|
143
143
|
//
|
|
144
|
-
this.x =
|
|
144
|
+
this.x = range(0, left + width, e.deltaX + this.x)
|
|
145
145
|
// 根据偏移值,得出移动的百分比,进而修改双向绑定的v-model的值
|
|
146
146
|
const value = (this.x / width) * 100
|
|
147
147
|
const percent = this.formatStep(value)
|
|
@@ -8,7 +8,7 @@ const BindingX = uni.requireNativePlugin('bindingx')
|
|
|
8
8
|
const dom = uni.requireNativePlugin('dom')
|
|
9
9
|
// nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
|
|
10
10
|
const animation = uni.requireNativePlugin('animation')
|
|
11
|
-
|
|
11
|
+
import { range } from '../../libs/function/index';
|
|
12
12
|
export default {
|
|
13
13
|
data() {
|
|
14
14
|
return {
|
|
@@ -180,7 +180,7 @@ export default {
|
|
|
180
180
|
// 移动点占总长度的百分比,此处需要先除以step,是为了保证step大于1时,比如10,那么在滑动11,12px这样的
|
|
181
181
|
// 距离时,实际上滑块是不会滑动的,到了16,17px,经过四舍五入后,就变成了20px,进行了下一个跳变
|
|
182
182
|
format(value) {
|
|
183
|
-
return Math.round(
|
|
183
|
+
return Math.round(range(this.min, this.max, value) / this.step) * this.step
|
|
184
184
|
},
|
|
185
185
|
getRange() {
|
|
186
186
|
const {
|
|
@@ -20,15 +20,18 @@
|
|
|
20
20
|
</view>
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
|
-
<script>
|
|
24
|
-
import props from './props
|
|
25
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
26
|
-
import mixin from '../../libs/mixin/mixin
|
|
23
|
+
<script>
|
|
24
|
+
import props from './props';
|
|
25
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
26
|
+
import mixin from '../../libs/mixin/mixin';
|
|
27
|
+
import { addStyle, getPx } from '../../libs/function/index.js';
|
|
27
28
|
export default {
|
|
28
29
|
name: 'up-slider',
|
|
29
30
|
mixins: [mpMixin, mixin, props],
|
|
30
31
|
emits: ["changing", "change", "update:modelValue"],
|
|
31
|
-
methods: {
|
|
32
|
+
methods: {
|
|
33
|
+
addStyle,
|
|
34
|
+
getPx,
|
|
32
35
|
// 拖动过程中触发
|
|
33
36
|
changingHandler(e) {
|
|
34
37
|
const {
|
|
@@ -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, sys } from '../../libs/function/index';
|
|
14
15
|
/**
|
|
15
16
|
* StatbusBar 状态栏占位
|
|
16
17
|
* @description 本组件主要用于状态填充,比如在自定导航栏的时候,它会自动适配一个恰当的状态栏高度。
|
|
@@ -30,9 +31,9 @@
|
|
|
30
31
|
style() {
|
|
31
32
|
const style = {}
|
|
32
33
|
// 状态栏高度,由于某些安卓和微信开发工具无法识别css的顶部状态栏变量,所以使用js获取的方式
|
|
33
|
-
style.height =
|
|
34
|
+
style.height = addUnit(sys().statusBarHeight, 'px')
|
|
34
35
|
style.backgroundColor = this.bgColor
|
|
35
|
-
return
|
|
36
|
+
return deepMerge(style, addStyle(this.customStyle))
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
39
|
}
|
|
@@ -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 test from '../../libs/function/test';
|
|
14
15
|
/**
|
|
15
16
|
* Steps 步骤条
|
|
16
17
|
* @description 该组件一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
updateChildData() {
|
|
51
52
|
this.children.map(child => {
|
|
52
53
|
// 先判断子组件是否存在对应的方法
|
|
53
|
-
|
|
54
|
+
test.func((child || {}).updateFromParent()) && child.updateFromParent()
|
|
54
55
|
})
|
|
55
56
|
},
|
|
56
57
|
// 接受子组件的通知,去修改其他子组件的数据
|
|
@@ -47,9 +47,11 @@
|
|
|
47
47
|
</template>
|
|
48
48
|
|
|
49
49
|
<script>
|
|
50
|
-
import props from './props
|
|
51
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
52
|
-
import mixin from '../../libs/mixin/mixin
|
|
50
|
+
import props from './props';
|
|
51
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
52
|
+
import mixin from '../../libs/mixin/mixin';
|
|
53
|
+
import { sleep, error } from '../../libs/function/index';
|
|
54
|
+
import color from '../../libs/config/color';
|
|
53
55
|
// #ifdef APP-NVUE
|
|
54
56
|
const dom = uni.requireNativePlugin('dom')
|
|
55
57
|
// #endif
|
|
@@ -103,7 +105,7 @@
|
|
|
103
105
|
style.height = this.size.height + 'px'
|
|
104
106
|
// style.top = this.size.height / 2 + 'px'
|
|
105
107
|
}
|
|
106
|
-
style.backgroundColor = this.parent.children?.[this.index + 1]?.error ?
|
|
108
|
+
style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? color.error : this.index <
|
|
107
109
|
this
|
|
108
110
|
.parentData
|
|
109
111
|
.current ? this.parentData.activeColor : this.parentData.inactiveColor
|
|
@@ -134,7 +136,7 @@
|
|
|
134
136
|
color = this.parentData.activeColor
|
|
135
137
|
break
|
|
136
138
|
case 'error':
|
|
137
|
-
color =
|
|
139
|
+
color = color.error
|
|
138
140
|
break
|
|
139
141
|
case 'process':
|
|
140
142
|
color = this.parentData.dot ? this.parentData.activeColor : 'transparent'
|
|
@@ -160,7 +162,7 @@
|
|
|
160
162
|
},
|
|
161
163
|
mounted() {
|
|
162
164
|
this.parent && this.parent.updateFromChild()
|
|
163
|
-
|
|
165
|
+
sleep().then(() => {
|
|
164
166
|
this.getStepsItemRect()
|
|
165
167
|
})
|
|
166
168
|
},
|
|
@@ -169,7 +171,7 @@
|
|
|
169
171
|
// 初始化数据
|
|
170
172
|
this.updateParentData()
|
|
171
173
|
if (!this.parent) {
|
|
172
|
-
return
|
|
174
|
+
return error('u-steps-item必须要搭配u-steps组件使用')
|
|
173
175
|
}
|
|
174
176
|
this.index = this.parent.children.indexOf(this)
|
|
175
177
|
this.childLength = this.parent.children.length
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script>
|
|
17
|
-
import props from './props
|
|
18
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
19
|
-
import mixin from '../../libs/mixin/mixin
|
|
17
|
+
import props from './props';
|
|
18
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
19
|
+
import mixin from '../../libs/mixin/mixin';
|
|
20
|
+
import { addUnit, addStyle, deepMerge, getPx, guid, sys, os } from '../../libs/function/index';
|
|
21
|
+
import zIndex from '../../libs/config/zIndex';
|
|
20
22
|
/**
|
|
21
23
|
* sticky 吸顶
|
|
22
24
|
* @description 该组件与CSS中position: sticky属性实现的效果一致,当组件达到预设的到顶部距离时, 就会固定在指定位置,组件位置大于预设的顶部距离时,会重新按照正常的布局排列。
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
return {
|
|
40
42
|
cssSticky: false, // 是否使用css的sticky实现
|
|
41
43
|
stickyTop: 0, // 吸顶的top值,因为可能受自定义导航栏影响,最终的吸顶值非offsetTop值
|
|
42
|
-
elId:
|
|
44
|
+
elId: guid(),
|
|
43
45
|
left: 0, // js模式时,吸顶的内容因为处于postition: fixed模式,为了和原来保持一致的样式,需要记录并重新设置它的left,height,width属性
|
|
44
46
|
width: 'auto',
|
|
45
47
|
height: 'auto',
|
|
@@ -53,7 +55,7 @@
|
|
|
53
55
|
if (this.cssSticky) {
|
|
54
56
|
style.position = 'sticky'
|
|
55
57
|
style.zIndex = this.uZindex
|
|
56
|
-
style.top =
|
|
58
|
+
style.top = addUnit(this.stickyTop)
|
|
57
59
|
} else {
|
|
58
60
|
style.height = this.fixed ? this.height + 'px' : 'auto'
|
|
59
61
|
}
|
|
@@ -67,7 +69,7 @@
|
|
|
67
69
|
// #endif
|
|
68
70
|
}
|
|
69
71
|
style.backgroundColor = this.bgColor
|
|
70
|
-
return
|
|
72
|
+
return deepMerge(addStyle(this.customStyle), style)
|
|
71
73
|
},
|
|
72
74
|
// 吸顶内容的样式
|
|
73
75
|
stickyContent() {
|
|
@@ -82,7 +84,7 @@
|
|
|
82
84
|
return style
|
|
83
85
|
},
|
|
84
86
|
uZindex() {
|
|
85
|
-
return this.zIndex ? this.zIndex :
|
|
87
|
+
return this.zIndex ? this.zIndex : zIndex.sticky
|
|
86
88
|
}
|
|
87
89
|
},
|
|
88
90
|
mounted() {
|
|
@@ -137,7 +139,7 @@
|
|
|
137
139
|
observer && observer.disconnect()
|
|
138
140
|
},
|
|
139
141
|
getStickyTop() {
|
|
140
|
-
this.stickyTop =
|
|
142
|
+
this.stickyTop = getPx(this.offsetTop) + getPx(this.customNavHeight)
|
|
141
143
|
},
|
|
142
144
|
async checkSupportCssSticky() {
|
|
143
145
|
// #ifdef H5
|
|
@@ -148,7 +150,7 @@
|
|
|
148
150
|
// #endif
|
|
149
151
|
|
|
150
152
|
// 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
|
|
151
|
-
if (
|
|
153
|
+
if (os() === 'android' && Number(sys().system) > 8) {
|
|
152
154
|
this.cssSticky = true
|
|
153
155
|
}
|
|
154
156
|
|
|
@@ -158,7 +160,7 @@
|
|
|
158
160
|
// #endif
|
|
159
161
|
|
|
160
162
|
// ios上,从ios6开始,都是支持css sticky的
|
|
161
|
-
if (
|
|
163
|
+
if (os() === 'ios') {
|
|
162
164
|
this.cssSticky = true
|
|
163
165
|
}
|
|
164
166
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="u-subsection"
|
|
4
4
|
ref="u-subsection"
|
|
5
5
|
:class="[`u-subsection--${mode}`]"
|
|
6
|
-
:style="[
|
|
6
|
+
:style="[addStyle(customStyle), wrapperStyle]"
|
|
7
7
|
>
|
|
8
8
|
<view
|
|
9
9
|
class="u-subsection__bar cursor-pointer"
|
|
@@ -53,8 +53,9 @@ const dom = uni.requireNativePlugin("dom");
|
|
|
53
53
|
const animation = uni.requireNativePlugin("animation");
|
|
54
54
|
// #endif
|
|
55
55
|
import props from "./props.js";
|
|
56
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
57
|
-
import mixin from '../../libs/mixin/mixin
|
|
56
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
57
|
+
import mixin from '../../libs/mixin/mixin';
|
|
58
|
+
import { addStyle, addUnit, sleep } from '../../libs/function/index';
|
|
58
59
|
/**
|
|
59
60
|
* Subsection 分段器
|
|
60
61
|
* @description 该分段器一般用于用户从几个选项中选择某一个的场景
|
|
@@ -102,7 +103,7 @@ export default {
|
|
|
102
103
|
// 故用animation模块进行位移
|
|
103
104
|
const ref = this.$refs?.["u-subsection__bar"]?.ref;
|
|
104
105
|
// 不存在ref的时候(理解为第一次初始化时,需要渲染dom,进行一定延时再获取ref),这里的100ms是经过测试得出的结果(某些安卓需要延时久一点),勿随意修改
|
|
105
|
-
|
|
106
|
+
sleep(ref ? 0 : 100).then(() => {
|
|
106
107
|
animation.transition(this.$refs["u-subsection__bar"].ref, {
|
|
107
108
|
styles: {
|
|
108
109
|
transform: `translateX(${
|
|
@@ -162,7 +163,7 @@ export default {
|
|
|
162
163
|
const style = {};
|
|
163
164
|
style.fontWeight =
|
|
164
165
|
this.bold && this.innerCurrent === index ? "bold" : "normal";
|
|
165
|
-
style.fontSize =
|
|
166
|
+
style.fontSize = addUnit(this.fontSize);
|
|
166
167
|
// subsection模式下,激活时默认为白色的文字
|
|
167
168
|
if (this.mode === "subsection") {
|
|
168
169
|
style.color =
|
|
@@ -190,9 +191,10 @@ export default {
|
|
|
190
191
|
},
|
|
191
192
|
emits: ["change"],
|
|
192
193
|
methods: {
|
|
194
|
+
addStyle,
|
|
193
195
|
init() {
|
|
194
196
|
this.innerCurrent = this.current
|
|
195
|
-
|
|
197
|
+
sleep().then(() => this.getRect());
|
|
196
198
|
},
|
|
197
199
|
// 判断展示文本
|
|
198
200
|
getText(item) {
|
|
@@ -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
|
* SwipeAction 滑动单元格
|
|
13
13
|
* @description 该组件一般用于左滑唤出操作菜单的场景,用的最多的是左滑删除操作
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const dom = uni.requireNativePlugin('dom')
|
|
3
3
|
// nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
|
|
4
4
|
const animation = uni.requireNativePlugin('animation')
|
|
5
|
-
|
|
5
|
+
import { sleep } from '../../libs/function/index';
|
|
6
6
|
export default {
|
|
7
7
|
data() {
|
|
8
8
|
return {
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
immediate: true,
|
|
42
42
|
handler(n) {
|
|
43
43
|
// if(n === true) {
|
|
44
|
-
//
|
|
44
|
+
// sleep(50).then(() => {
|
|
45
45
|
// this.openSwipeAction()
|
|
46
46
|
// })
|
|
47
47
|
// } else {
|
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
mounted() {
|
|
54
|
-
|
|
54
|
+
sleep(20).then(() => {
|
|
55
55
|
this.queryRect()
|
|
56
56
|
})
|
|
57
57
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const dom = uni.requireNativePlugin('dom');
|
|
3
3
|
const bindingX = uni.requireNativePlugin('bindingx');
|
|
4
4
|
const animation = uni.requireNativePlugin('animation');
|
|
5
|
-
|
|
5
|
+
import { getPx, getDuration } from '../../libs/function/index';
|
|
6
6
|
export default {
|
|
7
7
|
data() {
|
|
8
8
|
return {
|
|
@@ -99,7 +99,7 @@ export default {
|
|
|
99
99
|
this.$nextTick(() => {
|
|
100
100
|
this.status = deltaX <= -this.buttonsWidth ? 'open' : 'close'
|
|
101
101
|
})
|
|
102
|
-
} else if(Math.abs(deltaX) >
|
|
102
|
+
} else if(Math.abs(deltaX) > getPx(this.threshold)) {
|
|
103
103
|
// 在移动大于阈值、并且小于总按钮宽度时,进行自动打开或者关闭
|
|
104
104
|
// 移动距离大于0时,意味着需要关闭状态
|
|
105
105
|
if(Math.abs(deltaX) < this.buttonsWidth) {
|
|
@@ -155,7 +155,7 @@ export default {
|
|
|
155
155
|
styles: {
|
|
156
156
|
transform: `translateX(${x}px)`,
|
|
157
157
|
},
|
|
158
|
-
duration:
|
|
158
|
+
duration: getDuration(this.duration, false),
|
|
159
159
|
timingFunction: 'ease-in-out'
|
|
160
160
|
}, () => {
|
|
161
161
|
this.moving = false
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}, item.style]">
|
|
17
17
|
<u-icon v-if="item.icon" :name="item.icon"
|
|
18
18
|
:color="item.style && item.style.color ? item.style.color : '#ffffff'"
|
|
19
|
-
:size="item.iconSize ?
|
|
19
|
+
:size="item.iconSize ? addUnit(item.iconSize) : item.style && item.style.fontSize ? getPx(item.style.fontSize) * 1.2 : 17"
|
|
20
20
|
:customStyle="{
|
|
21
21
|
marginRight: item.text ? '2px' : 0
|
|
22
22
|
}"></u-icon>
|
|
@@ -60,9 +60,10 @@
|
|
|
60
60
|
<!-- #endif -->
|
|
61
61
|
<script>
|
|
62
62
|
import touch from '../../libs/mixin/touch.js'
|
|
63
|
-
import props from './props
|
|
64
|
-
import mpMixin from '../../libs/mixin/mpMixin
|
|
65
|
-
import mixin from '../../libs/mixin/mixin
|
|
63
|
+
import props from './props';
|
|
64
|
+
import mpMixin from '../../libs/mixin/mpMixin';
|
|
65
|
+
import mixin from '../../libs/mixin/mixin';
|
|
66
|
+
import { addUnit, getPx, sleep } from '../../libs/function/index';
|
|
66
67
|
// #ifdef APP-NVUE
|
|
67
68
|
import nvue from './nvue.js';
|
|
68
69
|
// #endif
|
|
@@ -138,11 +139,13 @@
|
|
|
138
139
|
this.init()
|
|
139
140
|
},
|
|
140
141
|
methods: {
|
|
142
|
+
addUnit,
|
|
143
|
+
getPx,
|
|
141
144
|
init() {
|
|
142
145
|
// 初始化父组件数据
|
|
143
146
|
this.updateParentData()
|
|
144
147
|
// #ifndef APP-NVUE
|
|
145
|
-
|
|
148
|
+
sleep().then(() => {
|
|
146
149
|
this.queryRect()
|
|
147
150
|
})
|
|
148
151
|
// #endif
|