uview-pro 0.3.9 → 0.3.11
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 +47 -0
- package/components/u-action-sheet/types.ts +3 -3
- package/components/u-action-sheet-item/types.ts +2 -2
- package/components/u-calendar/types.ts +3 -3
- package/components/u-checkbox-group/types.ts +2 -2
- package/components/u-dropdown/types.ts +8 -3
- package/components/u-index-list/types.ts +2 -2
- package/components/u-input/u-input.vue +2 -2
- package/components/u-link/types.ts +2 -2
- package/components/u-message-input/types.ts +3 -3
- package/components/u-modal/types.ts +3 -3
- package/components/u-navbar/u-navbar.vue +3 -0
- package/components/u-pagination/types.ts +29 -0
- package/components/u-pagination/u-pagination.vue +91 -0
- package/components/u-picker/types.ts +3 -3
- package/components/u-radio-group/types.ts +2 -2
- package/components/u-read-more/types.ts +2 -2
- package/components/u-select/types.ts +3 -3
- package/components/u-slider/types.ts +3 -3
- package/components/u-step/types.ts +3 -3
- package/components/u-steps/types.ts +3 -3
- package/components/u-switch/types.ts +2 -2
- package/components/u-tabs/types.ts +3 -3
- package/components/u-tabs-swiper/types.ts +3 -3
- package/index.ts +1 -1
- package/libs/function/color.ts +7 -4
- package/package.json +4 -4
- package/types/components.d.ts +1 -0
- package/types/global.d.ts +9 -0
package/changelog.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
## 0.3.11(2025-11-10)
|
|
2
|
+
|
|
3
|
+
### ✨ Features | 新功能
|
|
4
|
+
|
|
5
|
+
- Initial project setup with commitizen, cz-git, and conventional changelog
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
8
|
+
|
|
9
|
+
### 📝 Documentation | 文档
|
|
10
|
+
|
|
11
|
+
### 💄 Styles | 风格
|
|
12
|
+
|
|
13
|
+
### ♻️ Code Refactoring | 代码重构
|
|
14
|
+
|
|
15
|
+
### ⚡ Performance Improvements | 性能优化
|
|
16
|
+
|
|
17
|
+
### ✅ Tests | 测试
|
|
18
|
+
|
|
19
|
+
### 📦 Build System | 打包构建
|
|
20
|
+
|
|
21
|
+
### 👷 Continuous Integration | CI 配置
|
|
22
|
+
|
|
23
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
24
|
+
|
|
25
|
+
### ⏪ Revert | 回退
|
|
26
|
+
|
|
27
|
+
## 0.3.10(2025-11-06)
|
|
28
|
+
|
|
29
|
+
### ♻️ Code Refactoring | 代码重构
|
|
30
|
+
|
|
31
|
+
- **theme:** 优化动态颜色获取方式 ([26f44dd](https://github.com/anyup/uView-Pro/commit/26f44dd0d03b9cb93a2bc6b94ab6eb15a7b2261e))
|
|
32
|
+
- **types:** 优化类型导入并修复 u-pagination 类型定义 ([c6cbe61](https://github.com/anyup/uView-Pro/commit/c6cbe61242492ddae896ad44482f130da90033dc))
|
|
33
|
+
|
|
34
|
+
### ✨ Features | 新功能
|
|
35
|
+
|
|
36
|
+
- **u-pagination:** 新增分页组件及演示示例 ([3915064](https://github.com/anyup/uView-Pro/commit/39150648e599e818ce5c3648b3829f30754e2706))
|
|
37
|
+
- **u-navbar:** 新增左侧插槽 left ([4474e3b](https://github.com/anyup/uView-Pro/commit/4474e3b07d44126dbbcb85957bf1026c602301e7))
|
|
38
|
+
- **u-input:** 新增 focus 发射当前输入值 ([d8082ec](https://github.com/anyup/uView-Pro/commit/d8082ec2d30ae143a2cb223b6a933e5b58e1826b))
|
|
39
|
+
|
|
40
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
41
|
+
|
|
42
|
+
- **demo:** 修复 u-navbar 演示示例中,因 ref('toast') 和组件名重复问题 ([2bd32a3](https://github.com/anyup/uView-Pro/commit/2bd32a3906fa3dd7ae2a91c8e0382aef7089bba7))
|
|
43
|
+
|
|
44
|
+
### 👥 Contributors
|
|
45
|
+
|
|
46
|
+
<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/wjp980108"><img src="https://github.com/wjp980108.png?size=40" width="40" height="40" alt="wjp980108" title="wjp980108"/></a> <a href="https://github.com/wjp"><img src="https://github.com/wjp.png?size=40" width="40" height="40" alt="wjp" title="wjp"/></a>
|
|
47
|
+
|
|
1
48
|
## 0.3.9(2025-11-05)
|
|
2
49
|
|
|
3
50
|
### 🐛 Bug Fixes | Bug 修复
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import type { ActionSheetItem, ActionSheetTips } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* actionSheet 操作菜单
|
|
@@ -19,7 +19,7 @@ export const ActionSheetProps = {
|
|
|
19
19
|
/** 顶部的提示文字 */
|
|
20
20
|
tips: {
|
|
21
21
|
type: Object as unknown as PropType<ActionSheetTips>,
|
|
22
|
-
default: () => ({ text: '', color:
|
|
22
|
+
default: () => ({ text: '', color: getColor('tipsColor'), fontSize: '26rpx' })
|
|
23
23
|
},
|
|
24
24
|
/** 底部的取消按钮 */
|
|
25
25
|
cancelBtn: { type: Boolean, default: true },
|
|
@@ -34,7 +34,7 @@ export const ActionSheetProps = {
|
|
|
34
34
|
/** 取消按钮的文字提示 */
|
|
35
35
|
cancelText: { type: String, default: '取消' },
|
|
36
36
|
/** 字体颜色 */
|
|
37
|
-
color: { type: String, default: () =>
|
|
37
|
+
color: { type: String, default: () => getColor('mainColor') },
|
|
38
38
|
/** 字体大小 */
|
|
39
39
|
fontSize: { type: [String, Number], default: '32rpx' },
|
|
40
40
|
/** 是否异步关闭 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* actionSheet 操作菜单
|
|
@@ -15,7 +15,7 @@ export const ActionSheetItemProps = {
|
|
|
15
15
|
/** 边距 */
|
|
16
16
|
padding: { type: [Number, String] as PropType<number | string>, default: '34rpx 0' },
|
|
17
17
|
/** 字体颜色 */
|
|
18
|
-
color: { type: String, default: () =>
|
|
18
|
+
color: { type: String, default: () => getColor('mainColor') },
|
|
19
19
|
/** 字体大小 */
|
|
20
20
|
fontSize: { type: [String, Number], default: '32rpx' },
|
|
21
21
|
/** 是否禁用 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import type { CalendarChangeDate, CalendarChangeRange, CalendarMode, ThemeType } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* calendar 日历类型定义
|
|
@@ -40,13 +40,13 @@ export const CalendarProps = {
|
|
|
40
40
|
/** 默认日期字体颜色 */
|
|
41
41
|
color: { type: String, default: '#303133' },
|
|
42
42
|
/** 选中|起始结束日期背景色 */
|
|
43
|
-
activeBgColor: { type: String, default: () =>
|
|
43
|
+
activeBgColor: { type: String, default: () => getColor('primary') },
|
|
44
44
|
/** 选中|起始结束日期字体颜色 */
|
|
45
45
|
activeColor: { type: String, default: '#ffffff' },
|
|
46
46
|
/** 范围内日期背景色 */
|
|
47
47
|
rangeBgColor: { type: String, default: 'rgba(41,121,255,0.13)' },
|
|
48
48
|
/** 范围内日期字体颜色 */
|
|
49
|
-
rangeColor: { type: String, default: () =>
|
|
49
|
+
rangeColor: { type: String, default: () => getColor('primary') },
|
|
50
50
|
/** mode=range时生效,起始日期自定义文案 */
|
|
51
51
|
startText: { type: String, default: '开始' },
|
|
52
52
|
/** mode=range时生效,结束日期自定义文案 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import type { Shape } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* checkbox-group 复选框组类型定义
|
|
@@ -21,7 +21,7 @@ export const CheckboxGroupProps = {
|
|
|
21
21
|
/** 形状,square为方形,circle为原型 */
|
|
22
22
|
shape: { type: String as PropType<Shape>, default: 'square' },
|
|
23
23
|
/** 选中状态下的颜色 */
|
|
24
|
-
activeColor: { type: String, default: () =>
|
|
24
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
25
25
|
/** 组件的整体大小 */
|
|
26
26
|
size: { type: [String, Number], default: 34 },
|
|
27
27
|
/** 每个checkbox占u-checkbox-group的宽度 */
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
|
+
try {
|
|
6
|
+
console.log(getColor('primary'));
|
|
7
|
+
} catch (e) {
|
|
8
|
+
console.log('get color error');
|
|
9
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* u-dropdown 下拉菜单 Props
|
|
7
12
|
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
@@ -9,9 +14,9 @@ import { $u } from '../../';
|
|
|
9
14
|
export const DropdownProps = {
|
|
10
15
|
...baseProps,
|
|
11
16
|
/** 菜单标题和选项的激活态颜色 */
|
|
12
|
-
activeColor: { type: String, default: () =>
|
|
17
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
13
18
|
/** 菜单标题和选项的未激活态颜色 */
|
|
14
|
-
inactiveColor: { type: String, default: () =>
|
|
19
|
+
inactiveColor: { type: String, default: () => getColor('contentColor') },
|
|
15
20
|
/** 点击遮罩是否关闭菜单 */
|
|
16
21
|
closeOnClickMask: { type: Boolean, default: true },
|
|
17
22
|
/** 点击当前激活项标题是否关闭菜单 */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { getColor } from '../../';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* u-index-list 组件 props 类型定义
|
|
@@ -34,7 +34,7 @@ export const IndexListProps = {
|
|
|
34
34
|
/** 锚点和右边索引字符高亮颜色 */
|
|
35
35
|
activeColor: {
|
|
36
36
|
type: String,
|
|
37
|
-
default: () =>
|
|
37
|
+
default: () => getColor('primary')
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -220,9 +220,9 @@ function onFormItemError(status: boolean) {
|
|
|
220
220
|
validateState.value = status;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function onFocus(
|
|
223
|
+
function onFocus(e: any) {
|
|
224
224
|
focused.value = true;
|
|
225
|
-
emit('focus');
|
|
225
|
+
emit('focus', e.detail.value);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
function onConfirm(e: any) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { getColor } from '../../';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* u-link 组件 props 类型定义
|
|
@@ -9,7 +9,7 @@ export const LinkProps = {
|
|
|
9
9
|
/** 文字颜色 */
|
|
10
10
|
color: {
|
|
11
11
|
type: String,
|
|
12
|
-
default: () =>
|
|
12
|
+
default: () => getColor('primary')
|
|
13
13
|
},
|
|
14
14
|
/** 字体大小,单位rpx */
|
|
15
15
|
fontSize: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { MessageInputMode } from '../../types/global';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* u-message-input 组件 props 类型定义
|
|
@@ -50,12 +50,12 @@ export const MessageInputProps = {
|
|
|
50
50
|
/** 激活样式 */
|
|
51
51
|
activeColor: {
|
|
52
52
|
type: String,
|
|
53
|
-
default: () =>
|
|
53
|
+
default: () => getColor('primary')
|
|
54
54
|
},
|
|
55
55
|
/** 未激活的样式 */
|
|
56
56
|
inactiveColor: {
|
|
57
57
|
type: String,
|
|
58
|
-
default: () =>
|
|
58
|
+
default: () => getColor('contentColor')
|
|
59
59
|
},
|
|
60
60
|
/** 输入框的大小,单位rpx,宽等于高 */
|
|
61
61
|
width: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { getColor } from '../../';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* u-modal 组件 props 类型定义
|
|
@@ -59,12 +59,12 @@ export const ModalProps = {
|
|
|
59
59
|
/** 确认按钮颜色 */
|
|
60
60
|
confirmColor: {
|
|
61
61
|
type: String,
|
|
62
|
-
default: () =>
|
|
62
|
+
default: () => getColor('primary')
|
|
63
63
|
},
|
|
64
64
|
/** 取消文字颜色 */
|
|
65
65
|
cancelColor: {
|
|
66
66
|
type: String,
|
|
67
|
-
default: () =>
|
|
67
|
+
default: () => getColor('contentColor')
|
|
68
68
|
},
|
|
69
69
|
/** 圆角值 */
|
|
70
70
|
borderRadius: {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { baseProps } from '../common/props';
|
|
2
|
+
import type { PaginationChangePayload } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* pagination 分页类型定义
|
|
6
|
+
* @description 供 u-pagination 组件 props 使用
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const PaginationProps = {
|
|
10
|
+
...baseProps,
|
|
11
|
+
/** 左侧按钮文字 */
|
|
12
|
+
prevText: { type: String, default: '上一页' },
|
|
13
|
+
/** 右侧按钮文字 */
|
|
14
|
+
nextText: { type: String, default: '下一页' },
|
|
15
|
+
/** 总条目数 */
|
|
16
|
+
total: Number,
|
|
17
|
+
/** 每页数据量 */
|
|
18
|
+
pageSize: { type: Number, default: 10 },
|
|
19
|
+
/** 是否以 icon 形式展示按钮 */
|
|
20
|
+
showIcon: { type: Boolean, default: false },
|
|
21
|
+
/** 左侧按钮图标,仅支持内置图标 */
|
|
22
|
+
prevIcon: { type: String, default: 'arrow-left' },
|
|
23
|
+
/** 右侧按钮图标,仅支持内置图标 */
|
|
24
|
+
nextIcon: { type: String, default: 'arrow-right' }
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type PaginationEmits = {
|
|
28
|
+
(e: 'change', payload: PaginationChangePayload): void;
|
|
29
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-pagination">
|
|
3
|
+
<u-button
|
|
4
|
+
custom-class="custom-class"
|
|
5
|
+
shape="circle"
|
|
6
|
+
type="info"
|
|
7
|
+
size="medium"
|
|
8
|
+
:throttle-time="0"
|
|
9
|
+
:disabled="current <= 1"
|
|
10
|
+
@click="handleChange('prev')"
|
|
11
|
+
>
|
|
12
|
+
<u-icon v-if="showIcon" :name="prevIcon"></u-icon>
|
|
13
|
+
<text v-else>{{ prevText }}</text>
|
|
14
|
+
</u-button>
|
|
15
|
+
<view class="u-pagination-text">
|
|
16
|
+
<slot>
|
|
17
|
+
<u-text type="primary" :text="current"></u-text>
|
|
18
|
+
<text> / </text>
|
|
19
|
+
<text>{{ totalPages }}</text>
|
|
20
|
+
</slot>
|
|
21
|
+
</view>
|
|
22
|
+
<u-button
|
|
23
|
+
custom-class="custom-class"
|
|
24
|
+
shape="circle"
|
|
25
|
+
type="info"
|
|
26
|
+
size="medium"
|
|
27
|
+
:throttle-time="0"
|
|
28
|
+
:disabled="current >= totalPages"
|
|
29
|
+
@click="handleChange('next')"
|
|
30
|
+
>
|
|
31
|
+
<u-icon v-if="showIcon" :name="nextIcon"></u-icon>
|
|
32
|
+
<text v-else>{{ nextText }}</text>
|
|
33
|
+
</u-button>
|
|
34
|
+
</view>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
export default {
|
|
39
|
+
name: 'u-pagination',
|
|
40
|
+
options: {
|
|
41
|
+
addGlobalClass: true,
|
|
42
|
+
// #ifndef MP-TOUTIAO
|
|
43
|
+
virtualHost: true,
|
|
44
|
+
// #endif
|
|
45
|
+
styleIsolation: 'shared'
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { computed } from 'vue';
|
|
52
|
+
import { type PaginationEmits, PaginationProps } from './types.ts';
|
|
53
|
+
import type { PaginationDirection } from '../../types/global';
|
|
54
|
+
|
|
55
|
+
const props = defineProps(PaginationProps);
|
|
56
|
+
const emit = defineEmits<PaginationEmits>();
|
|
57
|
+
|
|
58
|
+
const current = defineModel({ type: Number, default: 1 });
|
|
59
|
+
|
|
60
|
+
// 自动计算总页数
|
|
61
|
+
const totalPages = computed(() => {
|
|
62
|
+
const size = props.pageSize || 10;
|
|
63
|
+
return Math.ceil((props.total || 0) / size);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// 切换分页
|
|
67
|
+
function handleChange(type: PaginationDirection) {
|
|
68
|
+
if (type === 'prev') {
|
|
69
|
+
current.value -= 1;
|
|
70
|
+
} else {
|
|
71
|
+
current.value += 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// current为当前页,type值为:next/prev,表示点击的是上一页还是下一页
|
|
75
|
+
emit('change', { type, current: current.value });
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style scoped lang="scss">
|
|
80
|
+
.u-pagination {
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
align-items: center;
|
|
84
|
+
|
|
85
|
+
:deep(.custom-class) {
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0 30rpx;
|
|
88
|
+
min-width: 120rpx;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { PickerMode, PickerParams } from '../../types/global';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
5
|
const defaultParams: PickerParams = {
|
|
6
6
|
year: true,
|
|
@@ -62,12 +62,12 @@ export const PickerProps = {
|
|
|
62
62
|
/** "取消"按钮的颜色 */
|
|
63
63
|
cancelColor: {
|
|
64
64
|
type: String,
|
|
65
|
-
default: () =>
|
|
65
|
+
default: () => getColor('contentColor')
|
|
66
66
|
},
|
|
67
67
|
/** "确定"按钮的颜色 */
|
|
68
68
|
confirmColor: {
|
|
69
69
|
type: String,
|
|
70
|
-
default: () =>
|
|
70
|
+
default: () => getColor('primary')
|
|
71
71
|
},
|
|
72
72
|
/** 默认显示的时间,2025-07-02 || 2025-07-02 13:01:00 || 2025/07/02 */
|
|
73
73
|
defaultTime: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { Shape } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* RadioGroupProps 单选框组 props 类型定义
|
|
@@ -14,7 +14,7 @@ export const RadioGroupProps = {
|
|
|
14
14
|
/** 匹配某一个radio组件,如果某个radio的name值等于此值,那么这个radio就被会选中 */
|
|
15
15
|
modelValue: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
16
16
|
/** 选中状态下的颜色 */
|
|
17
|
-
activeColor: { type: String, default: () =>
|
|
17
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
18
18
|
/** 组件的整体大小 */
|
|
19
19
|
size: { type: [String, Number] as PropType<number | string>, default: 34 },
|
|
20
20
|
/** 是否禁止点击提示语选中复选框 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* ReadMoreProps 阅读更多 props 类型定义
|
|
@@ -17,7 +17,7 @@ export const ReadMoreProps = {
|
|
|
17
17
|
/** 展开时的提示文字 */
|
|
18
18
|
openText: { type: String, default: '收起' },
|
|
19
19
|
/** 提示的文字颜色 */
|
|
20
|
-
color: { type: String, default: () =>
|
|
20
|
+
color: { type: String, default: () => getColor('primary') },
|
|
21
21
|
/** 提示文字的大小 */
|
|
22
22
|
fontSize: { type: [String, Number] as PropType<number | string>, default: 28 },
|
|
23
23
|
/** 是否显示阴影 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { SelectListItem, SelectMode } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* SelectProps 列选择器 props 类型定义
|
|
@@ -16,9 +16,9 @@ export const SelectProps = {
|
|
|
16
16
|
/** 通过双向绑定控制组件的弹出与收起 */
|
|
17
17
|
modelValue: { type: Boolean, default: false },
|
|
18
18
|
/** "取消"按钮的颜色 */
|
|
19
|
-
cancelColor: { type: String, default: () =>
|
|
19
|
+
cancelColor: { type: String, default: () => getColor('contentColor') },
|
|
20
20
|
/** "确定"按钮的颜色 */
|
|
21
|
-
confirmColor: { type: String, default: () =>
|
|
21
|
+
confirmColor: { type: String, default: () => getColor('primary') },
|
|
22
22
|
/** 弹出的z-index值 */
|
|
23
23
|
zIndex: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
24
24
|
/** 是否开启底部安全区适配 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* SliderProps 滑块选择器 props 类型定义
|
|
@@ -23,9 +23,9 @@ export const SliderProps = {
|
|
|
23
23
|
/** 滑块条高度,单位rpx */
|
|
24
24
|
height: { type: [Number, String] as PropType<number | string>, default: 6 },
|
|
25
25
|
/** 进度条的激活部分颜色 */
|
|
26
|
-
activeColor: { type: String, default: () =>
|
|
26
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
27
27
|
/** 进度条的背景颜色 */
|
|
28
|
-
inactiveColor: { type: String, default: () =>
|
|
28
|
+
inactiveColor: { type: String, default: () => getColor('lightColor') },
|
|
29
29
|
/** 滑块的背景颜色 */
|
|
30
30
|
blockColor: { type: String, default: '#ffffff' },
|
|
31
31
|
/** 用户对滑块的自定义颜色 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
3
|
import type { StepMode, ThemeType } from '../../types/global';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* StepProps 步骤条 props 类型定义
|
|
@@ -15,9 +15,9 @@ export const StepProps = {
|
|
|
15
15
|
/** 主题类型, primary|success|info|warning|error */
|
|
16
16
|
type: { type: String as PropType<ThemeType>, default: 'primary' },
|
|
17
17
|
/** 激活步骤的颜色 */
|
|
18
|
-
activeColor: { type: String, default: () =>
|
|
18
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
19
19
|
/** 未激活的颜色 */
|
|
20
|
-
unActiveColor: { type: String, default: () =>
|
|
20
|
+
unActiveColor: { type: String, default: () => getColor('info') },
|
|
21
21
|
/** 自定义图标 */
|
|
22
22
|
icon: { type: String, default: 'checkmark' },
|
|
23
23
|
/** 标题 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { StepDirection, StepMode, StepsListItem, ThemeType } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* StepsProps 步骤条 props 类型定义
|
|
@@ -19,9 +19,9 @@ export const StepsProps = {
|
|
|
19
19
|
/** 当前哪一步是激活的 */
|
|
20
20
|
current: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
21
21
|
/** 激活步骤的颜色 */
|
|
22
|
-
activeColor: { type: String, default: () =>
|
|
22
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
23
23
|
/** 未激活的颜色 */
|
|
24
|
-
unActiveColor: { type: String, default: () =>
|
|
24
|
+
unActiveColor: { type: String, default: () => getColor('info') },
|
|
25
25
|
/** 自定义图标 */
|
|
26
26
|
icon: { type: String, default: 'checkmark' },
|
|
27
27
|
/** step的排列方向,row-横向,column-竖向 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
|
-
import {
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* SwitchProps 开关选择器 props 类型定义
|
|
@@ -15,7 +15,7 @@ export const SwitchProps = {
|
|
|
15
15
|
/** 开关尺寸,单位rpx */
|
|
16
16
|
size: { type: [Number, String] as PropType<number | string>, default: 50 },
|
|
17
17
|
/** 打开时的颜色 */
|
|
18
|
-
activeColor: { type: String, default: () =>
|
|
18
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
19
19
|
/** 关闭时的颜色 */
|
|
20
20
|
inactiveColor: { type: String, default: '#ffffff' },
|
|
21
21
|
/** v-model 绑定值,是否选中 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { TabsItem } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* TabsProps tabs标签 props 类型定义
|
|
@@ -22,9 +22,9 @@ export const TabsProps = {
|
|
|
22
22
|
/** 过渡动画时长, 单位s */
|
|
23
23
|
duration: { type: [String, Number] as PropType<number | string>, default: 0.5 },
|
|
24
24
|
/** 选中项的主题颜色 */
|
|
25
|
-
activeColor: { type: String, default: () =>
|
|
25
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
26
26
|
/** 未选中项的颜色 */
|
|
27
|
-
inactiveColor: { type: String, default: () =>
|
|
27
|
+
inactiveColor: { type: String, default: () => getColor('mainColor') },
|
|
28
28
|
/** 菜单底部移动的bar的宽度,单位rpx */
|
|
29
29
|
barWidth: { type: [String, Number] as PropType<number | string>, default: 40 },
|
|
30
30
|
/** 移动bar的高度 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { TabsSwiperAutoCenterMode, TabsSwiperListItem } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
|
-
import {
|
|
4
|
+
import { getColor } from '../../';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* TabsSwiperProps 全屏选项卡 props 类型定义
|
|
@@ -22,9 +22,9 @@ export const TabsSwiperProps = {
|
|
|
22
22
|
/** tabs组件外部swiper的宽度,单位rpx */
|
|
23
23
|
swiperWidth: { type: [String, Number] as PropType<number | string>, default: 750 },
|
|
24
24
|
/** 滑块和激活tab文字的颜色 */
|
|
25
|
-
activeColor: { type: String, default: () =>
|
|
25
|
+
activeColor: { type: String, default: () => getColor('primary') },
|
|
26
26
|
/** tabs文字颜色 */
|
|
27
|
-
inactiveColor: { type: String, default: () =>
|
|
27
|
+
inactiveColor: { type: String, default: () => getColor('mainColor') },
|
|
28
28
|
/** 滑块宽度,单位rpx */
|
|
29
29
|
barWidth: { type: [Number, String] as PropType<number | string>, default: 40 },
|
|
30
30
|
/** 滑块高度,单位rpx */
|
package/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ declare const uni: {
|
|
|
13
13
|
|
|
14
14
|
// $u挂载到uni对象上
|
|
15
15
|
const install = (app: any, options?: UViewProOptions): void => {
|
|
16
|
-
uni.$u = $u;
|
|
17
16
|
if (options) {
|
|
18
17
|
// 配置主题:使用 $u.setTheme 以就地更新 reactive $u.color
|
|
19
18
|
if (options.theme) {
|
|
@@ -25,6 +24,7 @@ const install = (app: any, options?: UViewProOptions): void => {
|
|
|
25
24
|
.setPrefix(options?.log?.prefix)
|
|
26
25
|
.setShowCallerInfo(options?.log?.showCallerInfo ?? true);
|
|
27
26
|
}
|
|
27
|
+
uni.$u = $u;
|
|
28
28
|
// 可扩展更多配置项
|
|
29
29
|
app.config.globalProperties.$u = $u;
|
|
30
30
|
};
|
package/libs/function/color.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ColorType, ThemeColor } from '../../types/global';
|
|
2
|
-
import { reactive } from 'vue';
|
|
3
2
|
|
|
4
3
|
// 使用 reactive 包装颜色对象,使其在运行时可被响应式读取与更新
|
|
5
|
-
const color: ThemeColor =
|
|
4
|
+
const color: ThemeColor = {
|
|
6
5
|
primary: '#2979ff',
|
|
7
6
|
primaryDark: '#2b85e4',
|
|
8
7
|
primaryDisabled: '#a0cfff',
|
|
@@ -34,10 +33,14 @@ const color: ThemeColor = reactive({
|
|
|
34
33
|
tipsColor: '#909399',
|
|
35
34
|
lightColor: '#c0c4cc',
|
|
36
35
|
borderColor: '#e4e7ed'
|
|
37
|
-
}
|
|
36
|
+
};
|
|
38
37
|
|
|
39
38
|
export function getColor(name: ColorType) {
|
|
40
|
-
|
|
39
|
+
// 延迟获取,确保在组件实例化时获取当前主题颜色
|
|
40
|
+
if (typeof uni !== 'undefined' && uni.$u) {
|
|
41
|
+
return uni.$u.color[name];
|
|
42
|
+
}
|
|
43
|
+
return color[name] || '';
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
export default color;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "uview-pro",
|
|
3
3
|
"name": "uview-pro",
|
|
4
|
-
"displayName": "
|
|
5
|
-
"version": "0.3.
|
|
4
|
+
"displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS全面重构的80+精选UI组件库",
|
|
5
|
+
"version": "0.3.11",
|
|
6
6
|
"description": "uView Pro,是全面支持Vue3的uni-app生态框架,80+精选组件已使用TypeScript重构,已全面支持uni-app Vue3.0",
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"module": "index.ts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"nvue": "-",
|
|
70
70
|
"android": "√",
|
|
71
71
|
"ios": "√",
|
|
72
|
-
"harmony": "
|
|
72
|
+
"harmony": "√"
|
|
73
73
|
},
|
|
74
74
|
"mp": {
|
|
75
75
|
"weixin": "√",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"baidu": "-",
|
|
79
79
|
"kuaishou": "-",
|
|
80
80
|
"jd": "-",
|
|
81
|
-
"harmony": "
|
|
81
|
+
"harmony": "√",
|
|
82
82
|
"qq": "√",
|
|
83
83
|
"lark": "-"
|
|
84
84
|
},
|
package/types/components.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ declare module 'vue' {
|
|
|
96
96
|
uSafeBottom: (typeof import('../components/u-safe-bottom/u-safe-bottom.vue'))['default'];
|
|
97
97
|
uTextarea: (typeof import('../components/u-textarea/u-textarea.vue'))['default'];
|
|
98
98
|
uFab: (typeof import('../components/u-fab/u-fab.vue'))['default'];
|
|
99
|
+
uPagination: (typeof import('../components/u-pagination/u-pagination.vue'))['default'];
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
package/types/global.d.ts
CHANGED
|
@@ -347,3 +347,12 @@ export interface UViewProOptions {
|
|
|
347
347
|
log?: LogConfig;
|
|
348
348
|
// 可扩展更多配置项
|
|
349
349
|
}
|
|
350
|
+
|
|
351
|
+
// pagination 组件,分页方向
|
|
352
|
+
export type PaginationDirection = 'prev' | 'next';
|
|
353
|
+
|
|
354
|
+
// pagination 组件,change 参数
|
|
355
|
+
export type PaginationChangePayload = {
|
|
356
|
+
type: PaginationDirection;
|
|
357
|
+
current: number;
|
|
358
|
+
};
|