uview-pro 0.3.16 → 0.4.2
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 +82 -0
- package/components/u-action-sheet-item/u-action-sheet-item.vue +1 -1
- package/components/u-alert-tips/u-alert-tips.vue +2 -2
- package/components/u-avatar/u-avatar.vue +5 -5
- package/components/u-avatar-cropper/u-avatar-cropper.vue +5 -5
- package/components/u-avatar-cropper/weCropper.js +1 -1
- package/components/u-avatar-cropper/weCropper.ts +1 -1
- package/components/u-back-top/types.ts +1 -1
- package/components/u-back-top/u-back-top.vue +1 -1
- package/components/u-badge/u-badge.vue +1 -31
- package/components/u-button/types.ts +1 -1
- package/components/u-button/u-button.vue +45 -37
- package/components/u-calendar/types.ts +4 -4
- package/components/u-calendar/u-calendar.vue +8 -8
- package/components/u-car-keyboard/u-car-keyboard.vue +5 -5
- package/components/u-card/types.ts +2 -2
- package/components/u-card/u-card.vue +3 -3
- package/components/u-cell-group/u-cell-group.vue +1 -1
- package/components/u-cell-item/u-cell-item.vue +2 -2
- package/components/u-checkbox/u-checkbox.vue +7 -7
- package/components/u-circle-progress/types.ts +4 -3
- package/components/u-circle-progress/u-circle-progress.vue +3 -3
- package/components/u-city-select/u-city-select.vue +1 -1
- package/components/u-collapse/types.ts +2 -2
- package/components/u-collapse/u-collapse.vue +1 -1
- package/components/u-collapse-item/u-collapse-item.vue +1 -1
- package/components/u-column-notice/u-column-notice.vue +2 -2
- package/components/u-config-provider/types.ts +34 -0
- package/components/u-config-provider/u-config-provider.vue +141 -0
- package/components/u-count-down/types.ts +4 -4
- package/components/u-count-down/u-count-down.vue +4 -4
- package/components/u-count-to/types.ts +1 -1
- package/components/u-count-to/u-count-to.vue +1 -1
- package/components/u-divider/types.ts +3 -3
- package/components/u-divider/u-divider.vue +4 -4
- package/components/u-dropdown/u-dropdown.vue +3 -3
- package/components/u-empty/types.ts +2 -2
- package/components/u-empty/u-empty.vue +1 -1
- package/components/u-field/types.ts +3 -3
- package/components/u-field/u-field.vue +6 -6
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-full-screen/u-full-screen.vue +1 -1
- package/components/u-gap/u-gap.vue +2 -2
- package/components/u-grid-item/types.ts +1 -1
- package/components/u-grid-item/u-grid-item.vue +3 -3
- package/components/u-icon/types.ts +2 -2
- package/components/u-icon/u-icon.vue +2 -2
- package/components/u-image/types.ts +4 -2
- package/components/u-image/u-image.vue +7 -2
- package/components/u-index-anchor/u-index-anchor.vue +3 -3
- package/components/u-index-list/u-index-list.vue +1 -1
- package/components/u-input/types.ts +4 -4
- package/components/u-input/u-input.vue +7 -7
- package/components/u-keyboard/u-keyboard.vue +3 -3
- package/components/u-lazy-load/u-lazy-load.vue +1 -1
- package/components/u-line/types.ts +1 -1
- package/components/u-line/u-line.vue +1 -1
- package/components/u-line-progress/types.ts +2 -2
- package/components/u-line-progress/u-line-progress.vue +3 -3
- package/components/u-link/u-link.vue +1 -1
- package/components/u-loading/types.ts +1 -1
- package/components/u-loading/u-loading.vue +3 -3
- package/components/u-loading-popup/types.ts +1 -1
- package/components/u-loading-popup/u-loading-popup.vue +2 -2
- package/components/u-loadmore/types.ts +2 -2
- package/components/u-loadmore/u-loadmore.vue +6 -6
- package/components/u-message-input/u-message-input.vue +5 -5
- package/components/u-modal/u-modal.vue +2 -2
- package/components/u-navbar/types.ts +4 -4
- package/components/u-navbar/u-navbar.vue +27 -20
- package/components/u-no-network/u-no-network.vue +2 -2
- package/components/u-number-box/types.ts +4 -4
- package/components/u-number-box/u-number-box.vue +6 -6
- package/components/u-number-keyboard/u-number-keyboard.vue +2 -2
- package/components/u-picker/u-picker.vue +4 -4
- package/components/u-popup/types.ts +1 -1
- package/components/u-popup/u-popup.vue +6 -6
- package/components/u-radio/u-radio.vue +7 -7
- package/components/u-rate/types.ts +2 -2
- package/components/u-rate/u-rate.vue +2 -2
- package/components/u-read-more/types.ts +1 -1
- package/components/u-row-notice/u-row-notice.vue +2 -2
- package/components/u-search/types.ts +4 -4
- package/components/u-search/u-search.vue +4 -4
- package/components/u-section/types.ts +2 -2
- package/components/u-section/u-section.vue +2 -2
- package/components/u-select/u-select.vue +6 -6
- package/components/u-skeleton/types.ts +2 -2
- package/components/u-skeleton/u-skeleton.vue +2 -2
- package/components/u-slider/types.ts +1 -1
- package/components/u-slider/u-slider.vue +4 -4
- package/components/u-step/u-step.vue +4 -4
- package/components/u-steps/u-steps.vue +3 -3
- package/components/u-sticky/types.ts +1 -1
- package/components/u-sticky/u-sticky.vue +1 -1
- package/components/u-subsection/types.ts +4 -4
- package/components/u-subsection/u-subsection.vue +7 -7
- package/components/u-swipe-action/types.ts +1 -1
- package/components/u-swipe-action/u-swipe-action.vue +2 -2
- package/components/u-swiper/types.ts +1 -1
- package/components/u-swiper/u-swiper.vue +1 -1
- package/components/u-switch/types.ts +1 -1
- package/components/u-switch/u-switch.vue +5 -5
- package/components/u-tabbar/types.ts +5 -4
- package/components/u-tabbar/u-tabbar.vue +5 -5
- package/components/u-table/types.ts +3 -3
- package/components/u-table/u-table.vue +3 -3
- package/components/u-tabs/types.ts +1 -1
- package/components/u-tabs/u-tabs.vue +2 -2
- package/components/u-tabs-swiper/types.ts +1 -1
- package/components/u-tabs-swiper/u-tabs-swiper.vue +2 -2
- package/components/u-tag/u-tag.vue +12 -12
- package/components/u-text/types.ts +1 -1
- package/components/u-text/u-text.vue +1 -1
- package/components/u-textarea/types.ts +1 -1
- package/components/u-textarea/u-textarea.vue +6 -6
- package/components/u-time-line/u-time-line.vue +1 -1
- package/components/u-time-line-item/types.ts +1 -1
- package/components/u-time-line-item/u-time-line-item.vue +2 -3
- package/components/u-toast/u-toast.vue +8 -8
- package/components/u-top-tips/u-top-tips.vue +1 -1
- package/components/u-upload/types.ts +2 -2
- package/components/u-upload/u-upload.vue +1 -1
- package/index.scss +1 -0
- package/index.ts +42 -11
- package/libs/config/theme-tokens.ts +101 -0
- package/libs/css/style.theme.scss +31 -0
- package/libs/css/style.vue.scss +1 -1
- package/libs/function/clipboard.ts +6 -11
- package/libs/function/color.ts +53 -22
- package/libs/hooks/index.ts +2 -0
- package/libs/hooks/useColor.ts +61 -0
- package/libs/hooks/useTheme.ts +162 -0
- package/libs/index.ts +4 -3
- package/libs/util/config-provider.ts +580 -0
- package/libs/util/system-theme.ts +25 -0
- package/package.json +5 -5
- package/theme.scss +50 -34
- package/types/components.d.ts +1 -0
- package/types/global.d.ts +47 -2
|
@@ -57,7 +57,7 @@ import { SwipeActionProps } from './types';
|
|
|
57
57
|
* swipeAction 左滑单元格
|
|
58
58
|
* @description 该组件一般用于左滑唤出操作菜单的场景,用的最多的是左滑删除操作。
|
|
59
59
|
* @tutorial https://uviewpro.cn/zh/components/swipeAction.html
|
|
60
|
-
* @property {String} bg-color
|
|
60
|
+
* @property {String} bg-color 整个组件背景颜色(默认var(--u-bg-white))
|
|
61
61
|
* @property {Array} options 数组形式,可以配置背景颜色和文字
|
|
62
62
|
* @property {String|Number} index 标识符,点击时候用于区分点击了哪一个,用v-for循环时的index即可
|
|
63
63
|
* @property {String|Number} btn-width 按钮宽度,单位rpx(默认180)
|
|
@@ -264,7 +264,7 @@ function contentClick() {
|
|
|
264
264
|
.u-swipe-del {
|
|
265
265
|
position: relative;
|
|
266
266
|
font-size: 30rpx;
|
|
267
|
-
color:
|
|
267
|
+
color: var(--u-white-color);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
.u-btn-text {
|
|
@@ -39,7 +39,7 @@ export const SwiperProps = {
|
|
|
39
39
|
/** 轮播项对象的图片字段名 */
|
|
40
40
|
name: { type: String, default: 'image' },
|
|
41
41
|
/** 轮播背景色 */
|
|
42
|
-
bgColor: { type: String, default: '
|
|
42
|
+
bgColor: { type: String, default: 'var(--u-bg-color)' },
|
|
43
43
|
/** 当前激活项索引 */
|
|
44
44
|
current: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
45
45
|
/** 标题样式对象 */
|
|
@@ -115,7 +115,7 @@ import { $u } from '../..';
|
|
|
115
115
|
* @property {Boolean} autoplay 是否自动播放(默认true)
|
|
116
116
|
* @property {String|Number} interval 自动轮播时间间隔,单位ms(默认2500)
|
|
117
117
|
* @property {Boolean} circular 是否衔接播放,见官网说明(默认true)
|
|
118
|
-
* @property {String} bg-color
|
|
118
|
+
* @property {String} bg-color 背景颜色(默认var(--u-bg-color))
|
|
119
119
|
* @property {String|Number} border-radius 轮播图圆角值,单位rpx(默认8)
|
|
120
120
|
* @property {Object} title-style 自定义标题样式
|
|
121
121
|
* @property {String|Number} effect3d-previous-margin mode = true模式的情况下,激活项与前后项之间的距离,单位rpx(默认50)
|
|
@@ -17,7 +17,7 @@ export const SwitchProps = {
|
|
|
17
17
|
/** 打开时的颜色 */
|
|
18
18
|
activeColor: { type: String, default: () => getColor('primary') },
|
|
19
19
|
/** 关闭时的颜色 */
|
|
20
|
-
inactiveColor: { type: String, default: '
|
|
20
|
+
inactiveColor: { type: String, default: 'var(--u-white-color)' },
|
|
21
21
|
/** v-model 绑定值,是否选中 */
|
|
22
22
|
modelValue: { type: Boolean, default: false },
|
|
23
23
|
/** 是否开启轻微震动反馈 */
|
|
@@ -43,11 +43,11 @@ import { SwitchProps } from './types';
|
|
|
43
43
|
* @property {Boolean} disabled 是否禁用(默认false)
|
|
44
44
|
* @property {String|Number} size 开关尺寸,单位rpx(默认50)
|
|
45
45
|
* @property {String} active-color 打开时的背景色(默认主题色primary)
|
|
46
|
-
* @property {String} inactive-color
|
|
46
|
+
* @property {String} inactive-color 关闭时的背景色(默认var(--u-bg-white))
|
|
47
47
|
* @property {Boolean|Number|String} active-value 打开选择器时通过change事件发出的值(默认true)
|
|
48
48
|
* @property {Boolean|Number|String} inactive-value 关闭选择器时通过change事件发出的值(默认false)
|
|
49
49
|
* @event {Function} change 在switch打开或关闭时触发
|
|
50
|
-
* @example <u-switch v-model="checked" active-color="red" inactive-color="
|
|
50
|
+
* @example <u-switch v-model="checked" active-color="red" inactive-color="var(--u-divider-color)"></u-switch>
|
|
51
51
|
*/
|
|
52
52
|
const props = defineProps(SwitchProps);
|
|
53
53
|
|
|
@@ -96,7 +96,7 @@ function onClick() {
|
|
|
96
96
|
box-sizing: initial;
|
|
97
97
|
width: 2em;
|
|
98
98
|
height: 1em;
|
|
99
|
-
background-color:
|
|
99
|
+
background-color: var(--u-bg-white);
|
|
100
100
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
101
101
|
border-radius: 1em;
|
|
102
102
|
transition: background-color 0.3s;
|
|
@@ -112,8 +112,8 @@ function onClick() {
|
|
|
112
112
|
left: 0;
|
|
113
113
|
border-radius: 100%;
|
|
114
114
|
z-index: 1;
|
|
115
|
-
background-color:
|
|
116
|
-
background-color:
|
|
115
|
+
background-color: var(--u-bg-white);
|
|
116
|
+
background-color: var(--u-bg-white);
|
|
117
117
|
box-shadow:
|
|
118
118
|
0 3px 1px 0 rgba(0, 0, 0, 0.05),
|
|
119
119
|
0 2px 2px 0 rgba(0, 0, 0, 0.1),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import { baseProps } from '../common/props';
|
|
3
|
+
import type { TabbarItem } from '../../types/global';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* TabbarProps 底部导航栏 props 类型定义
|
|
@@ -12,7 +13,7 @@ export const TabbarProps = {
|
|
|
12
13
|
/** v-model绑定当前激活项的值 */
|
|
13
14
|
modelValue: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
14
15
|
/** tabbar背景色 */
|
|
15
|
-
bgColor: { type: String, default: '
|
|
16
|
+
bgColor: { type: String, default: 'var(--u-bg-white)' },
|
|
16
17
|
/** tabbar高度,单位任意,数值默认rpx */
|
|
17
18
|
height: { type: [String, Number] as PropType<string | number>, default: '50px' },
|
|
18
19
|
/** 非凸起图标的大小,单位任意,数值默认rpx */
|
|
@@ -20,13 +21,13 @@ export const TabbarProps = {
|
|
|
20
21
|
/** 凸起图标的大小,单位任意,数值默认rpx */
|
|
21
22
|
midButtonSize: { type: [String, Number] as PropType<string | number>, default: 90 },
|
|
22
23
|
/** 激活时的颜色 */
|
|
23
|
-
activeColor: { type: String, default: '
|
|
24
|
+
activeColor: { type: String, default: 'var(--u-main-color)' },
|
|
24
25
|
/** 未激活时的颜色 */
|
|
25
|
-
inactiveColor: { type: String, default: '
|
|
26
|
+
inactiveColor: { type: String, default: 'var(--u-content-color)' },
|
|
26
27
|
/** 是否显示中部凸起按钮 */
|
|
27
28
|
midButton: { type: Boolean, default: false },
|
|
28
29
|
/** tabbar配置项数组 */
|
|
29
|
-
list: { type: Array as PropType<
|
|
30
|
+
list: { type: Array as PropType<TabbarItem[]>, default: () => [] },
|
|
30
31
|
/** 切换前回调,返回true或Promise */
|
|
31
32
|
beforeSwitch: { type: Function as PropType<((index: number) => boolean | Promise<any>) | null>, default: null },
|
|
32
33
|
/** 是否显示顶部横线 */
|
|
@@ -74,7 +74,7 @@ export default {
|
|
|
74
74
|
</script>
|
|
75
75
|
|
|
76
76
|
<script setup lang="ts">
|
|
77
|
-
import { ref, computed, onMounted
|
|
77
|
+
import { ref, computed, onMounted } from 'vue';
|
|
78
78
|
import { $u } from '../..';
|
|
79
79
|
import { TabbarProps } from './types';
|
|
80
80
|
|
|
@@ -250,7 +250,7 @@ function getMidButtonLeft() {
|
|
|
250
250
|
top: -48rpx;
|
|
251
251
|
position: absolute;
|
|
252
252
|
z-index: 4;
|
|
253
|
-
background-color:
|
|
253
|
+
background-color: var(--u-bg-white);
|
|
254
254
|
// 由于安卓的无能,导致只有3个tabbar item时,此css计算方式有误差
|
|
255
255
|
// 故使用js计算的形式来定位,此处不注释,是因为js计算有延后,避免出现位置闪动
|
|
256
256
|
left: 50%;
|
|
@@ -270,7 +270,7 @@ function getMidButtonLeft() {
|
|
|
270
270
|
position: relative;
|
|
271
271
|
&__button {
|
|
272
272
|
position: absolute;
|
|
273
|
-
top:
|
|
273
|
+
top: 8rpx;
|
|
274
274
|
left: 50%;
|
|
275
275
|
transform: translateX(-50%);
|
|
276
276
|
}
|
|
@@ -279,7 +279,7 @@ function getMidButtonLeft() {
|
|
|
279
279
|
font-size: 26rpx;
|
|
280
280
|
line-height: 28rpx;
|
|
281
281
|
position: absolute;
|
|
282
|
-
bottom:
|
|
282
|
+
bottom: 8rpx;
|
|
283
283
|
left: 50%;
|
|
284
284
|
transform: translateX(-50%);
|
|
285
285
|
width: 100%;
|
|
@@ -303,7 +303,7 @@ function getMidButtonLeft() {
|
|
|
303
303
|
justify-content: center;
|
|
304
304
|
align-items: center;
|
|
305
305
|
position: absolute;
|
|
306
|
-
background-color:
|
|
306
|
+
background-color: var(--u-bg-white);
|
|
307
307
|
top: -40rpx;
|
|
308
308
|
left: 50%;
|
|
309
309
|
z-index: 6;
|
|
@@ -9,7 +9,7 @@ import { baseProps } from '../common/props';
|
|
|
9
9
|
export const TableProps = {
|
|
10
10
|
...baseProps,
|
|
11
11
|
/** 表格边框的颜色 */
|
|
12
|
-
borderColor: { type: String, default: '
|
|
12
|
+
borderColor: { type: String, default: 'var(--u-border-color)' },
|
|
13
13
|
/** 单元格的内容对齐方式,作用类似css的text-align */
|
|
14
14
|
align: { type: String as PropType<TextAlign>, default: 'center' },
|
|
15
15
|
/** 单元格的内边距,同css的padding写法 */
|
|
@@ -17,11 +17,11 @@ export const TableProps = {
|
|
|
17
17
|
/** 单元格字体大小,单位rpx */
|
|
18
18
|
fontSize: { type: [String, Number] as PropType<number | string>, default: 28 },
|
|
19
19
|
/** 单元格字体颜色 */
|
|
20
|
-
color: { type: String, default: '
|
|
20
|
+
color: { type: String, default: 'var(--u-content-color)' },
|
|
21
21
|
/** th单元格的样式,对象形式(将th所需参数放在table组件,是为了避免每一个th组件要写一遍) */
|
|
22
22
|
thStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
23
23
|
/** 表格的背景颜色 */
|
|
24
|
-
bgColor: { type: String, default: '
|
|
24
|
+
bgColor: { type: String, default: 'var(--u-bg-white)' }
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export type TableProps = ExtractPropTypes<typeof TableProps>;
|
|
@@ -26,12 +26,12 @@ import { $u } from '../..';
|
|
|
26
26
|
* table 表格
|
|
27
27
|
* @description 表格组件一般用于展示大量结构化数据的场景
|
|
28
28
|
* @tutorial https://uviewpro.cn/zh/components/table.html
|
|
29
|
-
* @property {String} border-color
|
|
30
|
-
* @property {String} bg-color
|
|
29
|
+
* @property {String} border-color 表格边框的颜色(默认var(--u-border-color))
|
|
30
|
+
* @property {String} bg-color 表格的背景颜色(默认var(--u-bg-white))
|
|
31
31
|
* @property {String} align 单元格的内容对齐方式,作用类似css的text-align(默认center)
|
|
32
32
|
* @property {String} padding 单元格的内边距,同css的padding写法(默认10rpx 0)
|
|
33
33
|
* @property {String | Number} font-size 单元格字体大小,单位rpx(默认28)
|
|
34
|
-
* @property {String} color
|
|
34
|
+
* @property {String} color 单元格字体颜色(默认var(--u-content-color))
|
|
35
35
|
* @property {Object} th-style th单元格的样式,对象形式(将th所需参数放在table组件,是为了避免每一个th组件要写一遍)
|
|
36
36
|
* @event {Function} click 点击组件时触发
|
|
37
37
|
* @event {Function} close 点击关闭按钮时触发
|
|
@@ -32,7 +32,7 @@ export const TabsProps = {
|
|
|
32
32
|
/** 单个tab的左右内边距之和,单位rpx */
|
|
33
33
|
gutter: { type: [String, Number] as PropType<number | string>, default: 30 },
|
|
34
34
|
/** 导航栏的背景颜色 */
|
|
35
|
-
bgColor: { type: String, default: '
|
|
35
|
+
bgColor: { type: String, default: 'var(--u-bg-white)' },
|
|
36
36
|
/** 读取传入的数组对象的属性(tab名称) */
|
|
37
37
|
name: { type: String, default: 'name' },
|
|
38
38
|
/** 读取传入的数组对象的属性(徽标数) */
|
|
@@ -52,7 +52,7 @@ import { TabsProps } from './types';
|
|
|
52
52
|
* @property {String|Number} font-size tab文字大小,单位rpx(默认30)
|
|
53
53
|
* @property {String|Number} duration 滑块移动一次所需的时间,单位秒(默认0.5)
|
|
54
54
|
* @property {String} active-color 滑块和激活tab文字的颜色(默认主题色primary)
|
|
55
|
-
* @property {String} inactive-color tabs
|
|
55
|
+
* @property {String} inactive-color tabs文字颜色(默认var(--u-main-color))
|
|
56
56
|
* @property {String|Number} bar-width 滑块宽度,单位rpx(默认40)
|
|
57
57
|
* @property {Object} active-item-style 活动tabs item的样式,对象形式
|
|
58
58
|
* @property {Object} bar-style 底部滑块的样式,对象形式
|
|
@@ -60,7 +60,7 @@ import { TabsProps } from './types';
|
|
|
60
60
|
* @property {String|Number} bar-height 滑块高度,单位rpx(默认6)
|
|
61
61
|
* @property {String|Number} item-width 标签的宽度(默认auto)
|
|
62
62
|
* @property {String|Number} gutter 单个tab标签的左右内边距之和,单位rpx(默认40)
|
|
63
|
-
* @property {String} bg-color tabs
|
|
63
|
+
* @property {String} bg-color tabs导航栏的背景颜色(默认var(--u-bg-white))
|
|
64
64
|
* @property {String} name 组件内部读取的list参数中的属性名(tab名称),见官网说明(默认name)
|
|
65
65
|
* @property {String} count 组件内部读取的list参数中的属性名(badge徽标数),同name属性的使用,见官网说明(默认count)
|
|
66
66
|
* @property {Array} offset 设置badge徽标数的位置偏移,格式为 [x, y],也即设置的为top和right的值,单位rpx(默认[5, 20])
|
|
@@ -34,7 +34,7 @@ export const TabsSwiperProps = {
|
|
|
34
34
|
/** z-index 层级 */
|
|
35
35
|
zIndex: { type: [Number, String] as PropType<number | string>, default: 1 },
|
|
36
36
|
/** tabs导航栏的背景颜色 */
|
|
37
|
-
bgColor: { type: String, default: '
|
|
37
|
+
bgColor: { type: String, default: 'var(--u-bg-white)' },
|
|
38
38
|
/** 居中模式,window/组件宽度 */
|
|
39
39
|
autoCenterMode: { type: String as unknown as PropType<TabsSwiperAutoCenterMode>, default: 'window' },
|
|
40
40
|
/** 组件内部读取的list参数中的属性名(tab名称) */
|
|
@@ -55,14 +55,14 @@ import { $u } from '../..';
|
|
|
55
55
|
* @property {String|Number} font-size tab文字大小,单位rpx(默认30)
|
|
56
56
|
* @property {String|Number} swiper-width tabs组件外部swiper的宽度,默认为屏幕宽度,单位rpx(默认750)
|
|
57
57
|
* @property {String} active-color 滑块和激活tab文字的颜色(默认主题色primary)
|
|
58
|
-
* @property {String} inactive-color tabs
|
|
58
|
+
* @property {String} inactive-color tabs文字颜色(默认var(--u-main-color))
|
|
59
59
|
* @property {String|Number} bar-width 滑块宽度,单位rpx(默认40)
|
|
60
60
|
* @property {String|Number} bar-height 滑块高度,单位rpx(默认6)
|
|
61
61
|
* @property {Object} bar-style 底部滑块的样式,对象形式
|
|
62
62
|
* @property {Object} active-item-style 活动tabs item的样式,对象形式
|
|
63
63
|
* @property {Boolean} show-bar 是否显示底部的滑块(默认true)
|
|
64
64
|
* @property {String|Number} gutter 单个tab标签的左右内边距之和,单位rpx(默认40)
|
|
65
|
-
* @property {String} bg-color tabs
|
|
65
|
+
* @property {String} bg-color tabs导航栏的背景颜色(默认var(--u-bg-white))
|
|
66
66
|
* @property {String} name 组件内部读取的list参数中的属性名,见官网说明(默认name)
|
|
67
67
|
* @property {String} count 组件内部读取的list参数中的属性名(badge徽标数),同name属性的使用,见官网说明(默认count)
|
|
68
68
|
* @property {Array} offset 设置badge徽标数的位置偏移,格式为 [x, y],也即设置的为top和right的值,单位rpx(默认[5, 20])
|
|
@@ -96,7 +96,7 @@ const iconStyle = computed(() => {
|
|
|
96
96
|
if (props.size === 'mini') style.fontSize = '20rpx';
|
|
97
97
|
else style.fontSize = '22rpx';
|
|
98
98
|
if (props.mode === 'plain' || props.mode === 'light') style.color = props.type;
|
|
99
|
-
else if (props.mode === 'dark') style.color = '
|
|
99
|
+
else if (props.mode === 'dark') style.color = 'var(--u-white-color)';
|
|
100
100
|
if (props.closeColor) style.color = props.closeColor;
|
|
101
101
|
return style;
|
|
102
102
|
});
|
|
@@ -110,7 +110,7 @@ const closeIconColor = computed(() => {
|
|
|
110
110
|
// 最后如果上面的三者都不合适,就返回type值给图标获取颜色
|
|
111
111
|
if (props.closeColor) return props.closeColor;
|
|
112
112
|
else if (props.color) return props.color;
|
|
113
|
-
else if (props.mode === 'dark') return '
|
|
113
|
+
else if (props.mode === 'dark') return 'var(--u-white-color)';
|
|
114
114
|
else return props.type;
|
|
115
115
|
});
|
|
116
116
|
|
|
@@ -186,55 +186,55 @@ function close() {
|
|
|
186
186
|
|
|
187
187
|
.u-mode-dark-primary {
|
|
188
188
|
background-color: $u-type-primary;
|
|
189
|
-
color:
|
|
189
|
+
color: var(--u-white-color);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
.u-mode-dark-success {
|
|
193
193
|
background-color: $u-type-success;
|
|
194
|
-
color:
|
|
194
|
+
color: var(--u-white-color);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
.u-mode-dark-error {
|
|
198
198
|
background-color: $u-type-error;
|
|
199
|
-
color:
|
|
199
|
+
color: var(--u-white-color);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
.u-mode-dark-warning {
|
|
203
203
|
background-color: $u-type-warning;
|
|
204
|
-
color:
|
|
204
|
+
color: var(--u-white-color);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
.u-mode-dark-info {
|
|
208
208
|
background-color: $u-type-info;
|
|
209
|
-
color:
|
|
209
|
+
color: var(--u-white-color);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
.u-mode-plain-primary {
|
|
213
|
-
background-color:
|
|
213
|
+
background-color: var(--u-bg-white);
|
|
214
214
|
color: $u-type-primary;
|
|
215
215
|
border: 1px solid $u-type-primary;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
.u-mode-plain-success {
|
|
219
|
-
background-color:
|
|
219
|
+
background-color: var(--u-bg-white);
|
|
220
220
|
color: $u-type-success;
|
|
221
221
|
border: 1px solid $u-type-success;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
.u-mode-plain-error {
|
|
225
|
-
background-color:
|
|
225
|
+
background-color: var(--u-bg-white);
|
|
226
226
|
color: $u-type-error;
|
|
227
227
|
border: 1px solid $u-type-error;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
.u-mode-plain-warning {
|
|
231
|
-
background-color:
|
|
231
|
+
background-color: var(--u-bg-white);
|
|
232
232
|
color: $u-type-warning;
|
|
233
233
|
border: 1px solid $u-type-warning;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
.u-mode-plain-info {
|
|
237
|
-
background-color:
|
|
237
|
+
background-color: var(--u-bg-white);
|
|
238
238
|
color: $u-type-info;
|
|
239
239
|
border: 1px solid $u-type-info;
|
|
240
240
|
}
|
|
@@ -31,7 +31,7 @@ export const TextProps = {
|
|
|
31
31
|
/** 显示行数,超出省略号 */
|
|
32
32
|
lines: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
33
33
|
/** 文本颜色 */
|
|
34
|
-
color: { type: String, default: '
|
|
34
|
+
color: { type: String, default: 'var(--u-main-color)' },
|
|
35
35
|
/** 字体大小 */
|
|
36
36
|
size: { type: [String, Number] as PropType<string | number>, default: 28 },
|
|
37
37
|
/** 图标样式 */
|
|
@@ -102,7 +102,7 @@ import { $u } from '../../';
|
|
|
102
102
|
* @property {Boolean} bold 是否粗体,默认normal(默认 false )
|
|
103
103
|
* @property {Boolean} block 是否块状(默认 false )
|
|
104
104
|
* @property {String | Number} lines 文本显示的行数,如果设置,超出此行数,将会显示省略号
|
|
105
|
-
* @property {String} color 文本颜色(默认 '
|
|
105
|
+
* @property {String} color 文本颜色(默认 'var(--u-main-color)' )
|
|
106
106
|
* @property {String | Number} size 字体大小(默认 15 )
|
|
107
107
|
* @property {Object | String} iconStyle 图标的样式 (默认 {fontSize: '15px'} )
|
|
108
108
|
* @property {String} decoration 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<text
|
|
43
43
|
class="u-textarea__count"
|
|
44
44
|
:style="{
|
|
45
|
-
'background-color': props.disabled ? 'transparent' : '
|
|
45
|
+
'background-color': props.disabled ? 'transparent' : 'var(--u-bg-white)'
|
|
46
46
|
}"
|
|
47
47
|
v-if="props.count"
|
|
48
48
|
>
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
class="u-textarea__right-icon__clear u-textarea__right-icon__item"
|
|
55
55
|
v-if="clearable && modelValue != '' && !disabled"
|
|
56
56
|
>
|
|
57
|
-
<u-icon size="32" name="close-circle-fill" color="
|
|
57
|
+
<u-icon size="32" name="close-circle-fill" color="var(--u-light-color)" @click="onClear" />
|
|
58
58
|
</view>
|
|
59
59
|
</view>
|
|
60
60
|
</view>
|
|
@@ -285,14 +285,14 @@ defineExpose({
|
|
|
285
285
|
|
|
286
286
|
.u-textarea {
|
|
287
287
|
border-radius: 4px;
|
|
288
|
-
background-color:
|
|
288
|
+
background-color: var(--u-bg-white);
|
|
289
289
|
position: relative;
|
|
290
290
|
@include flex;
|
|
291
291
|
flex: 1;
|
|
292
292
|
|
|
293
293
|
&--border {
|
|
294
294
|
border-radius: 4px;
|
|
295
|
-
border: 1px solid $u-
|
|
295
|
+
border: 1px solid $u-border-color;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
&--error {
|
|
@@ -308,7 +308,7 @@ defineExpose({
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
&--disabled {
|
|
311
|
-
background-color:
|
|
311
|
+
background-color: $u-bg-gray-light;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
&__field {
|
|
@@ -324,7 +324,7 @@ defineExpose({
|
|
|
324
324
|
bottom: 0;
|
|
325
325
|
font-size: 12px;
|
|
326
326
|
color: $u-tips-color;
|
|
327
|
-
background-color:
|
|
327
|
+
background-color: var(--u-bg-white);
|
|
328
328
|
padding: 1px 4px;
|
|
329
329
|
border-radius: 10px;
|
|
330
330
|
line-height: 16px;
|
|
@@ -8,7 +8,7 @@ import { baseProps } from '../common/props';
|
|
|
8
8
|
export const TimeLineItemProps = {
|
|
9
9
|
...baseProps,
|
|
10
10
|
/** 节点的背景颜色 */
|
|
11
|
-
bgColor: { type: String, default: '
|
|
11
|
+
bgColor: { type: String, default: 'var(--u-bg-white)' },
|
|
12
12
|
/** 节点左边图标绝对定位的top值,单位rpx */
|
|
13
13
|
nodeTop: { type: [String, Number] as PropType<string | number>, default: '' }
|
|
14
14
|
};
|
|
@@ -31,14 +31,13 @@ import { $u } from '../../';
|
|
|
31
31
|
* timeLineItem 时间轴Item
|
|
32
32
|
* @description 时间轴组件一般用于物流信息展示,各种跟时间相关的记录等场景。(搭配u-time-line使用)
|
|
33
33
|
* @tutorial https://uviewpro.cn/zh/components/timeLine.html
|
|
34
|
-
* @property {String} bg-color 左边节点的背景颜色,一般通过slot
|
|
34
|
+
* @property {String} bg-color 左边节点的背景颜色,一般通过slot内容自定义背景颜色即可(默认var(--u-bg-white))
|
|
35
35
|
* @property {String | Number} node-top 节点左边图标绝对定位的top值,单位rpx
|
|
36
36
|
* @example <u-time-line-item node-top="2">...</u-time-line-item>
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* 节点的背景颜色
|
|
41
|
-
* @default "#ffffff"
|
|
42
41
|
*/
|
|
43
42
|
const props = defineProps(TimeLineItemProps);
|
|
44
43
|
|
|
@@ -85,6 +84,6 @@ const nodeStyle = computed(() => {
|
|
|
85
84
|
height: 16rpx;
|
|
86
85
|
width: 16rpx;
|
|
87
86
|
border-radius: 100rpx;
|
|
88
|
-
background:
|
|
87
|
+
background: var(--u-divider-color);
|
|
89
88
|
}
|
|
90
89
|
</style>
|
|
@@ -165,9 +165,9 @@ defineExpose<ToastExpose>({
|
|
|
165
165
|
z-index: -1;
|
|
166
166
|
transition: opacity 0.3s;
|
|
167
167
|
text-align: center;
|
|
168
|
-
color:
|
|
168
|
+
color: var(--u-white-color);
|
|
169
169
|
border-radius: 8rpx;
|
|
170
|
-
background:
|
|
170
|
+
background: var(--u-content-color);
|
|
171
171
|
@include vue-flex;
|
|
172
172
|
align-items: center;
|
|
173
173
|
justify-content: center;
|
|
@@ -224,29 +224,29 @@ defineExpose<ToastExpose>({
|
|
|
224
224
|
.u-type-success {
|
|
225
225
|
color: $u-type-success;
|
|
226
226
|
background-color: $u-type-success-light;
|
|
227
|
-
border: 1px solid
|
|
227
|
+
border: 1px solid var(--u-type-success-light);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
.u-type-error {
|
|
231
231
|
color: $u-type-error;
|
|
232
232
|
background-color: $u-type-error-light;
|
|
233
|
-
border: 1px solid
|
|
233
|
+
border: 1px solid var(--u-type-error-light);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
.u-type-warning {
|
|
237
237
|
color: $u-type-warning;
|
|
238
238
|
background-color: $u-type-warning-light;
|
|
239
|
-
border: 1px solid
|
|
239
|
+
border: 1px solid var(--u-type-warning-light);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
.u-type-info {
|
|
243
243
|
color: $u-type-info;
|
|
244
244
|
background-color: $u-type-info-light;
|
|
245
|
-
border: 1px solid
|
|
245
|
+
border: 1px solid var(--u-bg-gray-light);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
.u-type-default {
|
|
249
|
-
color:
|
|
250
|
-
background-color:
|
|
249
|
+
color: var(--u-white-color);
|
|
250
|
+
background-color: var(--u-content-color);
|
|
251
251
|
}
|
|
252
252
|
</style>
|
|
@@ -21,11 +21,11 @@ export const UploadProps = {
|
|
|
21
21
|
/** 是否显示上传进度 */
|
|
22
22
|
showProgress: { type: Boolean, default: true },
|
|
23
23
|
/** 删除按钮背景色 */
|
|
24
|
-
delBgColor: { type: String, default: '
|
|
24
|
+
delBgColor: { type: String, default: 'var(--u-type-error)' },
|
|
25
25
|
/** 删除按钮图标 */
|
|
26
26
|
delIcon: { type: String, default: 'close' },
|
|
27
27
|
/** 删除按钮颜色 */
|
|
28
|
-
delColor: { type: String, default: '
|
|
28
|
+
delColor: { type: String, default: 'var(--u-white-color)' },
|
|
29
29
|
/** 图片裁剪模式 */
|
|
30
30
|
imageMode: { type: String as PropType<ImgMode>, default: 'aspectFill' },
|
|
31
31
|
/** 是否自定义上传按钮 */
|
package/index.scss
CHANGED
package/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { $u, type RequestOptions } from './libs';
|
|
2
|
-
import type { UViewProOptions } from './types/global';
|
|
1
|
+
import { $u, type RequestOptions, initTheme } from './libs';
|
|
2
|
+
import type { UViewProOptions, Theme } from './types/global';
|
|
3
3
|
import { logger } from './libs/util/logger';
|
|
4
|
+
import { defaultThemes } from './libs/config/theme-tokens';
|
|
4
5
|
|
|
5
6
|
declare const uni: {
|
|
6
7
|
[key: string]: any;
|
|
@@ -13,16 +14,46 @@ declare const uni: {
|
|
|
13
14
|
|
|
14
15
|
// $u挂载到uni对象上
|
|
15
16
|
const install = (app: any, options?: UViewProOptions): void => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
try {
|
|
18
|
+
if (options) {
|
|
19
|
+
// 配置主题:统一使用 useTheme 的 initTheme 初始化,避免重复初始化
|
|
20
|
+
if (options.theme) {
|
|
21
|
+
// 如果是数组,则为多主题配置
|
|
22
|
+
// 直接使用 useTheme 的 initTheme,它会智能处理重复初始化
|
|
23
|
+
if (Array.isArray(options.theme)) {
|
|
24
|
+
initTheme(options.theme);
|
|
25
|
+
} else {
|
|
26
|
+
// 兼容之前只有一套样式的情况,需要覆盖默认主题
|
|
27
|
+
// 获取默认主题(uviewpro)
|
|
28
|
+
const defaultTheme = defaultThemes[0];
|
|
29
|
+
if (defaultTheme) {
|
|
30
|
+
// 创建新主题对象,用用户的 theme 覆盖默认主题的 color
|
|
31
|
+
const mergedTheme: Theme = {
|
|
32
|
+
...defaultTheme,
|
|
33
|
+
color: {
|
|
34
|
+
...defaultTheme.color,
|
|
35
|
+
...options.theme
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// 初始化主题(只包含覆盖后的默认主题)
|
|
39
|
+
initTheme([mergedTheme], defaultTheme.name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
// 默认初始化系统主题
|
|
44
|
+
initTheme();
|
|
45
|
+
}
|
|
46
|
+
// 设置调试模式
|
|
47
|
+
logger
|
|
48
|
+
.setDebugMode(options?.log?.debug ?? false)
|
|
49
|
+
.setPrefix(options?.log?.prefix)
|
|
50
|
+
.setShowCallerInfo(options?.log?.showCallerInfo ?? true);
|
|
51
|
+
} else {
|
|
52
|
+
// 默认初始化系统主题
|
|
53
|
+
initTheme();
|
|
20
54
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.setDebugMode(options?.log?.debug ?? true)
|
|
24
|
-
.setPrefix(options?.log?.prefix)
|
|
25
|
-
.setShowCallerInfo(options?.log?.showCallerInfo ?? true);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error('[install options] Error:', error);
|
|
26
57
|
}
|
|
27
58
|
uni.$u = $u;
|
|
28
59
|
// 可扩展更多配置项
|