uview-pro 0.4.5 → 0.4.7
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 +46 -8
- package/components/u-icon/u-icon.vue +11 -6
- package/components/u-pagination/u-pagination.vue +7 -6
- package/components/u-slider/types.ts +13 -1
- package/components/u-slider/u-slider.vue +191 -24
- package/components/u-tabbar/u-tabbar.vue +29 -1
- package/package.json +1 -1
- package/readme.md +15 -0
- package/types/global.d.ts +1 -1
package/changelog.md
CHANGED
|
@@ -1,21 +1,59 @@
|
|
|
1
|
-
## 0.4.
|
|
1
|
+
## 0.4.7(2025-12-19)
|
|
2
|
+
|
|
3
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
4
|
+
|
|
5
|
+
- 忽略部分文件 ([a8a747f](https://github.com/anyup/uView-Pro/commit/a8a747f97e93ed278a305cd1b2671d2ede5c0fde))
|
|
2
6
|
|
|
3
7
|
### ✨ Features | 新功能
|
|
4
8
|
|
|
5
|
-
- **u-
|
|
6
|
-
- **u-form:** 增强 u-form 深层校验、动态校验表单 ([97d0ccb](https://github.com/anyup/uView-Pro/commit/97d0ccbe03391f63bed81dcfd1af1432f4f7c77d))
|
|
9
|
+
- **u-tabbar:** u-tabbar 组件支持 custom-icon 直接配置图标 custom-prefix ([e577c2d](https://github.com/anyup/uView-Pro/commit/e577c2d083cf46db7124b0df46b2848ef9bdbe80))
|
|
7
10
|
|
|
8
11
|
### 🐛 Bug Fixes | Bug 修复
|
|
9
12
|
|
|
10
|
-
- **u-
|
|
11
|
-
- **
|
|
12
|
-
- **u-switch:** 修复开关组件激活颜色默认值的响应式问题 ([3d78647](https://github.com/anyup/uView-Pro/commit/3d78647d75c3201cced2643395ff5dd935d0e7ec))
|
|
13
|
-
- **form:** 修复 form 校验报错问题 ([8d6d60d](https://github.com/anyup/uView-Pro/commit/8d6d60d4af4e5653f7b87afc3f208d0e26809505))
|
|
13
|
+
- **u-icon:** 修复图标组件样式和事件处理问题 ([1cadf27](https://github.com/anyup/uView-Pro/commit/1cadf27f8bd2aec3a11fb1befb9255256a2e3b3a))
|
|
14
|
+
- **u-pagination:** 修复分页切换时传递不正确的当前页码值 ([4befe02](https://github.com/anyup/uView-Pro/commit/4befe02c5cbb4e7db6fbf49f04ca68fac0f69a37))
|
|
14
15
|
|
|
15
16
|
### 👥 Contributors
|
|
16
17
|
|
|
17
|
-
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
18
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
18
19
|
|
|
20
|
+
## 0.4.6(2025-12-17)
|
|
21
|
+
|
|
22
|
+
### 📝 Documentation | 文档
|
|
23
|
+
|
|
24
|
+
- 添加鸿蒙系统预览说明及二维码 ([7f6199a](https://github.com/anyup/uView-Pro/commit/7f6199a30d5477743c20b27a94711b4605787757))
|
|
25
|
+
|
|
26
|
+
### ✨ Features | 新功能
|
|
27
|
+
|
|
28
|
+
- **u-slider:** 增强滑块组件功能与灵活性,支持设置滑块的整体范围起点(start)和终点(end) ([a20c44b](https://github.com/anyup/uView-Pro/commit/a20c44b0270cffde02afd8738a932b2d6bae49f4))
|
|
29
|
+
- **button:** 新增按钮禁用与自定义样式功能演示 ([5f1f482](https://github.com/anyup/uView-Pro/commit/5f1f4823e027dc5ab2e6f49f29fe327c6d4318c6))
|
|
30
|
+
|
|
31
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
32
|
+
|
|
33
|
+
- **button:** 更新禁用状态下按钮样式优先级 ([b3ff20b](https://github.com/anyup/uView-Pro/commit/b3ff20b59818c8bc8204bb2a489eff42ded7e842))
|
|
34
|
+
|
|
35
|
+
### 👥 Contributors
|
|
36
|
+
|
|
37
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
38
|
+
|
|
39
|
+
## 0.4.5(2025-12-10)
|
|
40
|
+
|
|
41
|
+
### ✨ Features | 新功能
|
|
42
|
+
|
|
43
|
+
- **u-input:** 为选择类型输入框添加覆盖层以增强交互 ([9b7bac2](https://github.com/anyup/uView-Pro/commit/9b7bac221195d010c31b15915d2927d095bd257f))
|
|
44
|
+
- **u-form:** 增强 u-form 深层校验、动态校验表单 ([97d0ccb](https://github.com/anyup/uView-Pro/commit/97d0ccbe03391f63bed81dcfd1af1432f4f7c77d))
|
|
45
|
+
|
|
46
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
47
|
+
|
|
48
|
+
- **u-input:** 修复清空图标点击事件冒泡问题 ([8a214ff](https://github.com/anyup/uView-Pro/commit/8a214ffe8e5588395cdc456e600bc8dd0f03a603))
|
|
49
|
+
- **style:** 修复除H5环境外主题样式作用域问题 ([c02ba3c](https://github.com/anyup/uView-Pro/commit/c02ba3c1454e709b1fa9de817d77b0f2128b5fc0))
|
|
50
|
+
- **u-switch:** 修复开关组件激活颜色默认值的响应式问题 ([3d78647](https://github.com/anyup/uView-Pro/commit/3d78647d75c3201cced2643395ff5dd935d0e7ec))
|
|
51
|
+
- **form:** 修复 form 校验报错问题 ([8d6d60d](https://github.com/anyup/uView-Pro/commit/8d6d60d4af4e5653f7b87afc3f208d0e26809505))
|
|
52
|
+
|
|
53
|
+
### 👥 Contributors
|
|
54
|
+
|
|
55
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/yoshinosk"><img src="https://github.com/yoshinosk.png?size=40" width="40" height="40" alt="yoshinosk" title="yoshinosk"/></a>
|
|
56
|
+
|
|
19
57
|
## 0.4.4(2025-12-08)
|
|
20
58
|
|
|
21
59
|
### ✨ Features | 新功能
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
3
|
-
|
|
2
|
+
<view
|
|
3
|
+
:style="$u.toStyle(customStyle)"
|
|
4
|
+
class="u-icon"
|
|
5
|
+
@click="onClick"
|
|
6
|
+
:class="['u-icon--' + labelPos, customClass]"
|
|
7
|
+
>
|
|
8
|
+
<image class="u-icon__img" v-if="isImg" :src="props.name" :mode="imgMode" :style="[imgStyle]" />
|
|
4
9
|
<text
|
|
5
10
|
v-else
|
|
6
11
|
class="u-icon__icon"
|
|
7
12
|
:class="iconClass"
|
|
8
|
-
:style="
|
|
13
|
+
:style="$u.toStyle(iconStyle)"
|
|
9
14
|
:hover-class="hoverClass"
|
|
10
15
|
@touchstart="onTouchstart"
|
|
11
16
|
>
|
|
12
17
|
<text
|
|
13
18
|
v-if="showDecimalIcon"
|
|
14
|
-
:style="
|
|
19
|
+
:style="$u.toStyle(decimalIconStyle)"
|
|
15
20
|
:class="decimalIconClass"
|
|
16
21
|
:hover-class="hoverClass"
|
|
17
22
|
class="u-icon__decimal"
|
|
@@ -219,8 +224,8 @@ function onClick(event: any) {
|
|
|
219
224
|
* 图标触摸时触发
|
|
220
225
|
* @emits touchstart(index)
|
|
221
226
|
*/
|
|
222
|
-
function onTouchstart() {
|
|
223
|
-
emit('touchstart', props.index);
|
|
227
|
+
function onTouchstart(event: any) {
|
|
228
|
+
emit('touchstart', props.index || event);
|
|
224
229
|
}
|
|
225
230
|
</script>
|
|
226
231
|
|
|
@@ -65,14 +65,15 @@ const totalPages = computed(() => {
|
|
|
65
65
|
|
|
66
66
|
// 切换分页
|
|
67
67
|
function handleChange(type: PaginationDirection) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
// 先计算新值,确保获取到的是更新后的值
|
|
69
|
+
const newCurrent = type === 'prev' ? current.value - 1 : current.value + 1;
|
|
70
|
+
|
|
71
|
+
// 更新 current 值
|
|
72
|
+
current.value = newCurrent;
|
|
73
73
|
|
|
74
74
|
// current为当前页,type值为:next/prev,表示点击的是上一页还是下一页
|
|
75
|
-
|
|
75
|
+
// 使用计算后的新值,而不是 current.value,避免异步更新导致的值不同步问题
|
|
76
|
+
emit('change', { type, current: newCurrent });
|
|
76
77
|
}
|
|
77
78
|
</script>
|
|
78
79
|
|
|
@@ -14,6 +14,10 @@ export const SliderProps = {
|
|
|
14
14
|
disabled: { type: Boolean, default: false },
|
|
15
15
|
/** 滑块宽度,高等于宽,单位rpx */
|
|
16
16
|
blockWidth: { type: [Number, String] as PropType<number | string>, default: 30 },
|
|
17
|
+
/** 滑块总体范围起点值 */
|
|
18
|
+
start: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
19
|
+
/** 滑块总体范围终点值 */
|
|
20
|
+
end: { type: [Number, String] as PropType<number | string>, default: 100 },
|
|
17
21
|
/** 最小值 */
|
|
18
22
|
min: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
19
23
|
/** 最大值 */
|
|
@@ -29,7 +33,15 @@ export const SliderProps = {
|
|
|
29
33
|
/** 滑块的背景颜色 */
|
|
30
34
|
blockColor: { type: String, default: 'var(--u-bg-white)' },
|
|
31
35
|
/** 用户对滑块的自定义颜色 */
|
|
32
|
-
blockStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) }
|
|
36
|
+
blockStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
37
|
+
/** 是否在滑块上方/下方显示当前数值 */
|
|
38
|
+
showValue: { type: Boolean, default: false },
|
|
39
|
+
/** 滑块数值显示位置,top-上方,bottom-下方 */
|
|
40
|
+
valuePosition: { type: String as PropType<'top' | 'bottom'>, default: 'top' },
|
|
41
|
+
/** 是否在起始和结束位置显示数值 */
|
|
42
|
+
showEdgeValue: { type: Boolean, default: false },
|
|
43
|
+
/** 起始和结束数值显示位置,top-上方,bottom-下方 */
|
|
44
|
+
edgeValuePosition: { type: String as PropType<'top' | 'bottom'>, default: 'top' }
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
export type SliderProps = ExtractPropTypes<typeof SliderProps>;
|
|
@@ -3,8 +3,22 @@
|
|
|
3
3
|
class="u-slider"
|
|
4
4
|
@tap="onClick"
|
|
5
5
|
:class="[disabled ? 'u-slider--disabled' : '', customClass]"
|
|
6
|
-
:style="$u.toStyle(
|
|
6
|
+
:style="$u.toStyle(sliderStyle, customStyle)"
|
|
7
7
|
>
|
|
8
|
+
<view
|
|
9
|
+
v-if="showEdgeValue"
|
|
10
|
+
class="u-slider__edge u-slider__edge--start"
|
|
11
|
+
:class="`u-slider__edge--${edgeValuePosition}`"
|
|
12
|
+
>
|
|
13
|
+
{{ startLabel }}
|
|
14
|
+
</view>
|
|
15
|
+
<view
|
|
16
|
+
v-if="showEdgeValue"
|
|
17
|
+
class="u-slider__edge u-slider__edge--end"
|
|
18
|
+
:class="`u-slider__edge--${edgeValuePosition}`"
|
|
19
|
+
>
|
|
20
|
+
{{ endLabel }}
|
|
21
|
+
</view>
|
|
8
22
|
<view
|
|
9
23
|
class="u-slider__gap"
|
|
10
24
|
:style="
|
|
@@ -33,6 +47,9 @@
|
|
|
33
47
|
})
|
|
34
48
|
"
|
|
35
49
|
/>
|
|
50
|
+
<view v-if="showValue" class="u-slider__value" :class="`u-slider__value--${valuePosition}`">
|
|
51
|
+
{{ displayValue }}
|
|
52
|
+
</view>
|
|
36
53
|
</view>
|
|
37
54
|
</view>
|
|
38
55
|
</view>
|
|
@@ -52,16 +69,18 @@ export default {
|
|
|
52
69
|
</script>
|
|
53
70
|
|
|
54
71
|
<script setup lang="ts">
|
|
55
|
-
import { ref, watch, onMounted, useSlots, getCurrentInstance } from 'vue';
|
|
72
|
+
import { computed, ref, watch, onMounted, useSlots, getCurrentInstance } from 'vue';
|
|
56
73
|
import { $u } from '../..';
|
|
57
74
|
import { SliderProps } from './types';
|
|
58
75
|
|
|
59
76
|
/**
|
|
60
77
|
* slider 滑块选择器
|
|
61
78
|
* @tutorial https://uviewpro.cn/zh/components/slider.html
|
|
62
|
-
* @property {Number | String} value
|
|
63
|
-
* @property {Number | String}
|
|
64
|
-
* @property {Number | String}
|
|
79
|
+
* @property {Number | String} value 滑块当前值,位于[start, end]范围内(默认0)
|
|
80
|
+
* @property {Number | String} start 整体范围起点值(默认0)
|
|
81
|
+
* @property {Number | String} end 整体范围终点值(默认100)
|
|
82
|
+
* @property {Number | String} min 有效拖动最小值,需在[start, end]中(默认0)
|
|
83
|
+
* @property {Number | String} max 有效拖动最大值,需在[start, end]中(默认100)
|
|
65
84
|
* @property {Number | String} step 步长(默认1)
|
|
66
85
|
* @property {Number | String} blockWidth 滑块宽度,高等于宽(30)
|
|
67
86
|
* @property {Number | String} height 滑块条高度,单位rpx(默认6)
|
|
@@ -70,6 +89,10 @@ import { SliderProps } from './types';
|
|
|
70
89
|
* @property {String} blockColor 滑块颜色(默认var(--u-bg-white))
|
|
71
90
|
* @property {Object} blockStyle 给滑块自定义样式,对象形式
|
|
72
91
|
* @property {Boolean} disabled 是否禁用滑块(默认为false)
|
|
92
|
+
* @property {Boolean} showValue 是否在滑块上方/下方显示当前数值
|
|
93
|
+
* @property {String} valuePosition 当前数值显示位置,top-上方,bottom-下方(默认top)
|
|
94
|
+
* @property {Boolean} showEdgeValue 是否在起始和结束位置显示数值
|
|
95
|
+
* @property {String} edgeValuePosition 起始和结束数值显示位置,top-上方,bottom-下方(默认top)
|
|
73
96
|
* @event start 滑动触发
|
|
74
97
|
* @event moving 正在滑动中
|
|
75
98
|
* @event end 滑动结束
|
|
@@ -91,16 +114,71 @@ const newValue = ref(0);
|
|
|
91
114
|
const distanceX = ref(0);
|
|
92
115
|
const startValue = ref(0);
|
|
93
116
|
const barStyle = ref<Record<string, any>>({});
|
|
117
|
+
const innerValue = ref<number>(0);
|
|
118
|
+
|
|
119
|
+
const rangeStart = computed(() => Number(props.start));
|
|
120
|
+
const rangeEnd = computed(() => Number(props.end));
|
|
121
|
+
const rangeTotal = computed(() => {
|
|
122
|
+
const total = rangeEnd.value - rangeStart.value;
|
|
123
|
+
return total === 0 ? 1 : total;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const sliderStyle = computed(() => {
|
|
127
|
+
const style = {
|
|
128
|
+
backgroundColor: props.inactiveColor
|
|
129
|
+
} as Record<string, any>;
|
|
130
|
+
if (
|
|
131
|
+
(props.showValue && props.valuePosition === 'top') ||
|
|
132
|
+
(props.showEdgeValue && props.edgeValuePosition === 'top')
|
|
133
|
+
) {
|
|
134
|
+
style.marginTop = '80rpx';
|
|
135
|
+
}
|
|
136
|
+
if (
|
|
137
|
+
(props.showValue && props.valuePosition === 'bottom') ||
|
|
138
|
+
(props.showEdgeValue && props.edgeValuePosition === 'bottom')
|
|
139
|
+
) {
|
|
140
|
+
style.marginBottom = '80rpx';
|
|
141
|
+
}
|
|
142
|
+
return style;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// 限制min和max在start和end范围内
|
|
146
|
+
const effectiveMin = computed(() => {
|
|
147
|
+
const min = Number(props.min);
|
|
148
|
+
return Math.max(rangeStart.value, Math.min(min, rangeEnd.value));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const effectiveMax = computed(() => {
|
|
152
|
+
const max = Number(props.max);
|
|
153
|
+
return Math.min(rangeEnd.value, Math.max(max, rangeStart.value));
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const startLabel = computed(() => props.start);
|
|
157
|
+
const endLabel = computed(() => props.end);
|
|
158
|
+
const showValue = computed(() => props.showValue);
|
|
159
|
+
const valuePosition = computed(() => props.valuePosition || 'top');
|
|
160
|
+
const showEdgeValue = computed(() => props.showEdgeValue);
|
|
161
|
+
const edgeValuePosition = computed(() => props.edgeValuePosition || 'top');
|
|
162
|
+
|
|
163
|
+
const displayValue = computed(() => innerValue.value);
|
|
94
164
|
|
|
95
165
|
// 监听 value 变化,非滑动状态时才更新滑块值
|
|
96
166
|
watch(
|
|
97
167
|
() => props.modelValue,
|
|
98
168
|
n => {
|
|
99
169
|
// 只有在非滑动状态时,才可以通过modelValue更新滑块值,这里监听,是为了让用户触发
|
|
100
|
-
if (status.value === 'end') updateValue(
|
|
170
|
+
if (status.value === 'end') updateValue(n, false);
|
|
101
171
|
}
|
|
102
172
|
);
|
|
103
173
|
|
|
174
|
+
watch(
|
|
175
|
+
() => [props.start, props.end, props.min, props.max],
|
|
176
|
+
() => {
|
|
177
|
+
updateValue(innerValue.value, false);
|
|
178
|
+
},
|
|
179
|
+
{ deep: true }
|
|
180
|
+
);
|
|
181
|
+
|
|
104
182
|
onMounted(() => {
|
|
105
183
|
// 获取滑块条的尺寸信息
|
|
106
184
|
$u.getRect('.u-slider', instance).then((rect: { left: number; width: number }) => {
|
|
@@ -136,9 +214,9 @@ function onTouchMove(event: TouchEvent) {
|
|
|
136
214
|
const touches = event.touches[0];
|
|
137
215
|
// 滑块的左边不一定跟屏幕左边接壤,所以需要减去最外层父元素的左边值
|
|
138
216
|
distanceX.value = touches.clientX - sliderRect.value.left;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
newValue.value =
|
|
217
|
+
const ratio = distanceX.value / sliderRect.value.width;
|
|
218
|
+
const raw = rangeStart.value + ratio * rangeTotal.value;
|
|
219
|
+
newValue.value = raw;
|
|
142
220
|
status.value = 'moving';
|
|
143
221
|
// 发出moving事件
|
|
144
222
|
emit('moving');
|
|
@@ -163,13 +241,18 @@ function onTouchEnd() {
|
|
|
163
241
|
* @param drag 是否为拖动
|
|
164
242
|
*/
|
|
165
243
|
function updateValue(value: number | string, drag: boolean) {
|
|
166
|
-
//
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
//
|
|
244
|
+
// 处理为有效值(步进 + min/max 约束),支持负数
|
|
245
|
+
const formatted = format(value);
|
|
246
|
+
innerValue.value = formatted;
|
|
247
|
+
|
|
248
|
+
// 计算相对于[start, end]的百分比宽度
|
|
249
|
+
const ratio = (formatted - rangeStart.value) / rangeTotal.value;
|
|
250
|
+
let percent = ratio * 100;
|
|
251
|
+
if (percent < 0) percent = 0;
|
|
252
|
+
if (percent > 100) percent = 100;
|
|
253
|
+
|
|
171
254
|
const style: Record<string, any> = {
|
|
172
|
-
width:
|
|
255
|
+
width: percent + '%'
|
|
173
256
|
};
|
|
174
257
|
// 移动期间无需过渡动画
|
|
175
258
|
if (drag === true) {
|
|
@@ -178,8 +261,8 @@ function updateValue(value: number | string, drag: boolean) {
|
|
|
178
261
|
// 非移动期间,删掉对过渡为空的声明,让css中的声明起效
|
|
179
262
|
delete style.transition;
|
|
180
263
|
}
|
|
181
|
-
// 修改value
|
|
182
|
-
emit('update:modelValue',
|
|
264
|
+
// 修改value值(为实际值而非百分比)
|
|
265
|
+
emit('update:modelValue', formatted);
|
|
183
266
|
barStyle.value = style;
|
|
184
267
|
}
|
|
185
268
|
|
|
@@ -189,11 +272,12 @@ function updateValue(value: number | string, drag: boolean) {
|
|
|
189
272
|
* @returns 处理后的值
|
|
190
273
|
*/
|
|
191
274
|
function format(value: number | string): number {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
275
|
+
const numeric = Number(value);
|
|
276
|
+
const step = Number(props.step) || 1;
|
|
277
|
+
// 在有效范围内裁剪(effectiveMin和effectiveMax已限制在start和end范围内),支持负数
|
|
278
|
+
const clipped = Math.max(effectiveMin.value, Math.min(numeric, effectiveMax.value));
|
|
279
|
+
// 将值按步长取整,减少对视图的频繁更新
|
|
280
|
+
return Math.round(clipped / step) * step;
|
|
197
281
|
}
|
|
198
282
|
|
|
199
283
|
/**
|
|
@@ -201,8 +285,9 @@ function format(value: number | string): number {
|
|
|
201
285
|
*/
|
|
202
286
|
function onClick(event: any) {
|
|
203
287
|
if (props.disabled) return;
|
|
204
|
-
//
|
|
205
|
-
const
|
|
288
|
+
// 直接点击滑块的情况,计算为整体[start, end]范围内的值
|
|
289
|
+
const ratio = (event.detail.x - sliderRect.value.left) / sliderRect.value.width;
|
|
290
|
+
const value = rangeStart.value + ratio * rangeTotal.value;
|
|
206
291
|
updateValue(value, false);
|
|
207
292
|
}
|
|
208
293
|
</script>
|
|
@@ -249,6 +334,88 @@ function onClick(event: any) {
|
|
|
249
334
|
transform: translate3d(50%, -50%, 0);
|
|
250
335
|
}
|
|
251
336
|
|
|
337
|
+
.u-slider__value {
|
|
338
|
+
position: absolute;
|
|
339
|
+
left: 50%;
|
|
340
|
+
transform: translateX(-50%);
|
|
341
|
+
font-size: 22rpx;
|
|
342
|
+
font-weight: 500;
|
|
343
|
+
color: #333;
|
|
344
|
+
white-space: nowrap;
|
|
345
|
+
min-width: 40rpx;
|
|
346
|
+
height: 56rpx;
|
|
347
|
+
line-height: 56rpx;
|
|
348
|
+
padding: 0 10rpx;
|
|
349
|
+
border-radius: 28rpx;
|
|
350
|
+
background-color: #ffffff;
|
|
351
|
+
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
|
|
352
|
+
z-index: 10;
|
|
353
|
+
display: flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.u-slider__value--top {
|
|
359
|
+
bottom: 100%;
|
|
360
|
+
margin-bottom: 12rpx;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.u-slider__value--top::after {
|
|
364
|
+
content: '';
|
|
365
|
+
position: absolute;
|
|
366
|
+
left: 50%;
|
|
367
|
+
top: 100%;
|
|
368
|
+
transform: translateX(-50%);
|
|
369
|
+
width: 0;
|
|
370
|
+
height: 0;
|
|
371
|
+
border-width: 4px 3px 0 3px;
|
|
372
|
+
border-style: solid;
|
|
373
|
+
border-color: #ffffff transparent transparent transparent;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.u-slider__value--bottom {
|
|
377
|
+
top: 100%;
|
|
378
|
+
margin-top: 12rpx;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.u-slider__value--bottom::after {
|
|
382
|
+
content: '';
|
|
383
|
+
position: absolute;
|
|
384
|
+
left: 50%;
|
|
385
|
+
bottom: 100%;
|
|
386
|
+
transform: translateX(-50%);
|
|
387
|
+
width: 0;
|
|
388
|
+
height: 0;
|
|
389
|
+
border-width: 0 6rpx 8rpx 6rpx;
|
|
390
|
+
border-style: solid;
|
|
391
|
+
border-color: transparent transparent #ffffff transparent;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.u-slider__edge {
|
|
395
|
+
position: absolute;
|
|
396
|
+
font-size: 24rpx;
|
|
397
|
+
color: $u-tips-color;
|
|
398
|
+
white-space: nowrap;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.u-slider__edge--start {
|
|
402
|
+
left: 0;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.u-slider__edge--end {
|
|
406
|
+
right: 0;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.u-slider__edge--top {
|
|
410
|
+
bottom: 100%;
|
|
411
|
+
margin-bottom: 8rpx;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.u-slider__edge--bottom {
|
|
415
|
+
top: 100%;
|
|
416
|
+
margin-top: 8rpx;
|
|
417
|
+
}
|
|
418
|
+
|
|
252
419
|
.u-slider--disabled {
|
|
253
420
|
opacity: 0.5;
|
|
254
421
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
:name="elIconPath(index)"
|
|
32
32
|
img-mode="scaleToFill"
|
|
33
33
|
:color="elColor(index)"
|
|
34
|
-
:custom-prefix="
|
|
34
|
+
:custom-prefix="getCustomPrefix(index)"
|
|
35
35
|
></u-icon>
|
|
36
36
|
<u-badge
|
|
37
37
|
:count="item.count"
|
|
@@ -154,6 +154,34 @@ const elColor = computed<(index: number) => string>(() => {
|
|
|
154
154
|
};
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* 计算当前item的custom-prefix
|
|
159
|
+
* customIcon为boolean时:true为"custom-icon",false为"uicon"
|
|
160
|
+
* customIcon为string时:直接使用该值
|
|
161
|
+
* customIcon为空时:默认"uicon"
|
|
162
|
+
*/
|
|
163
|
+
function getCustomPrefix(index: number): string {
|
|
164
|
+
const customIcon = props.list[index]?.customIcon;
|
|
165
|
+
|
|
166
|
+
// 如果为空(undefined/null),返回默认值
|
|
167
|
+
if (customIcon === undefined || customIcon === null || customIcon === '') {
|
|
168
|
+
return 'uicon';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 如果是字符串类型,直接返回
|
|
172
|
+
if (typeof customIcon === 'string') {
|
|
173
|
+
return customIcon;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 如果是boolean类型
|
|
177
|
+
if (typeof customIcon === 'boolean') {
|
|
178
|
+
return customIcon ? 'custom-icon' : 'uicon';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// 默认返回uicon
|
|
182
|
+
return 'uicon';
|
|
183
|
+
}
|
|
184
|
+
|
|
157
185
|
/**
|
|
158
186
|
* 点击tabbar item
|
|
159
187
|
*/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "uview-pro",
|
|
3
3
|
"name": "uview-pro",
|
|
4
4
|
"displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的80+精选UI组件库,支持多主题,暗黑模式",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.7",
|
|
6
6
|
"description": "uView Pro,是全面支持Vue3+TS的uni-app生态框架,80+精选组件,支持安卓,iOS,鸿蒙,各小程序平台,支持多主题,一键暗黑模式",
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"module": "index.ts",
|
package/readme.md
CHANGED
|
@@ -32,6 +32,21 @@
|
|
|
32
32
|
- 详尽的文档支持,现代化的演示效果
|
|
33
33
|
- 按需引入,精简打包体积
|
|
34
34
|
|
|
35
|
+
## 鸿蒙预览
|
|
36
|
+
|
|
37
|
+
🎉🎉 uView Pro 鸿蒙端应用已正式上线华为鸿蒙应用市场,为您提供完整的业务场景演示平台,包含组件库、模板示例、场景案例等,支持一键复制下载,帮助开发者快速上手并体验组件的实际应用价值!
|
|
38
|
+
|
|
39
|
+
> 系统要求:仅支持 HarmonyOS 5.0 及以上版本设备
|
|
40
|
+
|
|
41
|
+
<table>
|
|
42
|
+
<tr align="center">
|
|
43
|
+
<td><img src="https://ik.imagekit.io/anyup/images/social/qr_harmony.png" width="180" height="180" ></td>
|
|
44
|
+
</tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<td align="center"><strong>鸿蒙应用</strong><br>(浏览器扫码)</td>
|
|
47
|
+
</tr>
|
|
48
|
+
</table>
|
|
49
|
+
|
|
35
50
|
## 手机预览
|
|
36
51
|
|
|
37
52
|
您可以通过**微信**或**手机浏览器**扫描以下二维码,查看最佳的演示效果。
|