uview-pro 0.3.16 → 0.4.1

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.
Files changed (140) hide show
  1. package/changelog.md +66 -0
  2. package/components/u-action-sheet-item/u-action-sheet-item.vue +1 -1
  3. package/components/u-alert-tips/u-alert-tips.vue +2 -2
  4. package/components/u-avatar/u-avatar.vue +5 -5
  5. package/components/u-avatar-cropper/u-avatar-cropper.vue +5 -5
  6. package/components/u-avatar-cropper/weCropper.js +1 -1
  7. package/components/u-avatar-cropper/weCropper.ts +1 -1
  8. package/components/u-back-top/types.ts +1 -1
  9. package/components/u-back-top/u-back-top.vue +1 -1
  10. package/components/u-badge/u-badge.vue +1 -31
  11. package/components/u-button/types.ts +1 -1
  12. package/components/u-button/u-button.vue +45 -37
  13. package/components/u-calendar/types.ts +4 -4
  14. package/components/u-calendar/u-calendar.vue +8 -8
  15. package/components/u-car-keyboard/u-car-keyboard.vue +5 -5
  16. package/components/u-card/types.ts +2 -2
  17. package/components/u-card/u-card.vue +3 -3
  18. package/components/u-cell-group/u-cell-group.vue +1 -1
  19. package/components/u-cell-item/u-cell-item.vue +2 -2
  20. package/components/u-checkbox/u-checkbox.vue +7 -7
  21. package/components/u-circle-progress/types.ts +4 -3
  22. package/components/u-circle-progress/u-circle-progress.vue +3 -3
  23. package/components/u-city-select/u-city-select.vue +1 -1
  24. package/components/u-collapse/types.ts +2 -2
  25. package/components/u-collapse/u-collapse.vue +1 -1
  26. package/components/u-collapse-item/u-collapse-item.vue +1 -1
  27. package/components/u-column-notice/u-column-notice.vue +2 -2
  28. package/components/u-config-provider/types.ts +34 -0
  29. package/components/u-config-provider/u-config-provider.vue +141 -0
  30. package/components/u-count-down/types.ts +4 -4
  31. package/components/u-count-down/u-count-down.vue +4 -4
  32. package/components/u-count-to/types.ts +1 -1
  33. package/components/u-count-to/u-count-to.vue +1 -1
  34. package/components/u-divider/types.ts +3 -3
  35. package/components/u-divider/u-divider.vue +4 -4
  36. package/components/u-dropdown/u-dropdown.vue +3 -3
  37. package/components/u-empty/types.ts +2 -2
  38. package/components/u-empty/u-empty.vue +1 -1
  39. package/components/u-field/types.ts +3 -3
  40. package/components/u-field/u-field.vue +6 -6
  41. package/components/u-form-item/u-form-item.vue +1 -1
  42. package/components/u-full-screen/u-full-screen.vue +1 -1
  43. package/components/u-gap/u-gap.vue +2 -2
  44. package/components/u-grid-item/types.ts +1 -1
  45. package/components/u-grid-item/u-grid-item.vue +3 -3
  46. package/components/u-icon/types.ts +2 -2
  47. package/components/u-icon/u-icon.vue +2 -2
  48. package/components/u-image/types.ts +4 -2
  49. package/components/u-image/u-image.vue +7 -2
  50. package/components/u-index-anchor/u-index-anchor.vue +3 -3
  51. package/components/u-index-list/u-index-list.vue +1 -1
  52. package/components/u-input/types.ts +4 -4
  53. package/components/u-input/u-input.vue +7 -7
  54. package/components/u-keyboard/u-keyboard.vue +3 -3
  55. package/components/u-lazy-load/u-lazy-load.vue +1 -1
  56. package/components/u-line/types.ts +1 -1
  57. package/components/u-line/u-line.vue +1 -1
  58. package/components/u-line-progress/types.ts +2 -2
  59. package/components/u-line-progress/u-line-progress.vue +3 -3
  60. package/components/u-link/u-link.vue +1 -1
  61. package/components/u-loading/types.ts +1 -1
  62. package/components/u-loading/u-loading.vue +3 -3
  63. package/components/u-loading-popup/types.ts +1 -1
  64. package/components/u-loading-popup/u-loading-popup.vue +2 -2
  65. package/components/u-loadmore/types.ts +2 -2
  66. package/components/u-loadmore/u-loadmore.vue +6 -6
  67. package/components/u-message-input/u-message-input.vue +5 -5
  68. package/components/u-modal/u-modal.vue +2 -2
  69. package/components/u-navbar/types.ts +4 -4
  70. package/components/u-navbar/u-navbar.vue +27 -20
  71. package/components/u-no-network/u-no-network.vue +2 -2
  72. package/components/u-number-box/types.ts +4 -4
  73. package/components/u-number-box/u-number-box.vue +6 -6
  74. package/components/u-number-keyboard/u-number-keyboard.vue +2 -2
  75. package/components/u-picker/u-picker.vue +4 -4
  76. package/components/u-popup/types.ts +1 -1
  77. package/components/u-popup/u-popup.vue +6 -6
  78. package/components/u-radio/u-radio.vue +7 -7
  79. package/components/u-rate/types.ts +2 -2
  80. package/components/u-rate/u-rate.vue +2 -2
  81. package/components/u-read-more/types.ts +1 -1
  82. package/components/u-row-notice/u-row-notice.vue +2 -2
  83. package/components/u-search/types.ts +4 -4
  84. package/components/u-search/u-search.vue +4 -4
  85. package/components/u-section/types.ts +2 -2
  86. package/components/u-section/u-section.vue +2 -2
  87. package/components/u-select/u-select.vue +6 -6
  88. package/components/u-skeleton/types.ts +2 -2
  89. package/components/u-skeleton/u-skeleton.vue +2 -2
  90. package/components/u-slider/types.ts +1 -1
  91. package/components/u-slider/u-slider.vue +4 -4
  92. package/components/u-step/u-step.vue +4 -4
  93. package/components/u-steps/u-steps.vue +3 -3
  94. package/components/u-sticky/types.ts +1 -1
  95. package/components/u-sticky/u-sticky.vue +1 -1
  96. package/components/u-subsection/types.ts +4 -4
  97. package/components/u-subsection/u-subsection.vue +7 -7
  98. package/components/u-swipe-action/types.ts +1 -1
  99. package/components/u-swipe-action/u-swipe-action.vue +2 -2
  100. package/components/u-swiper/types.ts +1 -1
  101. package/components/u-swiper/u-swiper.vue +1 -1
  102. package/components/u-switch/types.ts +1 -1
  103. package/components/u-switch/u-switch.vue +5 -5
  104. package/components/u-tabbar/types.ts +5 -4
  105. package/components/u-tabbar/u-tabbar.vue +5 -5
  106. package/components/u-table/types.ts +3 -3
  107. package/components/u-table/u-table.vue +3 -3
  108. package/components/u-tabs/types.ts +1 -1
  109. package/components/u-tabs/u-tabs.vue +2 -2
  110. package/components/u-tabs-swiper/types.ts +1 -1
  111. package/components/u-tabs-swiper/u-tabs-swiper.vue +2 -2
  112. package/components/u-tag/u-tag.vue +12 -12
  113. package/components/u-text/types.ts +1 -1
  114. package/components/u-text/u-text.vue +1 -1
  115. package/components/u-textarea/types.ts +1 -1
  116. package/components/u-textarea/u-textarea.vue +6 -6
  117. package/components/u-time-line/u-time-line.vue +1 -1
  118. package/components/u-time-line-item/types.ts +1 -1
  119. package/components/u-time-line-item/u-time-line-item.vue +2 -3
  120. package/components/u-toast/u-toast.vue +8 -8
  121. package/components/u-top-tips/u-top-tips.vue +1 -1
  122. package/components/u-upload/types.ts +2 -2
  123. package/components/u-upload/u-upload.vue +1 -1
  124. package/index.scss +1 -0
  125. package/index.ts +35 -10
  126. package/libs/config/theme-tokens.ts +101 -0
  127. package/libs/css/style.theme.scss +31 -0
  128. package/libs/css/style.vue.scss +1 -1
  129. package/libs/function/clipboard.ts +6 -11
  130. package/libs/function/color.ts +53 -22
  131. package/libs/hooks/index.ts +2 -0
  132. package/libs/hooks/useColor.ts +61 -0
  133. package/libs/hooks/useTheme.ts +162 -0
  134. package/libs/index.ts +4 -3
  135. package/libs/util/config-provider.ts +558 -0
  136. package/libs/util/system-theme.ts +25 -0
  137. package/package.json +107 -107
  138. package/theme.scss +50 -34
  139. package/types/components.d.ts +1 -0
  140. package/types/global.d.ts +47 -2
@@ -103,7 +103,7 @@ const iconStyle = computed(() => {
103
103
 
104
104
  // checkbox内部的勾选图标,如果选中状态,为白色,否则为透明色即可
105
105
  const iconColor = computed(() => {
106
- return props.modelValue ? '#ffffff' : 'transparent';
106
+ return props.modelValue ? 'var(--u-white-color)' : 'transparent';
107
107
  });
108
108
 
109
109
  const iconClass = computed(() => {
@@ -234,7 +234,7 @@ defineExpose({
234
234
  text-align: center;
235
235
  transition-property: color, border-color, background-color;
236
236
  font-size: 20px;
237
- border: 1px solid #c8c9cc;
237
+ border: 1px solid var(--u-border-color);
238
238
  transition-duration: 0.2s;
239
239
 
240
240
  /* #ifdef MP-TOUTIAO */
@@ -252,18 +252,18 @@ defineExpose({
252
252
  }
253
253
 
254
254
  &--checked {
255
- color: #fff;
255
+ color: var(--u-white-color);
256
256
  background-color: $u-type-primary;
257
257
  border-color: $u-type-primary;
258
258
  }
259
259
 
260
260
  &--disabled {
261
- background-color: #ebedf0;
262
- border-color: #c8c9cc;
261
+ background-color: var(--u-bg-gray-light);
262
+ border-color: var(--u-border-color);
263
263
  }
264
264
 
265
265
  &--disabled--checked {
266
- color: #c8c9cc !important;
266
+ color: var(--u-bg-gray-light) !important;
267
267
  }
268
268
  }
269
269
 
@@ -275,7 +275,7 @@ defineExpose({
275
275
  font-size: 30rpx;
276
276
 
277
277
  &--disabled {
278
- color: #c8c9cc;
278
+ color: var(--u-bg-gray-light);
279
279
  }
280
280
  }
281
281
  }
@@ -1,6 +1,7 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { ThemeType } from '../../types/global';
3
3
  import { baseProps } from '../common/props';
4
+ import { $u } from '../../libs';
4
5
 
5
6
  /**
6
7
  * circleProgress 环形进度条 Props
@@ -17,12 +18,12 @@ export const CircleProgressProps = {
17
18
  /** 底部圆环的颜色(灰色的圆环) */
18
19
  inactiveColor: {
19
20
  type: String,
20
- default: '#ececec'
21
+ default: () => $u.getColor('dividerColor')
21
22
  },
22
23
  /** 圆环激活部分的颜色 */
23
24
  activeColor: {
24
25
  type: String,
25
- default: '#19be6b'
26
+ default: 'var(--u-type-success)'
26
27
  },
27
28
  /** 圆环线条的宽度,单位rpx */
28
29
  borderWidth: {
@@ -47,7 +48,7 @@ export const CircleProgressProps = {
47
48
  /** 整个圆环进度区域的背景色 */
48
49
  bgColor: {
49
50
  type: String,
50
- default: '#ffffff'
51
+ default: 'var(--u-bg-white)'
51
52
  }
52
53
  };
53
54
 
@@ -86,14 +86,14 @@ import { canvas2d } from '../../libs/util/canvas-2d';
86
86
  * @description 展示操作或任务的当前进度,比如上传文件,是一个圆形的进度条。注意:此组件的percent值只能动态增加,不能动态减少。
87
87
  * @tutorial https://uviewpro.cn/zh/components/circleProgress.html
88
88
  * @property {String Number} percent 圆环进度百分比值,为数值类型,0-100
89
- * @property {String} inactive-color 圆环的底色,默认为灰色(该值无法动态变更)(默认#ececec
90
- * @property {String} active-color 圆环激活部分的颜色(该值无法动态变更)(默认#19be6b
89
+ * @property {String} inactive-color 圆环的底色,默认为灰色(该值无法动态变更)(默认var(--u-divider-color)
90
+ * @property {String} active-color 圆环激活部分的颜色(该值无法动态变更)(默认var(--u-type-success)
91
91
  * @property {String Number} width 整个圆环组件的宽度,高度默认等于宽度值,单位rpx(默认200)
92
92
  * @property {String Number} border-width 圆环的边框宽度,单位rpx(默认14)
93
93
  * @property {String Number} duration 整个圆环执行一圈的时间,单位ms(默认呢1500)
94
94
  * @property {String} type 如设置,active-color值将会失效
95
95
  * @property {String} bg-color 整个组件背景颜色,默认为白色
96
- * @example <u-circle-progress active-color="#2979ff" :percent="80"></u-circle-progress>
96
+ * @example <u-circle-progress active-color="var(--u-type-primary)" :percent="80"></u-circle-progress>
97
97
  */
98
98
  const props = defineProps(CircleProgressProps);
99
99
 
@@ -8,7 +8,7 @@
8
8
  :mask="true"
9
9
  :closeable="true"
10
10
  :safe-area-inset-bottom="true"
11
- close-icon-color="#ffffff"
11
+ close-icon-color="var(--u-white-color)"
12
12
  :z-index="uZIndex"
13
13
  :maskCloseAble="props.maskCloseAble"
14
14
  @close="close"
@@ -9,7 +9,7 @@ import { baseProps } from '../common/props';
9
9
  * @property {Object} bodyStyle 主体自定义样式,对象形式
10
10
  * @property {Object} itemStyle 每一个item的样式,对象形式
11
11
  * @property {Boolean} arrow 是否显示标题右侧的箭头(默认true)
12
- * @property {String} arrowColor 标题右侧箭头的颜色(默认#909399
12
+ * @property {String} arrowColor 标题右侧箭头的颜色(默认var(--u-tips-color)
13
13
  * @property {String} hoverClass 样式类名,按下时有效(默认u-hover-class)
14
14
  */
15
15
  export const CollapseProps = {
@@ -25,7 +25,7 @@ export const CollapseProps = {
25
25
  /** 是否显示右侧的箭头 */
26
26
  arrow: { type: Boolean, default: true },
27
27
  /** 箭头的颜色 */
28
- arrowColor: { type: String, default: '#909399' },
28
+ arrowColor: { type: String, default: 'var(--u-tips-color)' },
29
29
  /** 标题部分按压时的样式类,"none"为无效果 */
30
30
  hoverClass: { type: String, default: 'u-hover-class' }
31
31
  };
@@ -28,7 +28,7 @@ import { $u, useParent } from '../../';
28
28
  * @tutorial https://uviewpro.cn/zh/components/collapse.html
29
29
  * @property {Boolean} accordion 是否手风琴模式(默认true)
30
30
  * @property {Boolean} arrow 是否显示标题右侧的箭头(默认true)
31
- * @property {String} arrow-color 标题右侧箭头的颜色(默认#909399
31
+ * @property {String} arrow-color 标题右侧箭头的颜色(默认var(--u-tips-color)
32
32
  * @property {Object} head-style 标题自定义样式,对象形式
33
33
  * @property {Object} body-style 主体自定义样式,对象形式
34
34
  * @property {String} hover-class 样式类名,按下时有效(默认u-hover-class)
@@ -132,7 +132,7 @@ function init() {
132
132
  if (parentExposed.value?.props) {
133
133
  headStyle.value = parentExposed.value.props.headStyle || {};
134
134
  bodyStyle.value = parentExposed.value.props.bodyStyle || {};
135
- arrowColor.value = parentExposed.value.props.arrowColor || '#909399';
135
+ arrowColor.value = parentExposed.value.props.arrowColor || 'var(--u-tips-color)';
136
136
  hoverClass.value = parentExposed.value.props.hoverClass || 'u-hover-class';
137
137
  itemStyle.value = parentExposed.value.props.itemStyle || {};
138
138
  }
@@ -110,7 +110,7 @@ const emit = defineEmits<{
110
110
  const computeColor = computed(() => {
111
111
  if (props.color) return props.color;
112
112
  // 如果是无主题,就默认使用content-color
113
- else if (props.type === 'none') return '#606266';
113
+ else if (props.type === 'none') return 'var(--u-content-color)';
114
114
  else return props.type;
115
115
  });
116
116
 
@@ -120,7 +120,7 @@ const computeColor = computed(() => {
120
120
  const textStyle = computed(() => {
121
121
  const style: Record<string, any> = {};
122
122
  if (props.color) style.color = props.color;
123
- else if (props.type === 'none') style.color = '#606266';
123
+ else if (props.type === 'none') style.color = 'var(--u-content-color)';
124
124
  style.fontSize = props.fontSize + 'rpx';
125
125
  return style;
126
126
  });
@@ -0,0 +1,34 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
3
+ import { configProvider } from '../../libs';
4
+ import type { Theme } from '../../types/global';
5
+
6
+ export const ConfigProviderProps = {
7
+ ...baseProps,
8
+ /**
9
+ * 主题风格,可选值:
10
+ * - 'light': 强制亮色模式
11
+ * - 'dark': 强制暗黑模式
12
+ * - 'auto': 自动跟随系统设置(默认)
13
+ */
14
+ darkMode: {
15
+ type: String as PropType<'light' | 'dark' | 'auto'>,
16
+ default: 'auto'
17
+ },
18
+ /**
19
+ * 当前主题名称(用于多主题切换)
20
+ */
21
+ currentTheme: {
22
+ type: String,
23
+ default: () => configProvider.getCurrentTheme()?.name ?? 'uviewpro'
24
+ },
25
+ /**
26
+ * 自定义主题列表
27
+ */
28
+ themes: {
29
+ type: Array as PropType<Theme[]>,
30
+ default: () => configProvider.getThemes()
31
+ }
32
+ };
33
+
34
+ export type ConfigProviderProps = ExtractPropTypes<typeof ConfigProviderProps>;
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <view :class="['u-config-provider', `u-theme-${darkMode}`, customClass]" :style="mergedThemeStyle">
3
+ <slot />
4
+ </view>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ /**
9
+ * u-config-provider
10
+ *
11
+ * 说明(简要):
12
+ * - 初始化场景(推荐在应用入口执行):使用 `useTheme().initTheme(themes)` 进行一次性初始化与全局设置(例如在 `main.ts` 或 `App.vue` 中)。
13
+ * - 组件/页面场景(推荐):使用 `useTheme()` 组合式函数在组件内部读取响应式 `currentTheme`、`themes`、`darkMode` 并通过 `setTheme()` 和 `setDarkMode()` 切换主题/模式。
14
+ *
15
+ * 该组件的行为:
16
+ * - 如果在挂载时传入 `themes`,会调用 `configProvider.init(themes)`
17
+ * - 如果传入 `currentTheme`,会优先设置当前主题
18
+ * - 如果传入 `darkMode`,会设置当前的暗黑模式状态,同时在 document 上添加 `u-theme-dark` 或 `u-theme-light` 类名
19
+ *
20
+ * 详尽说明请参考:`docs/config-provider-usage.md`
21
+ */
22
+ export default {
23
+ name: 'u-config-provider',
24
+ options: {
25
+ addGlobalClass: true,
26
+ // #ifndef MP-TOUTIAO
27
+ virtualHost: true,
28
+ // #endif
29
+ styleIsolation: 'shared'
30
+ }
31
+ };
32
+ </script>
33
+
34
+ <script lang="ts" setup>
35
+ import { computed, watch, onMounted } from 'vue';
36
+ import { ConfigProviderProps } from './types';
37
+ import { $u, configProvider } from '../../libs';
38
+ import { useTheme } from '../../libs/hooks/useTheme';
39
+
40
+ const props = defineProps(ConfigProviderProps);
41
+
42
+ const emit = defineEmits<{
43
+ 'theme-change': [themeName: string];
44
+ 'mode-change': [mode: 'light' | 'dark'];
45
+ }>();
46
+
47
+ // 计算当前的主题模式(亮色/暗黑)
48
+ const darkMode = computed(() => (configProvider.isInDarkMode() ? 'dark' : 'light'));
49
+
50
+ const bootstrapTheme = () => {
51
+ // 如果已经初始化过主题,不再重复初始化,只更新 props 相关配置
52
+ const existingThemes = configProvider.getThemes();
53
+ if (existingThemes.length > 0) {
54
+ // 已初始化,只更新当前主题和暗黑模式
55
+ if (props.currentTheme) {
56
+ configProvider.setTheme(props.currentTheme as string);
57
+ }
58
+ if (props.darkMode) {
59
+ configProvider.setDarkMode(props.darkMode);
60
+ }
61
+ return;
62
+ }
63
+
64
+ // 未初始化,进行初始化
65
+ if (props.themes && props.themes.length) {
66
+ configProvider.init(props.themes, props.currentTheme as any);
67
+ } else {
68
+ // 使用 useTheme 的 initTheme,它会处理默认主题
69
+ const { initTheme } = useTheme();
70
+ initTheme(undefined, props.currentTheme as any);
71
+ }
72
+
73
+ if (props.currentTheme) {
74
+ configProvider.setTheme(props.currentTheme as string);
75
+ }
76
+ if (props.darkMode) {
77
+ configProvider.setDarkMode(props.darkMode);
78
+ }
79
+ };
80
+
81
+ // 当传入自定义 themes 时,初始化全局 configProvider(覆盖已有)
82
+ onMounted(() => {
83
+ bootstrapTheme();
84
+ });
85
+
86
+ // 监听外部 props 变化(如果上层修改 prop)
87
+ watch(
88
+ () => props.themes,
89
+ val => {
90
+ if (val && val.length) {
91
+ configProvider.init(val, props.currentTheme as any);
92
+ }
93
+ },
94
+ { deep: true }
95
+ );
96
+
97
+ watch(
98
+ () => props.currentTheme,
99
+ val => {
100
+ if (val) {
101
+ configProvider.setTheme(val);
102
+ }
103
+ }
104
+ );
105
+
106
+ watch(
107
+ () => props.darkMode,
108
+ val => {
109
+ if (val && val !== configProvider.getDarkMode()) {
110
+ configProvider.setDarkMode(val);
111
+ emit('mode-change', darkMode.value);
112
+ }
113
+ }
114
+ );
115
+
116
+ // 监听全局主题变更并触发事件
117
+ watch(
118
+ () => configProvider.currentThemeRef.value,
119
+ (val, oldVal) => {
120
+ if (val && val.name !== (oldVal as any)?.name) {
121
+ emit('theme-change', val.name);
122
+ }
123
+ },
124
+ { immediate: true }
125
+ );
126
+
127
+ // 监听暗黑模式变更并触发事件
128
+ watch(
129
+ () => configProvider.darkModeRef.value,
130
+ () => {
131
+ emit('mode-change', darkMode.value);
132
+ }
133
+ );
134
+
135
+ // 计算合并样式(作为局部 fallback),configProvider 已经会把变量注入到 document 上
136
+ const mergedThemeStyle = computed(() => {
137
+ return $u.toStyle(configProvider.cssVarsRef.value, props.customStyle);
138
+ });
139
+ </script>
140
+
141
+ <style lang="scss" scoped></style>
@@ -16,19 +16,19 @@ export const CountDownProps = {
16
16
  /** 分隔符的大小,单位rpx */
17
17
  separatorSize: { type: [Number, String] as PropType<number | string>, default: 30 },
18
18
  /** 分隔符颜色 */
19
- separatorColor: { type: String, default: '#303133' },
19
+ separatorColor: { type: String, default: 'var(--u-main-color)' },
20
20
  /** 字体颜色 */
21
- color: { type: String, default: '#303133' },
21
+ color: { type: String, default: 'var(--u-main-color)' },
22
22
  /** 字体大小,单位rpx */
23
23
  fontSize: { type: [Number, String] as PropType<number | string>, default: 30 },
24
24
  /** 背景颜色 */
25
- bgColor: { type: String, default: '#fff' },
25
+ bgColor: { type: String, default: 'var(--u-bg-white)' },
26
26
  /** 数字框高度,单位rpx */
27
27
  height: { type: [Number, String] as PropType<number | string>, default: 'auto' },
28
28
  /** 是否显示数字框 */
29
29
  showBorder: { type: Boolean, default: false },
30
30
  /** 边框颜色 */
31
- borderColor: { type: String, default: '#303133' },
31
+ borderColor: { type: String, default: 'var(--u-main-color)' },
32
32
  /** 是否显示秒 */
33
33
  showSeconds: { type: Boolean, default: true },
34
34
  /** 是否显示分钟 */
@@ -93,13 +93,13 @@ import { $u } from '../../';
93
93
  * @property {Boolean} autoplay 是否自动开始倒计时,如果为false,需手动调用开始方法。见官网说明(默认true)
94
94
  * @property {String} separator 分隔符,colon为英文冒号,zh为中文(默认colon)
95
95
  * @property {String | Number} separator-size 分隔符的字体大小,单位rpx(默认30)
96
- * @property {String} separator-color 分隔符的颜色(默认#303133
96
+ * @property {String} separator-color 分隔符的颜色(默认var(--u-main-color)
97
97
  * @property {String | Number} font-size 倒计时字体大小,单位rpx(默认30)
98
98
  * @property {Boolean} show-border 是否显示倒计时数字的边框(默认false)
99
99
  * @property {Boolean} hide-zero-day 当"天"的部分为0时,隐藏该字段 (默认true)
100
- * @property {String} border-color 数字边框的颜色(默认#303133
101
- * @property {String} bg-color 倒计时数字的背景颜色(默认#ffffff
102
- * @property {String} color 倒计时数字的颜色(默认#303133
100
+ * @property {String} border-color 数字边框的颜色(默认var(--u-main-color)
101
+ * @property {String} bg-color 倒计时数字的背景颜色(默认var(--u-bg-white)
102
+ * @property {String} color 倒计时数字的颜色(默认var(--u-main-color)
103
103
  * @property {String | Number} height 数字高度值(宽度等同此值),设置边框时看情况是否需要设置此值,单位rpx(默认auto)
104
104
  * @property {Boolean} show-days 是否显示倒计时的"天"部分(默认true)
105
105
  * @property {Boolean} show-hours 是否显示倒计时的"时"部分(默认true)
@@ -22,7 +22,7 @@ export const CountToProps = {
22
22
  /** 十进制分割符号 */
23
23
  decimal: { type: [Number, String] as PropType<number | string>, default: '.' },
24
24
  /** 字体颜色 */
25
- color: { type: String, default: '#303133' },
25
+ color: { type: String, default: 'var(--u-main-color)' },
26
26
  /** 字体大小 */
27
27
  fontSize: { type: [Number, String] as PropType<number | string>, default: 50 },
28
28
  /** 是否加粗字体 */
@@ -46,7 +46,7 @@ import { $u } from '../../';
46
46
  * @property {String | Number} decimals 要显示的小数位数,见官网说明(默认0)
47
47
  * @property {Boolean} use-easing 滚动结束时,是否缓动结尾,见官网说明(默认true)
48
48
  * @property {String} separator 千位分隔符,见官网说明
49
- * @property {String} color 字体颜色(默认#303133
49
+ * @property {String} color 字体颜色(默认var(--u-main-color)
50
50
  * @property {String | Number} font-size 字体大小,单位rpx(默认50)
51
51
  * @property {Boolean} bold 字体是否加粗(默认false)
52
52
  * @event {Function} end 数值滚动到目标值时触发
@@ -11,15 +11,15 @@ export const DividerProps = {
11
11
  /** 单一边divider横线的宽度(数值),单位rpx。或者百分比 */
12
12
  halfWidth: { type: [Number, String] as PropType<number | string>, default: 150 },
13
13
  /** divider横线的颜色,如设置 */
14
- borderColor: { type: String, default: '#dcdfe6' },
14
+ borderColor: { type: String, default: 'var(--u-border-color)' },
15
15
  /** 主题色,可以是primary|info|success|warning|error之一值 */
16
16
  type: { type: String as PropType<ThemeType>, default: 'primary' },
17
17
  /** 文字颜色 */
18
- color: { type: String, default: '#909399' },
18
+ color: { type: String, default: 'var(--u-tips-color)' },
19
19
  /** 文字大小,单位rpx */
20
20
  fontSize: { type: [Number, String] as PropType<number | string>, default: 26 },
21
21
  /** 整个divider的背景颜色 */
22
- bgColor: { type: String, default: '#ffffff' },
22
+ bgColor: { type: String, default: 'var(--u-bg-white)' },
23
23
  /** 整个divider的高度单位rpx */
24
24
  height: { type: [Number, String] as PropType<number | string>, default: 'auto' },
25
25
  /** 上边距 */
@@ -60,17 +60,17 @@ import { $u } from '../../';
60
60
  * @description 区隔内容的分割线,一般用于页面底部"没有更多"的提示。
61
61
  * @tutorial https://uviewpro.cn/zh/components/divider.html
62
62
  * @property {String Number} half-width 文字左或右边线条宽度,数值或百分比,数值时单位为rpx
63
- * @property {String} border-color 线条颜色,优先级高于type(默认#dcdfe6
64
- * @property {String} color 文字颜色(默认#909399
63
+ * @property {String} border-color 线条颜色,优先级高于type(默认var(--u-border-color)
64
+ * @property {String} color 文字颜色(默认var(--u-tips-color)
65
65
  * @property {String Number} fontSize 字体大小,单位rpx(默认26)
66
- * @property {String} bg-color 整个divider的背景颜色(默认呢#ffffff
66
+ * @property {String} bg-color 整个divider的背景颜色(默认呢var(--u-bg-white)
67
67
  * @property {String Number} height 整个divider的高度,单位rpx(默认40)
68
68
  * @property {String} type 将线条设置主题色(默认primary)
69
69
  * @property {Boolean} useSlot 是否使用slot传入内容,如果不传入,中间不会有空隙(默认true)
70
70
  * @property {String Number} margin-top 与前一个组件的距离,单位rpx(默认0)
71
71
  * @property {String Number} margin-bottom 与后一个组件的距离,单位rpx(0)
72
72
  * @event {Function} click divider组件被点击时触发
73
- * @example <u-divider color="#fa3534">长河落日圆</u-divider>
73
+ * @example <u-divider color="var(--u-type-error)">长河落日圆</u-divider>
74
74
  */
75
75
  const props = defineProps(DividerProps);
76
76
 
@@ -16,7 +16,7 @@
16
16
  class="u-dropdown__menu__item__text"
17
17
  :style="{
18
18
  color: item.disabled
19
- ? '#c0c4cc'
19
+ ? 'var(--u-light-color)'
20
20
  : index === current || highlightIndex == index
21
21
  ? activeColor
22
22
  : inactiveColor,
@@ -34,7 +34,7 @@
34
34
  :custom-style="{ display: 'flex' }"
35
35
  :name="menuIcon"
36
36
  :size="$u.addUnit(menuIconSize)"
37
- :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"
37
+ :color="index === current || highlightIndex == index ? activeColor : 'var(--u-light-color)'"
38
38
  ></u-icon>
39
39
  </view>
40
40
  </view>
@@ -84,7 +84,7 @@ import { DropdownProps } from './types';
84
84
  * @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
85
85
  * @tutorial https://uviewpro.cn/zh/components/dropdown.html
86
86
  * @property {String} active-color 标题和选项卡选中的颜色(默认主题色primary)
87
- * @property {String} inactive-color 标题和选项卡未选中的颜色(默认#606266
87
+ * @property {String} inactive-color 标题和选项卡未选中的颜色(默认var(--u-content-color)
88
88
  * @property {Boolean} close-on-click-mask 点击遮罩是否关闭菜单(默认true)
89
89
  * @property {Boolean} close-on-click-self 点击当前激活项标题是否关闭菜单(默认true)
90
90
  * @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
@@ -11,9 +11,9 @@ export const EmptyProps = {
11
11
  /** 提示文字 */
12
12
  text: { type: String, default: '' },
13
13
  /** 文字颜色 */
14
- color: { type: String, default: '#c0c4cc' },
14
+ color: { type: String, default: 'var(--u-light-color)' },
15
15
  /** 图标的颜色 */
16
- iconColor: { type: String, default: '#c0c4cc' },
16
+ iconColor: { type: String, default: 'var(--u-light-color)' },
17
17
  /** 图标的大小 */
18
18
  iconSize: { type: [String, Number] as PropType<string | number>, default: 120 },
19
19
  /** 文字大小,单位rpx */
@@ -43,7 +43,7 @@ import { $u } from '../../';
43
43
  * empty 内容为空
44
44
  * @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
45
45
  * @tutorial https://uviewpro.cn/zh/components/empty.html
46
- * @property {String} color 文字颜色(默认#c0c4cc
46
+ * @property {String} color 文字颜色(默认var(--u-light-color)
47
47
  * @property {String} text 文字提示(默认“无内容”)
48
48
  * @property {String} src 自定义图标路径,如定义,mode参数会失效
49
49
  * @property {String Number} font-size 提示文字的大小,单位rpx(默认28)
@@ -28,15 +28,15 @@ export const FieldProps = {
28
28
  labelAlign: { type: String as PropType<InputAlign>, default: 'left' },
29
29
  /** 输入框内容对齐方式(默认left) */
30
30
  inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
31
- /** 左边通过icon配置的图标的颜色(默认#606266) */
32
- iconColor: { type: String, default: '#606266' },
31
+ /** 左边通过icon配置的图标的颜色(默认var(--u-content-color)) */
32
+ iconColor: { type: String, default: 'var(--u-content-color)' },
33
33
  /** 是否自动增高输入区域,type为textarea时有效(默认true) */
34
34
  autoHeight: { type: Boolean, default: true },
35
35
  /** 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息 */
36
36
  errorMessage: { type: [String, Boolean] as PropType<string | boolean>, default: '' },
37
37
  /** 输入框的提示文字 */
38
38
  placeholder: String,
39
- /** placeholder的样式(内联样式,字符串),如"color: #ddd" */
39
+ /** placeholder的样式(内联样式,字符串),如"color: var(--u-divider-color)" */
40
40
  placeholderStyle: String,
41
41
  /** 是否自动获得焦点(默认false) */
42
42
  focus: Boolean,
@@ -74,7 +74,7 @@
74
74
  :size="props.clearSize"
75
75
  v-if="props.clearable && props.modelValue != '' && focused"
76
76
  name="close-circle-fill"
77
- color="#c0c4cc"
77
+ color="var(--u-light-color)"
78
78
  class="u-clear-icon"
79
79
  @click="onClear"
80
80
  />
@@ -83,7 +83,7 @@
83
83
  v-if="props.rightIcon"
84
84
  @click="rightIconClick"
85
85
  :name="props.rightIcon"
86
- color="#c0c4cc"
86
+ color="var(--u-light-color)"
87
87
  :style="[rightIconStyle]"
88
88
  size="26"
89
89
  class="u-arror-right"
@@ -138,11 +138,11 @@ import { $u } from '../..';
138
138
  * @property {String} input-align 输入框内容对齐方式(默认left)
139
139
  * @property {Boolean} border-bottom 是否显示field的下边框(默认true)
140
140
  * @property {Boolean} border-top 是否显示field的上边框(默认false)
141
- * @property {String} icon-color 左边通过icon配置的图标的颜色(默认#606266
141
+ * @property {String} icon-color 左边通过icon配置的图标的颜色(默认var(--u-content-color)
142
142
  * @property {Boolean} auto-height 是否自动增高输入区域,type为textarea时有效(默认true)
143
143
  * @property {String Boolean} error-message 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
144
144
  * @property {String} placeholder 输入框的提示文字
145
- * @property {String} placeholder-style placeholder的样式(内联样式,字符串),如"color: #ddd"
145
+ * @property {String} placeholder-style placeholder的样式(内联样式,字符串),如"color: var(--u-divider-color)"
146
146
  * @property {Boolean} focus 是否自动获得焦点(默认false)
147
147
  * @property {Boolean} fixed 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false)
148
148
  * @property {Boolean} disabled 是否不可输入(默认false)
@@ -171,11 +171,11 @@ const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'confirm', 'righ
171
171
  * @property {number|string} labelWidth label的宽度,单位rpx(默认130)
172
172
  * @property {string} labelAlign label的文字对齐方式(默认left)
173
173
  * @property {string} inputAlign 输入框内容对齐方式(默认left)
174
- * @property {string} iconColor 左边通过icon配置的图标的颜色(默认#606266
174
+ * @property {string} iconColor 左边通过icon配置的图标的颜色(默认var(--u-content-color)
175
175
  * @property {boolean} autoHeight 是否自动增高输入区域,type为textarea时有效(默认true)
176
176
  * @property {string|boolean} errorMessage 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
177
177
  * @property {string} placeholder 输入框的提示文字
178
- * @property {string} placeholderStyle placeholder的样式(内联样式,字符串),如"color: #ddd"
178
+ * @property {string} placeholderStyle placeholder的样式(内联样式,字符串),如"color: var(--u-divider-color)"
179
179
  * @property {boolean} focus 是否自动获得焦点(默认false)
180
180
  * @property {boolean} fixed 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false)
181
181
  * @property {boolean} disabled 是否不可输入(默认false)
@@ -390,7 +390,7 @@ defineExpose({
390
390
  font-size: 28rpx;
391
391
  color: $u-main-color;
392
392
  box-sizing: border-box;
393
- // line-height: $u-form-item-height;
393
+ // line-height: 70rpx;
394
394
  flex-direction: column;
395
395
 
396
396
  &__border-bottom--error:after {
@@ -91,7 +91,7 @@ function closeModal() {
91
91
  @import '../../libs/css/style.components.scss';
92
92
 
93
93
  .u-full-content {
94
- background-color: #00c777;
94
+ background-color: var(--u-type-success);
95
95
  }
96
96
 
97
97
  .u-update-content {
@@ -24,11 +24,11 @@ import { $u } from '../../';
24
24
  * gap 间隔槽
25
25
  * @description 该组件一般用于内容块之间的用一个灰色块隔开的场景,方便用户风格统一,减少工作量
26
26
  * @tutorial https://uviewpro.cn/zh/components/gap.html
27
- * @property {String} bg-color 背景颜色(默认#f3f4f6
27
+ * @property {String} bg-color 背景颜色(默认var(--u-bg-color)
28
28
  * @property {String Number} height 分割槽高度,单位rpx(默认30)
29
29
  * @property {String Number} margin-top 与前一个组件的距离,单位rpx(默认0)
30
30
  * @property {String Number} margin-bottom 与后一个组件的距离,单位rpx(0)
31
- * @example <u-gap height="80" bg-color="#bbb"></u-gap>
31
+ * @example <u-gap height="80" bg-color="var(--u-light-color)"></u-gap>
32
32
  */
33
33
  const props = defineProps(GapProps);
34
34
 
@@ -8,7 +8,7 @@ import { baseProps } from '../common/props';
8
8
  export const GridItemProps = {
9
9
  ...baseProps,
10
10
  /** 背景颜色 */
11
- bgColor: { type: String, default: '#ffffff' },
11
+ bgColor: { type: String, default: 'var(--u-bg-white)' },
12
12
  /** 点击时返回的index */
13
13
  index: { type: [Number, String] as PropType<string | number>, default: '' }
14
14
  };
@@ -43,7 +43,7 @@ import { $u, useChildren } from '../..';
43
43
  * gridItem 宫格项
44
44
  * @description 宫格组件一般用于同时展示多个同类项目的场景,可以给宫格的项目设置徽标组件(badge),或者图标等,也可以扩展为左右滑动的轮播形式。搭配u-grid使用
45
45
  * @tutorial https://uviewpro.cn/zh/components/grid.html
46
- * @property {String} bg-color 宫格的背景颜色(默认#ffffff
46
+ * @property {String} bg-color 宫格的背景颜色(默认var(--u-bg-white)
47
47
  * @property {String|Number} index 点击宫格时,返回的值
48
48
  * @property {Object} custom-style 自定义样式,对象形式
49
49
  * @event {Function} click 点击宫格触发
@@ -88,7 +88,7 @@ defineExpose({ click });
88
88
 
89
89
  .u-grid-item {
90
90
  box-sizing: border-box;
91
- background: #fff;
91
+ background-color: var(--u-bg-white);
92
92
  @include vue-flex;
93
93
  align-items: center;
94
94
  justify-content: center;
@@ -102,7 +102,7 @@ defineExpose({ click });
102
102
  }
103
103
 
104
104
  .u-grid-item-hover {
105
- background: #f7f7f7 !important;
105
+ background: var(--u-bg-gray-light) !important;
106
106
  }
107
107
 
108
108
  .u-grid-marker-box {