uview-plus 3.3.60 → 3.3.62
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 +10 -0
- package/components/u-cate-tab/u-cate-tab.vue +2 -0
- package/components/u-dropdown/u-dropdown.vue +3 -3
- package/components/u-icon/u-icon.vue +13 -1
- package/components/u-index-list/u-index-list.vue +8 -7
- package/components/u-list/u-list.vue +2 -2
- package/components/u-list-item/u-list-item.vue +2 -2
- package/components/u-navbar/u-navbar.vue +3 -3
- package/components/u-no-network/u-no-network.vue +2 -2
- package/components/u-parse/node/node.vue +1 -1
- package/components/u-parse/parser.js +6 -2
- package/components/u-picker/u-picker.vue +78 -29
- package/components/u-popup/u-popup.vue +2 -2
- package/components/u-safe-bottom/u-safe-bottom.vue +2 -2
- package/components/u-search/u-search.vue +1 -0
- package/components/u-slider/u-slider.vue +10 -1
- package/components/u-status-bar/u-status-bar.vue +3 -3
- package/components/u-sticky/u-sticky.vue +2 -2
- package/components/u-tabs/u-tabs.vue +2 -2
- package/components/u-toast/u-toast.vue +2 -2
- package/components/u-tooltip/u-tooltip.vue +2 -2
- package/libs/function/index.js +29 -3
- package/package.json +1 -1
- package/types/comps/actionSheet.d.ts +1 -1
package/changelog.md
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
</template>
|
|
39
39
|
<script>
|
|
40
40
|
export default {
|
|
41
|
+
name: 'up-cate-tab',
|
|
41
42
|
props: {
|
|
42
43
|
tabList: {
|
|
43
44
|
type: Array,
|
|
@@ -262,6 +263,7 @@
|
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
.u-cate-tab__right-box {
|
|
266
|
+
flex: 1;
|
|
265
267
|
background-color: rgb(250, 250, 250);
|
|
266
268
|
}
|
|
267
269
|
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
import { props } from './props';
|
|
38
38
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
39
39
|
import { mixin } from '../../libs/mixin/mixin';
|
|
40
|
-
import { addUnit,
|
|
40
|
+
import { addUnit, getWindowInfo} from '../../libs/function/index';
|
|
41
41
|
/**
|
|
42
42
|
* dropdown 下拉菜单
|
|
43
43
|
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
@@ -166,8 +166,8 @@
|
|
|
166
166
|
getContentHeight() {
|
|
167
167
|
// 这里的原理为,因为dropdown组件是相对定位的,它的下拉出来的内容,必须给定一个高度
|
|
168
168
|
// 才能让遮罩占满菜单一下,直到屏幕底部的高度
|
|
169
|
-
//
|
|
170
|
-
let windowHeight =
|
|
169
|
+
// getWindowInfo()为uview-plus封装的获取设备信息的方法
|
|
170
|
+
let windowHeight = getWindowInfo().windowHeight;
|
|
171
171
|
this.$uGetRect('.u-dropdown__menu').then(res => {
|
|
172
172
|
// 这里获取的是dropdown的尺寸,在H5上,uniapp获取尺寸是有bug的(以前提出修复过,后来又出现了此bug,目前hx2.8.11版本)
|
|
173
173
|
// H5端bug表现为元素尺寸的top值为导航栏底部到到元素的上边沿的距离,但是元素的bottom值确是导航栏顶部到元素底部的距离
|
|
@@ -81,6 +81,16 @@
|
|
|
81
81
|
*/
|
|
82
82
|
export default {
|
|
83
83
|
name: 'u-icon',
|
|
84
|
+
beforeCreate() {
|
|
85
|
+
// #ifdef APP-NVUE
|
|
86
|
+
if (this.customFontFamily) {
|
|
87
|
+
domModule.addRule('fontFace', {
|
|
88
|
+
'fontFamily': `${this.customPrefix}-${this.customFontFamily}`,
|
|
89
|
+
'src': `url('${this.customFontUrl}')`
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
// #endif
|
|
93
|
+
},
|
|
84
94
|
data() {
|
|
85
95
|
return {
|
|
86
96
|
|
|
@@ -136,7 +146,9 @@
|
|
|
136
146
|
// 通过图标名,查找对应的图标
|
|
137
147
|
icon() {
|
|
138
148
|
// 使用自定义图标的时候页面上会把name属性也展示出来,所以在这里处理一下
|
|
139
|
-
if (this.customPrefix !== "uicon")
|
|
149
|
+
if (this.customPrefix !== "uicon") {
|
|
150
|
+
return this.customIcons[this.customPrefix + '-' + this.name] || this.name;
|
|
151
|
+
}
|
|
140
152
|
// 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
|
|
141
153
|
return icons['uicon-' + this.name] || this.name
|
|
142
154
|
}
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
import { props } from './props';
|
|
106
106
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
107
107
|
import { mixin } from '../../libs/mixin/mixin';
|
|
108
|
-
import { addUnit,
|
|
108
|
+
import { addUnit, getWindowInfo, sleep, getPx } from '../../libs/function/index';
|
|
109
109
|
|
|
110
110
|
// #ifdef APP-NVUE
|
|
111
111
|
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
// scroll-view的高度
|
|
153
153
|
scrollViewHeight: 0,
|
|
154
154
|
// 系统信息
|
|
155
|
-
sys:
|
|
155
|
+
sys: {},
|
|
156
156
|
scrolling: false,
|
|
157
157
|
scrollIntoView: '',
|
|
158
158
|
pageY: 0,
|
|
@@ -188,6 +188,7 @@
|
|
|
188
188
|
created() {
|
|
189
189
|
this.children = []
|
|
190
190
|
this.anchors = []
|
|
191
|
+
this.sys = getWindowInfo()
|
|
191
192
|
},
|
|
192
193
|
mounted() {
|
|
193
194
|
this.init()
|
|
@@ -320,7 +321,7 @@
|
|
|
320
321
|
const {
|
|
321
322
|
height
|
|
322
323
|
} = size
|
|
323
|
-
const sysData =
|
|
324
|
+
const sysData = getWindowInfo()
|
|
324
325
|
const windowHeight = sysData.windowHeight
|
|
325
326
|
let customNavHeight = 0
|
|
326
327
|
// 消除各端导航栏非原生和原生导致的差异,让索引列表字母对屏幕垂直居中
|
|
@@ -358,7 +359,7 @@
|
|
|
358
359
|
let index = this.currentIndex;
|
|
359
360
|
// 对H5的pageY进行修正,这是由于uni-app自作多情在H5中将触摸点的坐标跟H5的导航栏结合导致的问题
|
|
360
361
|
// #ifdef H5
|
|
361
|
-
// pageY +=
|
|
362
|
+
// pageY += getWindowInfo().windowTop
|
|
362
363
|
// #endif
|
|
363
364
|
// 对第一和最后一个字母做边界处理,因为用户可能在字母列表上触摸到两端的尽头后依然继续滑动
|
|
364
365
|
// console.log('top1', top)
|
|
@@ -476,8 +477,8 @@
|
|
|
476
477
|
let children = this.children
|
|
477
478
|
// #ifdef APP-NVUE
|
|
478
479
|
// nvue下获取的滚动条偏移为负数,需要转为正数
|
|
479
|
-
let sys =
|
|
480
|
-
scrollTop = Math.abs(e.contentOffset.y) / 10
|
|
480
|
+
let sys = getWindowInfo()
|
|
481
|
+
scrollTop = Math.abs(e.contentOffset.y) / 10
|
|
481
482
|
// console.log('native', e)
|
|
482
483
|
// #endif
|
|
483
484
|
|
|
@@ -515,7 +516,7 @@
|
|
|
515
516
|
if (scrollTop <= children[0].top || scrollTop >= children[len - 1].top + children[len - 1].height) {
|
|
516
517
|
this.activeIndex = -1
|
|
517
518
|
break
|
|
518
|
-
} else if (!nextItem) {
|
|
519
|
+
} else if (!nextItem) {
|
|
519
520
|
// 当不存在下一个item时,意味着历遍到了最后一个
|
|
520
521
|
this.activeIndex = len - 1
|
|
521
522
|
break
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
import { props } from './props';
|
|
51
51
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
52
52
|
import { mixin } from '../../libs/mixin/mixin';
|
|
53
|
-
import { addUnit, addStyle, deepMerge, sleep,
|
|
53
|
+
import { addUnit, addStyle, deepMerge, sleep, getWindowInfo } from '../../libs/function/index';
|
|
54
54
|
// #ifdef APP-NVUE
|
|
55
55
|
const dom = uni.requireNativePlugin('dom')
|
|
56
56
|
// #endif
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
innerScrollTop: 0,
|
|
91
91
|
// vue下,scroll-view在上拉加载时的偏移值
|
|
92
92
|
offset: 0,
|
|
93
|
-
sys:
|
|
93
|
+
sys: getWindowInfo()
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
computed: {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { props } from './props';
|
|
20
20
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
21
21
|
import { mixin } from '../../libs/mixin/mixin';
|
|
22
|
-
import {
|
|
22
|
+
import { getWindowInfo } from '../../libs/function/index';
|
|
23
23
|
// #ifdef APP-NVUE
|
|
24
24
|
const dom = uni.requireNativePlugin('dom')
|
|
25
25
|
// #endif
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
rect: {},
|
|
40
40
|
index: 0,
|
|
41
41
|
show: true,
|
|
42
|
-
sys:
|
|
42
|
+
sys: getWindowInfo()
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
computed: {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
class="u-navbar__placeholder"
|
|
5
5
|
v-if="fixed && placeholder"
|
|
6
6
|
:style="{
|
|
7
|
-
height: addUnit(getPx(height) +
|
|
7
|
+
height: addUnit(getPx(height) + getWindowInfo().statusBarHeight,'px'),
|
|
8
8
|
}"
|
|
9
9
|
></view>
|
|
10
10
|
<view :class="[fixed && 'u-navbar--fixed']">
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
import { props } from './props';
|
|
78
78
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
79
79
|
import { mixin } from '../../libs/mixin/mixin';
|
|
80
|
-
import { addUnit, addStyle, getPx,
|
|
80
|
+
import { addUnit, addStyle, getPx, getWindowInfo } from '../../libs/function/index';
|
|
81
81
|
/**
|
|
82
82
|
* Navbar 自定义导航栏
|
|
83
83
|
* @description 此组件一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uni-app带的导航栏。
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
methods: {
|
|
115
115
|
addStyle,
|
|
116
116
|
addUnit,
|
|
117
|
-
|
|
117
|
+
getWindowInfo,
|
|
118
118
|
getPx,
|
|
119
119
|
// 点击左侧区域
|
|
120
120
|
leftClick() {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
import { props } from './props';
|
|
47
47
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
48
48
|
import { mixin } from '../../libs/mixin/mixin';
|
|
49
|
-
import { toast } from '../../libs/function/index';
|
|
49
|
+
import { toast, getDeviceInfo } from '../../libs/function/index';
|
|
50
50
|
/**
|
|
51
51
|
* noNetwork 无网络提示
|
|
52
52
|
* @description 该组件无需任何配置,引入即可,内部自动处理所有功能和事件。
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
mounted() {
|
|
70
|
-
this.isIOS = (
|
|
70
|
+
this.isIOS = (getDeviceInfo().platform === 'ios')
|
|
71
71
|
uni.onNetworkStatusChange((res) => {
|
|
72
72
|
this.isConnected = res.isConnected
|
|
73
73
|
this.networkType = res.networkType
|
|
@@ -75,12 +75,16 @@ const config = {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
const tagSelector={}
|
|
78
|
+
// #ifdef APP || H5 || MP-WEIXIN
|
|
79
|
+
const { windowWidth } = uni.getWindowInfo()
|
|
80
|
+
const { system } = uni.getDeviceInfo()
|
|
81
|
+
// #endif
|
|
82
|
+
// #ifndef APP || H5 || MP-WEIXIN
|
|
78
83
|
const {
|
|
79
84
|
windowWidth,
|
|
80
|
-
// #ifdef MP-WEIXIN
|
|
81
85
|
system
|
|
82
|
-
// #endif
|
|
83
86
|
} = uni.getSystemInfoSync()
|
|
87
|
+
// #endif
|
|
84
88
|
const blankChar = makeMap(' ,\r,\n,\t,\f')
|
|
85
89
|
let idIndex = 0
|
|
86
90
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-picker-warrper">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
</view>
|
|
3
|
+
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="showByClickInput = !showByClickInput">
|
|
4
|
+
<slot>
|
|
5
|
+
<up-input :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
|
|
6
|
+
<div class="input-cover"></div>
|
|
7
|
+
</slot>
|
|
8
|
+
</view>
|
|
10
9
|
<u-popup
|
|
11
10
|
:show="show || (hasInput && showByClickInput)"
|
|
12
11
|
:mode="popupMode"
|
|
@@ -114,6 +113,7 @@ export default {
|
|
|
114
113
|
// 上一次的变化列索引
|
|
115
114
|
columnIndex: 0,
|
|
116
115
|
showByClickInput: false,
|
|
116
|
+
currentActiveValue: [] //当前用户选中,但是还没确认的值,用户没做change操作时候,点击确认可以默认选中第一个
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
watch: {
|
|
@@ -121,8 +121,13 @@ export default {
|
|
|
121
121
|
defaultIndex: {
|
|
122
122
|
immediate: true,
|
|
123
123
|
deep:true,
|
|
124
|
-
handler(n) {
|
|
125
|
-
|
|
124
|
+
handler(n,o) {
|
|
125
|
+
// 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
|
|
126
|
+
// v-model的值变化时候导致defaultIndexwatch也会执行的问题
|
|
127
|
+
//单纯vue不会出现
|
|
128
|
+
if (!o || n.join("/") != o.join("/")) {
|
|
129
|
+
this.setIndexs(n, true)
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
},
|
|
128
133
|
// 监听columns参数的变化
|
|
@@ -136,22 +141,38 @@ export default {
|
|
|
136
141
|
},
|
|
137
142
|
emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue', 'update:show'],
|
|
138
143
|
computed: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
//已选&&已确认的值显示在input上面的文案
|
|
145
|
+
inputLabel() {
|
|
146
|
+
let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
|
|
147
|
+
// //区分是不是对象数组
|
|
148
|
+
if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
|
|
149
|
+
let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
|
|
150
|
+
res = res.map(item => item[this.keyName]);
|
|
151
|
+
return res.join("/");
|
|
152
|
+
|
|
153
|
+
} else {
|
|
154
|
+
//用户确定的值,才显示到输入框
|
|
155
|
+
return this.modelValue.join("/");
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
//已选,待确认的值
|
|
159
|
+
inputValue() {
|
|
160
|
+
let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
|
|
161
|
+
let res = []
|
|
162
|
+
//区分是不是对象数组
|
|
163
|
+
if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
|
|
164
|
+
//对象数组返回id集合
|
|
165
|
+
items.forEach(element => {
|
|
166
|
+
res.push(element && element['id'])
|
|
167
|
+
});
|
|
168
|
+
} else {
|
|
169
|
+
//非对象数组返回元素集合
|
|
170
|
+
items.forEach((element, index) => {
|
|
171
|
+
res.push(element)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return res
|
|
175
|
+
}
|
|
155
176
|
},
|
|
156
177
|
methods: {
|
|
157
178
|
addUnit,
|
|
@@ -184,6 +205,19 @@ export default {
|
|
|
184
205
|
},
|
|
185
206
|
// 点击工具栏的确定按钮
|
|
186
207
|
confirm() {
|
|
208
|
+
//如果用户有没有触发过change
|
|
209
|
+
if (!this.currentActiveValue.length) {
|
|
210
|
+
let arr = [0]
|
|
211
|
+
//如果有默认值&&默认值的数组长度是正确的,就用默认值
|
|
212
|
+
if (Array.isArray(this.defaultIndex) && this.defaultIndex.length == this.innerColumns.length) {
|
|
213
|
+
arr = [...this.defaultIndex];
|
|
214
|
+
} else {
|
|
215
|
+
//否则默认都选中第一个
|
|
216
|
+
arr = Array(this.innerColumns.length).fill(0);
|
|
217
|
+
}
|
|
218
|
+
this.setLastIndex(arr)
|
|
219
|
+
this.setIndexs(arr)
|
|
220
|
+
}
|
|
187
221
|
this.$emit('update:modelValue', this.inputValue)
|
|
188
222
|
if (this.hasInput) {
|
|
189
223
|
this.showByClickInput = false
|
|
@@ -202,6 +236,8 @@ export default {
|
|
|
202
236
|
} = e.detail
|
|
203
237
|
let index = 0,
|
|
204
238
|
columnIndex = 0
|
|
239
|
+
//记录用户选中但是还没确认的值
|
|
240
|
+
this.currentActiveValue = value;
|
|
205
241
|
// 通过对比前后两次的列索引,得出当前变化的是哪一列
|
|
206
242
|
for (let i = 0; i < value.length; i++) {
|
|
207
243
|
let item = value[i]
|
|
@@ -218,9 +254,11 @@ export default {
|
|
|
218
254
|
// 将当前的各项变化索引,设置为"上一次"的索引变化值
|
|
219
255
|
this.setLastIndex(value)
|
|
220
256
|
this.setIndexs(value)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
257
|
+
//如果是非自带输入框才会在change时候触发v-model绑值的变化
|
|
258
|
+
//否则会非常的奇怪,用户未确认,值就变了
|
|
259
|
+
if (!this.hasInput) {
|
|
260
|
+
this.$emit('update:modelValue', this.inputValue)
|
|
261
|
+
}
|
|
224
262
|
this.$emit('change', {
|
|
225
263
|
// #ifndef MP-WEIXIN || MP-LARK
|
|
226
264
|
// 微信小程序不能传递this,会因为循环引用而报错
|
|
@@ -303,7 +341,18 @@ export default {
|
|
|
303
341
|
|
|
304
342
|
.u-picker {
|
|
305
343
|
position: relative;
|
|
306
|
-
|
|
344
|
+
&-input {
|
|
345
|
+
position: relative;
|
|
346
|
+
.input-cover {
|
|
347
|
+
opacity: 0;
|
|
348
|
+
position: absolute;
|
|
349
|
+
top: 0;
|
|
350
|
+
bottom: 0;
|
|
351
|
+
left: 0;
|
|
352
|
+
right: 0;
|
|
353
|
+
z-index:1;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
307
356
|
&__view {
|
|
308
357
|
|
|
309
358
|
&__column {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
import { props } from './props';
|
|
52
52
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
53
53
|
import { mixin } from '../../libs/mixin/mixin';
|
|
54
|
-
import { addUnit, addStyle, deepMerge, sleep,
|
|
54
|
+
import { addUnit, addStyle, deepMerge, sleep, getWindowInfo } from '../../libs/function/index';
|
|
55
55
|
/**
|
|
56
56
|
* popup 弹窗
|
|
57
57
|
* @description 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
// 不使用css方案,是因为nvue不支持css的iPhoneX安全区查询属性
|
|
140
140
|
const {
|
|
141
141
|
safeAreaInsets
|
|
142
|
-
} =
|
|
142
|
+
} = getWindowInfo()
|
|
143
143
|
if (this.mode !== 'center') {
|
|
144
144
|
style.flex = 1
|
|
145
145
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { props } from "./props.js";
|
|
12
12
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
13
13
|
import { mixin } from '../../libs/mixin/mixin';
|
|
14
|
-
import { addStyle, deepMerge, addUnit,
|
|
14
|
+
import { addStyle, deepMerge, addUnit, getWindowInfo } from '../../libs/function/index';
|
|
15
15
|
/**
|
|
16
16
|
* SafeBottom 底部安全区
|
|
17
17
|
* @description 这个适配,主要是针对IPhone X等一些底部带指示条的机型,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行底部安全区适配。
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
const style = {};
|
|
37
37
|
// #ifdef APP-NVUE || MP-TOUTIAO
|
|
38
38
|
// nvue下,高度使用js计算填充
|
|
39
|
-
style.height = addUnit(
|
|
39
|
+
style.height = addUnit(getWindowInfo().safeAreaInsets.bottom, 'px');
|
|
40
40
|
// #endif
|
|
41
41
|
return deepMerge(style, addStyle(this.customStyle));
|
|
42
42
|
},
|
|
@@ -155,8 +155,17 @@
|
|
|
155
155
|
value(n) {
|
|
156
156
|
// 只有在非滑动状态时,才可以通过value更新滑块值,这里监听,是为了让用户触发
|
|
157
157
|
if(this.status == 'end') this.updateValue(this.value, false);
|
|
158
|
-
}
|
|
158
|
+
},
|
|
159
159
|
// #endif
|
|
160
|
+
rangeValue:{
|
|
161
|
+
handler(n){
|
|
162
|
+
if(this.status == 'end'){
|
|
163
|
+
this.updateValue(this.rangeValue[0], false, 0);
|
|
164
|
+
this.updateValue(this.rangeValue[1], false, 1);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
deep:true
|
|
168
|
+
}
|
|
160
169
|
},
|
|
161
170
|
created() {
|
|
162
171
|
},
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { props } from './props';
|
|
13
13
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
14
14
|
import { mixin } from '../../libs/mixin/mixin';
|
|
15
|
-
import { addUnit, addStyle, deepMerge,
|
|
15
|
+
import { addUnit, addStyle, deepMerge, getWindowInfo } from '../../libs/function/index';
|
|
16
16
|
/**
|
|
17
17
|
* StatbusBar 状态栏占位
|
|
18
18
|
* @description 本组件主要用于状态填充,比如在自定导航栏的时候,它会自动适配一个恰当的状态栏高度。
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
// #ifdef H5
|
|
34
34
|
this.isH5 = true
|
|
35
35
|
// #endif
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
37
|
computed: {
|
|
38
38
|
style() {
|
|
39
39
|
const style = {}
|
|
40
40
|
// 状态栏高度,由于某些安卓和微信开发工具无法识别css的顶部状态栏变量,所以使用js获取的方式
|
|
41
|
-
style.height = addUnit(
|
|
41
|
+
style.height = addUnit(getWindowInfo().statusBarHeight, 'px')
|
|
42
42
|
style.backgroundColor = this.bgColor
|
|
43
43
|
return deepMerge(style, addStyle(this.customStyle))
|
|
44
44
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { props } from './props';
|
|
18
18
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
19
19
|
import { mixin } from '../../libs/mixin/mixin';
|
|
20
|
-
import { addUnit, addStyle, deepMerge, getPx, guid,
|
|
20
|
+
import { addUnit, addStyle, deepMerge, getPx, guid, getDeviceInfo, os } from '../../libs/function/index';
|
|
21
21
|
import zIndex from '../../libs/config/zIndex';
|
|
22
22
|
/**
|
|
23
23
|
* sticky 吸顶
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
// #endif
|
|
151
151
|
|
|
152
152
|
// 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
|
|
153
|
-
if (os() === 'android' && Number(
|
|
153
|
+
if (os() === 'android' && Number(getDeviceInfo().system) > 8) {
|
|
154
154
|
this.cssSticky = true
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
96
96
|
import { mixin } from '../../libs/mixin/mixin';
|
|
97
97
|
import defProps from '../../libs/config/props.js'
|
|
98
|
-
import { addUnit, addStyle, deepMerge, getPx, sleep,
|
|
98
|
+
import { addUnit, addStyle, deepMerge, getPx, sleep, getWindowInfo } from '../../libs/function/index';
|
|
99
99
|
/**
|
|
100
100
|
* Tabs 标签
|
|
101
101
|
* @description tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
return total + curr.rect.width
|
|
254
254
|
}, 0)
|
|
255
255
|
// 此处为屏幕宽度
|
|
256
|
-
const windowWidth =
|
|
256
|
+
const windowWidth = getWindowInfo().windowWidth
|
|
257
257
|
// 将活动的tabs-item移动到屏幕正中间,实际上是对scroll-view的移动
|
|
258
258
|
let scrollLeft = offsetLeft - (this.tabsRect.width - tabRect.rect.width) / 2 - (windowWidth - this.tabsRect
|
|
259
259
|
.right) / 2 + this.tabsRect.left / 2
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<script>
|
|
43
43
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
44
44
|
import { mixin } from '../../libs/mixin/mixin';
|
|
45
|
-
import { os,
|
|
45
|
+
import { os, getWindowInfo, deepMerge, type2icon } from '../../libs/function/index';
|
|
46
46
|
import color from '../../libs/config/color';
|
|
47
47
|
import { hexToRgb } from '../../libs/function/colorGradient';
|
|
48
48
|
/**
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
},
|
|
137
137
|
// 内容盒子的样式
|
|
138
138
|
contentStyle() {
|
|
139
|
-
const windowHeight =
|
|
139
|
+
const windowHeight = getWindowInfo().windowHeight, style = {}
|
|
140
140
|
let value = 0
|
|
141
141
|
// 根据top和bottom,对Y轴进行窗体高度的百分比偏移
|
|
142
142
|
if(this.tmpConfig.position === 'top') {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
import { props } from './props';
|
|
94
94
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
95
95
|
import { mixin } from '../../libs/mixin/mixin';
|
|
96
|
-
import { addStyle, addUnit, getPx, guid, toast, sleep,
|
|
96
|
+
import { addStyle, addUnit, getPx, guid, toast, sleep, getWindowInfo } from '../../libs/function/index';
|
|
97
97
|
// #ifdef APP-NVUE
|
|
98
98
|
const dom = uni.requireNativePlugin('dom')
|
|
99
99
|
// #endif
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
const style = {
|
|
163
163
|
transform: `translateY(${this.direction === 'top' ? '-100%' : '100%'})`,
|
|
164
164
|
},
|
|
165
|
-
sysInfo =
|
|
165
|
+
sysInfo = getWindowInfo()
|
|
166
166
|
if (this.tooltipInfo.width / 2 > this.textInfo.left + this.textInfo.width / 2 - this.screenGap) {
|
|
167
167
|
this.indicatorStyle = {}
|
|
168
168
|
style.left = `-${addUnit(this.textInfo.left - this.screenGap)}`
|
package/libs/function/index.js
CHANGED
|
@@ -49,8 +49,13 @@ export function sleep(value = 30) {
|
|
|
49
49
|
* @returns {string} 返回所在平台(小写)
|
|
50
50
|
* @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
|
|
51
51
|
*/
|
|
52
|
-
export function os() {
|
|
53
|
-
|
|
52
|
+
export function os() {
|
|
53
|
+
// #ifdef APP || H5 || MP-WEIXIN
|
|
54
|
+
return uni.getDeviceInfo().platform.toLowerCase()
|
|
55
|
+
// #endif
|
|
56
|
+
// #ifndef APP || H5 || MP-WEIXIN
|
|
57
|
+
return uni.getSystemInfoSync().platform.toLowerCase()
|
|
58
|
+
// #endif
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
56
61
|
* @description 获取系统信息同步接口
|
|
@@ -58,6 +63,26 @@ export function os() {
|
|
|
58
63
|
*/
|
|
59
64
|
export function sys() {
|
|
60
65
|
return uni.getSystemInfoSync()
|
|
66
|
+
}
|
|
67
|
+
export function getWindowInfo() {
|
|
68
|
+
let ret = {}
|
|
69
|
+
// #ifdef APP || H5 || MP-WEIXIN
|
|
70
|
+
ret = uni.getWindowInfo()
|
|
71
|
+
// #endif
|
|
72
|
+
// #ifndef APP || H5 || MP-WEIXIN
|
|
73
|
+
ret = sys()
|
|
74
|
+
// #endif
|
|
75
|
+
return ret
|
|
76
|
+
}
|
|
77
|
+
export function getDeviceInfo() {
|
|
78
|
+
let ret = {}
|
|
79
|
+
// #ifdef APP || H5 || MP-WEIXIN
|
|
80
|
+
ret = uni.getDeviceInfo()
|
|
81
|
+
// #endif
|
|
82
|
+
// #ifndef APP || H5 || MP-WEIXIN
|
|
83
|
+
ret = sys()
|
|
84
|
+
// #endif
|
|
85
|
+
return ret
|
|
61
86
|
}
|
|
62
87
|
|
|
63
88
|
/**
|
|
@@ -710,7 +735,8 @@ export default {
|
|
|
710
735
|
getPx,
|
|
711
736
|
sleep,
|
|
712
737
|
os,
|
|
713
|
-
sys,
|
|
738
|
+
sys,
|
|
739
|
+
getWindowInfo,
|
|
714
740
|
random,
|
|
715
741
|
guid,
|
|
716
742
|
$parent,
|
package/package.json
CHANGED