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
@@ -28,7 +28,7 @@ export const IconProps = {
28
28
  /** label的大小,单位rpx(默认28) */
29
29
  labelSize: { type: [String, Number] as PropType<string | number>, default: '28' },
30
30
  /** label的颜色 */
31
- labelColor: { type: String, default: '#606266' },
31
+ labelColor: { type: String, default: 'var(--u-content-color)' },
32
32
  /** label与图标的距离(横向排列),单位rpx(默认6) */
33
33
  marginLeft: { type: [String, Number] as PropType<string | number>, default: '6' },
34
34
  /** label与图标的距离(竖向排列),单位rpx(默认6) */
@@ -50,7 +50,7 @@ export const IconProps = {
50
50
  /** 是否为DecimalIcon */
51
51
  showDecimalIcon: { type: Boolean, default: false },
52
52
  /** 背景颜色,可接受主题色,仅Decimal时有效 */
53
- inactiveColor: { type: String, default: '#ececec' },
53
+ inactiveColor: { type: String, default: 'var(--u-divider-color)' },
54
54
  /** 显示的百分比,仅Decimal时有效 */
55
55
  percent: { type: [Number, String] as PropType<string | number>, default: '50' }
56
56
  };
@@ -51,7 +51,7 @@ import { IconProps } from './types';
51
51
  * @property {String | Number} label-size label字体大小,单位rpx(默认28)
52
52
  * @property {String} label 图标右侧的label文字(默认28)
53
53
  * @property {String} label-pos label文字相对于图标的位置,只能right或bottom(默认right)
54
- * @property {String} label-color label字体颜色(默认#606266
54
+ * @property {String} label-color label字体颜色(默认var(--u-content-color)
55
55
  * @property {Object} custom-style icon的样式,对象形式
56
56
  * @property {String} custom-prefix 自定义字体图标库时,需要写上此值
57
57
  * @property {String | Number} margin-left label在右侧时与图标的距离,单位rpx(默认6)
@@ -69,7 +69,7 @@ import { IconProps } from './types';
69
69
  * @property {String | Number} percent 显示的百分比,仅Decimal时有效
70
70
  * @event {Function} click 点击图标时触发
71
71
  * @event {Function} touchstart 图标触摸时触发
72
- * @example <u-icon name="photo" color="#2979ff" size="28"></u-icon>
72
+ * @example <u-icon name="photo" color="var(--u-type-primary)" size="28"></u-icon>
73
73
  */
74
74
 
75
75
  const emit = defineEmits<{
@@ -1,8 +1,10 @@
1
1
  import { type ComponentPublicInstance, type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { ImgMode, Shape } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  // 定义 ImageProps 的类型
5
6
  export const ImageProps = {
7
+ ...baseProps,
6
8
  /** 图片地址 */
7
9
  src: { type: String, default: '' },
8
10
  /** 裁剪模式 */
@@ -33,8 +35,8 @@ export const ImageProps = {
33
35
  webp: { type: Boolean, default: false },
34
36
  /** 搭配fade参数的过渡时间,单位ms(默认 500) */
35
37
  duration: { type: [String, Number], default: 500 },
36
- /** 背景颜色,用于深色页面加载图片时,为了和背景色融合(默认 #f3f4f6) */
37
- bgColor: { type: String, default: '#f3f4f6' },
38
+ /** 背景颜色,用于深色页面加载图片时,为了和背景色融合(默认 var(--u-bg-color)) */
39
+ bgColor: { type: String, default: 'var(--u-bg-color)' },
38
40
  /** 使用插槽名称对象,用于自定义插槽,默认 undefined,当动态切换slot隐藏时,需要使用useSlots使用,兼容头条小程序 */
39
41
  useSlots: { type: Object as PropType<Record<string, boolean>>, default: undefined }
40
42
  };
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <view class="u-image" @tap="onClick" :style="[wrapStyle, backgroundStyle]">
2
+ <view
3
+ class="u-image"
4
+ @tap="onClick"
5
+ :style="$u.toStyle(wrapStyle, backgroundStyle, customStyle)"
6
+ :class="customClass"
7
+ >
3
8
  <image
4
9
  v-if="!isError"
5
10
  :src="src"
@@ -67,7 +72,7 @@ import { $u } from '../..';
67
72
  * @property {Boolean} fade 是否需要淡入效果(默认 true)
68
73
  * @property {Boolean} webp 只支持网络资源,只对微信小程序有效(默认 false)
69
74
  * @property {String | Number} duration 搭配fade参数的过渡时间,单位ms(默认 500)
70
- * @property {String} bg-color 背景颜色,用于深色页面加载图片时,为了和背景色融合(默认 #f3f4f6
75
+ * @property {String} bg-color 背景颜色,用于深色页面加载图片时,为了和背景色融合(默认 var(--u-bg-color)
71
76
  * @event {Function} click 点击图片时触发
72
77
  * @event {Function} error 图片加载失败时触发
73
78
  * @event {Function} load 图片加载成功时触发
@@ -103,18 +103,18 @@ defineExpose({
103
103
  .u-index-anchor {
104
104
  box-sizing: border-box;
105
105
  padding: 14rpx 24rpx;
106
- color: #606266;
106
+ color: var(--u-content-color);
107
107
  width: 100%;
108
108
  font-weight: 500;
109
109
  font-size: 28rpx;
110
110
  line-height: 1.2;
111
- background-color: rgb(245, 245, 245);
111
+ background-color: $u-bg-color;
112
112
  }
113
113
 
114
114
  .u-index-anchor--active {
115
115
  right: 0;
116
116
  left: 0;
117
117
  color: $u-type-primary;
118
- background-color: #fff;
118
+ background-color: var(--u-bg-white);
119
119
  }
120
120
  </style>
@@ -331,7 +331,7 @@ defineExpose({
331
331
  margin-top: -60rpx;
332
332
  border-radius: 24rpx;
333
333
  font-size: 50rpx;
334
- color: #fff;
334
+ color: var(--u-white-color);
335
335
  background-color: rgba(0, 0, 0, 0.65);
336
336
  @include vue-flex;
337
337
  justify-content: center;
@@ -44,10 +44,10 @@ export const InputProps = {
44
44
  type: Boolean,
45
45
  default: false
46
46
  },
47
- /** placeholder的样式,字符串形式,如"color: red;"(默认 "color: #c0c4cc;") */
47
+ /** placeholder的样式,字符串形式,如"color: red;"(默认 "color: var(--u-light-color);") */
48
48
  placeholderStyle: {
49
49
  type: String,
50
- default: 'color: #c0c4cc;'
50
+ default: 'color: var(--u-light-color);'
51
51
  },
52
52
  /** 设置键盘右下角按钮的文字,仅在type为text时生效(默认done) */
53
53
  confirmType: {
@@ -74,10 +74,10 @@ export const InputProps = {
74
74
  type: Boolean,
75
75
  default: false
76
76
  },
77
- /** 输入框的边框颜色(默认#dcdfe6) */
77
+ /** 输入框的边框颜色(默认var(--u-border-color)) */
78
78
  borderColor: {
79
79
  type: String,
80
- default: '#dcdfe6'
80
+ default: 'var(--u-border-color)'
81
81
  },
82
82
  /** 是否自动增高输入区域,type为textarea时有效(默认true) */
83
83
  autoHeight: {
@@ -65,7 +65,7 @@
65
65
  class="u-input__right-icon__clear u-input__right-icon__item"
66
66
  v-if="clearable && modelValue != '' && !disabled"
67
67
  >
68
- <u-icon size="32" name="close-circle-fill" color="#c0c4cc" @click="onClear" />
68
+ <u-icon size="32" name="close-circle-fill" color="var(--u-light-color)" @click="onClear" />
69
69
  </view>
70
70
  <view
71
71
  class="u-input__right-icon__clear u-input__right-icon__item"
@@ -74,7 +74,7 @@
74
74
  <u-icon
75
75
  size="32"
76
76
  :name="!showPassword ? 'eye' : 'eye-fill'"
77
- color="#c0c4cc"
77
+ color="var(--u-light-color)"
78
78
  @click="showPassword = !showPassword"
79
79
  />
80
80
  </view>
@@ -85,13 +85,13 @@
85
85
  'u-input__right-icon--select--reverse': selectOpen
86
86
  }"
87
87
  >
88
- <u-icon name="arrow-down-fill" size="26" color="#c0c4cc"></u-icon>
88
+ <u-icon name="arrow-down-fill" size="26" color="var(--u-light-color)"></u-icon>
89
89
  </view>
90
90
  </view>
91
91
  <text
92
92
  class="u-input__count"
93
93
  :style="{
94
- 'background-color': props.disabled ? 'transparent' : '#fff'
94
+ 'background-color': props.disabled ? 'transparent' : 'var(--u-bg-white)'
95
95
  }"
96
96
  v-if="props.type === 'textarea' && props.count"
97
97
  >
@@ -256,7 +256,7 @@ defineExpose({
256
256
  @include vue-flex;
257
257
 
258
258
  &__input {
259
- //height: $u-form-item-height;
259
+ //height: 70rpx;
260
260
  font-size: 28rpx;
261
261
  color: $u-main-color;
262
262
  flex: 1;
@@ -277,7 +277,7 @@ defineExpose({
277
277
  bottom: 0;
278
278
  font-size: 12px;
279
279
  color: $u-tips-color;
280
- background-color: #ffffff;
280
+ background-color: var(--u-bg-white);
281
281
  padding: 1px 4px;
282
282
  border-radius: 10px;
283
283
  line-height: 16px;
@@ -285,7 +285,7 @@ defineExpose({
285
285
 
286
286
  &--border {
287
287
  border-radius: 4px;
288
- border: 1px solid $u-form-item-border-color;
288
+ border: 1px solid $u-border-color;
289
289
  }
290
290
 
291
291
  &--error {
@@ -145,7 +145,7 @@ function backspace() {
145
145
  }
146
146
 
147
147
  .u-tooltip-item {
148
- color: #333333;
148
+ color: var(--u-main-color);
149
149
  flex: 0 0 33.333333%;
150
150
  text-align: center;
151
151
  padding: 20rpx 10rpx;
@@ -165,7 +165,7 @@ function backspace() {
165
165
  flex-grow: 1;
166
166
  flex-wrap: 0;
167
167
  padding-left: 40rpx;
168
- color: #888888;
168
+ color: var(--u-tips-color);
169
169
  }
170
170
 
171
171
  .u-tooltips-submit-hover {
@@ -173,6 +173,6 @@ function backspace() {
173
173
  }
174
174
 
175
175
  .u-tooltip-cancel-hover {
176
- color: #333333;
176
+ color: var(--u-main-color);
177
177
  }
178
178
  </style>
@@ -229,7 +229,7 @@ onMounted(() => {
229
229
  @import '../../libs/css/style.components.scss';
230
230
 
231
231
  .u-wrap {
232
- background-color: #eee;
232
+ background-color: var(--u-divider-color);
233
233
  overflow: hidden;
234
234
  }
235
235
 
@@ -9,7 +9,7 @@ export const LineProps = {
9
9
  /** 线条的颜色 */
10
10
  color: {
11
11
  type: String,
12
- default: '#e4e7ed'
12
+ default: 'var(--u-border-color)'
13
13
  },
14
14
  /** 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带rpx单位的值等 */
15
15
  length: {
@@ -24,7 +24,7 @@ import { LineProps } from './types';
24
24
  * line 线条
25
25
  * @description 此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单
26
26
  * @tutorial https://uviewpro.cn/zh/components/line.html
27
- * @property {String} color 线条的颜色(默认#e4e7ed)
27
+ * @property {String} color 线条的颜色(默认var(--u-border-color))
28
28
  * @property {String} length 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带rpx单位的值等
29
29
  * @property {String} direction 线条的方向,row-横向,col-竖向(默认row)
30
30
  * @property {String} border-style 线条的类型,solid-实线,dashed-方形虚线,dotted-圆点虚线(默认solid)
@@ -18,12 +18,12 @@ export const LineProgressProps = {
18
18
  /** 激活部分的颜色 */
19
19
  activeColor: {
20
20
  type: String,
21
- default: '#19be6b'
21
+ default: 'var(--u-type-success)'
22
22
  },
23
23
  /** 进度条的底色 */
24
24
  inactiveColor: {
25
25
  type: String,
26
- default: '#ececec'
26
+ default: 'var(--u-divider-color)'
27
27
  },
28
28
  /** 进度百分比,数值 */
29
29
  percent: {
@@ -48,8 +48,8 @@ import { LineProgressProps } from './types';
48
48
  * @property {String Number} percent 进度条百分比值,为数值类型,0-100
49
49
  * @property {Boolean} round 进度条两端是否为半圆(默认true)
50
50
  * @property {String} type 如设置,active-color值将会失效
51
- * @property {String} active-color 进度条激活部分的颜色(默认#19be6b
52
- * @property {String} inactive-color 进度条的底色(默认#ececec
51
+ * @property {String} active-color 进度条激活部分的颜色(默认var(--u-type-success)
52
+ * @property {String} inactive-color 进度条的底色(默认var(--u-divider-color)
53
53
  * @property {Boolean} show-percent 是否在进度条内部显示当前的百分比值数值(默认true)
54
54
  * @property {String Number} height 进度条的高度,单位rpx(默认28)
55
55
  * @property {Boolean} striped 是否显示进度条激活部分的条纹(默认false)
@@ -92,7 +92,7 @@ const progressStyle = computed(() => {
92
92
  justify-items: flex-end;
93
93
  justify-content: space-around;
94
94
  font-size: 20rpx;
95
- color: #ffffff;
95
+ color: var(--u-white-color);
96
96
  transition: all 0.4s ease;
97
97
  }
98
98
 
@@ -34,7 +34,7 @@ import { LinkProps } from './types';
34
34
  * link 超链接
35
35
  * @description 该组件为超链接组件,在不同平台有不同表现形式:在APP平台会通过plus环境打开内置浏览器,在小程序中把链接复制到粘贴板,同时提示信息,在H5中通过window.open打开链接。
36
36
  * @tutorial https://uviewpro.cn/zh/components/link.html
37
- * @property {String} color 文字颜色(默认#606266
37
+ * @property {String} color 文字颜色(默认var(--u-content-color)
38
38
  * @property {String Number} font-size 字体大小,单位rpx(默认28)
39
39
  * @property {Boolean} under-line 是否显示下划线(默认false)
40
40
  * @property {String} href 跳转的链接,要带上http(s)
@@ -15,7 +15,7 @@ export const LoadingProps = {
15
15
  /** 动画的颜色 */
16
16
  color: {
17
17
  type: String,
18
- default: '#c7c7c7'
18
+ default: 'var(--u-light-color)'
19
19
  },
20
20
  /** 加载图标的大小,单位rpx */
21
21
  size: {
@@ -30,7 +30,7 @@ import { LoadingProps } from './types';
30
30
  * @description 此组件为一个小动画,目前用在uView的loadmore加载更多和switch开关等组件的正在加载状态场景。
31
31
  * @tutorial https://uviewpro.cn/zh/components/loading.html
32
32
  * @property {String} mode 模式选择,见官网说明(默认circle)
33
- * @property {String} color 动画活动区域的颜色,只对 mode = flower 模式有效(默认#c7c7c7
33
+ * @property {String} color 动画活动区域的颜色,只对 mode = flower 模式有效(默认var(--u-light-color)
34
34
  * @property {String|Number} size 加载图标的大小,单位rpx(默认34)
35
35
  * @property {Boolean} show 是否显示动画(默认true)
36
36
  * @example <u-loading mode="circle"></u-loading>
@@ -47,7 +47,7 @@ const cricleStyle = computed(() => {
47
47
  style.height = props.size + 'rpx';
48
48
  // 只对圆圈模式生效
49
49
  if (props.mode === 'circle') {
50
- style.borderColor = `#e4e4e4 #e4e4e4 #e4e4e4 ${props.color ? props.color : '#c7c7c7'}`;
50
+ style.borderColor = `var(--u-divider-color) var(--u-divider-color) var(--u-divider-color) ${props.color ? props.color : 'var(--u-light-color)'}`;
51
51
  }
52
52
  return style;
53
53
  });
@@ -66,7 +66,7 @@ const cricleStyle = computed(() => {
66
66
  background: 0 0;
67
67
  border-radius: 50%;
68
68
  border: 2px solid;
69
- border-color: #e5e5e5 #e5e5e5 #e5e5e5 #8f8d8e;
69
+ border-color: var(--u-divider-color) var(--u-divider-color) var(--u-divider-color) var(--u-tips-color);
70
70
  animation: u-circle 1s linear infinite;
71
71
  }
72
72
 
@@ -18,7 +18,7 @@ export const LoadingPopupProps = {
18
18
  /** 动画的类型 */
19
19
  mode: { type: String as PropType<LoadingMode>, default: 'circle' },
20
20
  /** 动画的颜色 */
21
- color: { type: String, default: '#c7c7c7' },
21
+ color: { type: String, default: 'var(--u-light-color)' },
22
22
  /** 加载图标的大小,单位rpx */
23
23
  size: { type: [String, Number] as PropType<string | number>, default: '48' }
24
24
  };
@@ -215,7 +215,7 @@ defineExpose({
215
215
  transform: translate(-50%, -50%);
216
216
  z-index: 9999;
217
217
  font-size: 30rpx;
218
- color: #fff;
218
+ color: var(--u-white-color);
219
219
  background: rgba(0, 0, 0, 0.7);
220
220
  border-radius: 7px;
221
221
 
@@ -223,7 +223,7 @@ defineExpose({
223
223
  position: absolute;
224
224
  top: 4rpx;
225
225
  right: 2rpx;
226
- color: #ffffff;
226
+ color: var(--u-white-color);
227
227
  opacity: 0.8;
228
228
  }
229
229
 
@@ -25,7 +25,7 @@ export const LoadmoreProps = {
25
25
  /** 字体颜色 */
26
26
  color: {
27
27
  type: String,
28
- default: '#606266'
28
+ default: 'var(--u-content-color)'
29
29
  },
30
30
  /** 组件状态,loadmore-加载前,loading-加载中,nomore-没有更多 */
31
31
  status: {
@@ -54,7 +54,7 @@ export const LoadmoreProps = {
54
54
  /** 加载中显示圆圈动画时,动画的颜色 */
55
55
  iconColor: {
56
56
  type: String,
57
- default: '#b7b7b7'
57
+ default: 'var(--u-light-color)'
58
58
  },
59
59
  /** 上边距 */
60
60
  marginTop: {
@@ -8,7 +8,7 @@
8
8
  height: $u.addUnit(props.height)
9
9
  }"
10
10
  >
11
- <u-line color="#d4d4d4" length="50"></u-line>
11
+ <u-line color="var(--u-divider-color)" length="50"></u-line>
12
12
  <!-- 加载中和没有更多的状态才显示两边的横线 -->
13
13
  <view :class="props.status == 'loadmore' || props.status == 'nomore' ? 'u-more' : ''" class="u-load-more-inner">
14
14
  <view class="u-loadmore-icon-wrap">
@@ -29,7 +29,7 @@
29
29
  {{ showText }}
30
30
  </view>
31
31
  </view>
32
- <u-line color="#d4d4d4" length="50"></u-line>
32
+ <u-line color="var(--u-divider-color)" length="50"></u-line>
33
33
  </view>
34
34
  </template>
35
35
 
@@ -56,12 +56,12 @@ import { LoadmoreProps } from './types';
56
56
  * @description 此组件一般用于标识页面底部加载数据时的状态。
57
57
  * @tutorial https://uviewpro.cn/zh/components/loadMore.html
58
58
  * @property {String} status 组件状态(默认loadmore)
59
- * @property {String} bg-color 组件背景颜色,在页面是非白色时会用到(默认#ffffff
59
+ * @property {String} bg-color 组件背景颜色,在页面是非白色时会用到(默认var(--u-bg-white)
60
60
  * @property {Boolean} icon 加载中时是否显示图标(默认true)
61
61
  * @property {String} icon-type 加载中时的图标类型(默认circle)
62
- * @property {String} icon-color icon-type为circle时有效,加载中的动画图标的颜色(默认#b7b7b7
62
+ * @property {String} icon-color icon-type为circle时有效,加载中的动画图标的颜色(默认var(--u-light-color)
63
63
  * @property {Boolean} is-dot status为nomore时,内容显示为一个"●"(默认false)
64
- * @property {String} color 字体颜色(默认#606266
64
+ * @property {String} color 字体颜色(默认var(--u-content-color)
65
65
  * @property {String|Number} margin-top 到上一个相邻元素的距离
66
66
  * @property {String|Number} margin-bottom 到下一个相邻元素的距离
67
67
  * @property {Object} load-text 自定义显示的文字,见上方说明示例
@@ -89,7 +89,7 @@ const loadTextStyle = computed(() => {
89
89
  // 加载中圆圈动画的样式
90
90
  const cricleStyle = computed(() => {
91
91
  return {
92
- borderColor: `#e5e5e5 #e5e5e5 #e5e5e5 ${props.iconColor}`
92
+ borderColor: `var(--u-divider-color) var(--u-divider-color) var(--u-divider-color) ${props.iconColor}`
93
93
  };
94
94
  });
95
95
 
@@ -101,7 +101,7 @@ import { $u } from '../../';
101
101
  * @property {Boolean} bold 字体和输入横线是否加粗(默认true)
102
102
  * @property {String|Number} font-size 字体大小,单位rpx(默认60)
103
103
  * @property {String} active-color 当前激活输入框的样式(默认主题色primary)
104
- * @property {String} inactive-color 非激活输入框的样式,文字颜色同此值(默认#606266
104
+ * @property {String} inactive-color 非激活输入框的样式,文字颜色同此值(默认var(--u-content-color)
105
105
  * @property {String|Number} width 输入框宽度,单位rpx,高等于宽(默认80)
106
106
  * @property {Boolean} disabled-keyboard 禁止点击输入框唤起系统键盘(默认false)
107
107
  * @event {Function} change 输入内容发生改变时触发,具体见官网说明
@@ -210,7 +210,7 @@ function getVal(e: { detail: { value: string } }) {
210
210
 
211
211
  .u-box {
212
212
  box-sizing: border-box;
213
- border: 2rpx solid #cccccc;
213
+ border: 2rpx solid var(--u-light-color);
214
214
  border-radius: 6rpx;
215
215
  }
216
216
 
@@ -241,7 +241,7 @@ function getVal(e: { detail: { value: string } }) {
241
241
  transform: translate(-50%, -50%);
242
242
  width: 2rpx;
243
243
  height: 40rpx;
244
- background: #333333;
244
+ background: var(--u-main-color);
245
245
  animation: twinkling 1.5s infinite ease;
246
246
  }
247
247
 
@@ -256,7 +256,7 @@ function getVal(e: { detail: { value: string } }) {
256
256
 
257
257
  .u-middle-line {
258
258
  height: 4px;
259
- background: #000000;
259
+ background: var(--u-bg-black);
260
260
  width: 80%;
261
261
  position: absolute;
262
262
  border-radius: 2px;
@@ -271,7 +271,7 @@ function getVal(e: { detail: { value: string } }) {
271
271
 
272
272
  .u-bottom-line {
273
273
  height: 4px;
274
- background: #000000;
274
+ background: var(--u-bg-black);
275
275
  width: 80%;
276
276
  position: absolute;
277
277
  border-radius: 2px;
@@ -87,7 +87,7 @@ import { ModalProps } from './types';
87
87
  * @property {Boolean} mask-close-able 是否允许点击遮罩关闭modal(默认false)
88
88
  * @property {String} confirm-text 确认按钮的文字内容(默认"确认")
89
89
  * @property {String} cancel-text 取消按钮的文字内容(默认"取消")
90
- * @property {String} cancel-color 取消按钮的颜色(默认"#606266")
90
+ * @property {String} cancel-color 取消按钮的颜色(默认"var(--u-content-color)")
91
91
  * @property {String} confirm-color 确认按钮的文字内容(默认主题色primary)
92
92
  * @property {String | Number} border-radius 模态框圆角值,单位rpx(默认16)
93
93
  * @property {Object} title-style 自定义标题样式,对象形式
@@ -180,7 +180,7 @@ defineExpose({
180
180
  height: auto;
181
181
  overflow: hidden;
182
182
  font-size: 32rpx;
183
- background-color: #fff;
183
+ background-color: var(--u-bg-white);
184
184
 
185
185
  &__btn--hover {
186
186
  background-color: rgb(230, 230, 230);
@@ -13,7 +13,7 @@ export const NavbarProps = {
13
13
  /** 返回箭头的颜色 */
14
14
  backIconColor: {
15
15
  type: String,
16
- default: '#606266'
16
+ default: 'var(--u-content-color)'
17
17
  },
18
18
  /** 左边返回的图标 */
19
19
  backIconName: {
@@ -33,7 +33,7 @@ export const NavbarProps = {
33
33
  /** 返回的文字的 样式 */
34
34
  backTextStyle: {
35
35
  type: Object as PropType<Record<string, any>>,
36
- default: () => ({ color: '#606266' })
36
+ default: () => ({ color: 'var(--u-content-color)' })
37
37
  },
38
38
  /** 导航栏标题 */
39
39
  title: {
@@ -48,7 +48,7 @@ export const NavbarProps = {
48
48
  /** 标题的颜色 */
49
49
  titleColor: {
50
50
  type: String,
51
- default: '#606266'
51
+ default: 'var(--u-content-color)'
52
52
  },
53
53
  /** 标题字体是否加粗 */
54
54
  titleBold: {
@@ -68,7 +68,7 @@ export const NavbarProps = {
68
68
  /** 导航栏背景设置 */
69
69
  background: {
70
70
  type: Object as PropType<Record<string, any>>,
71
- default: () => ({ background: '#ffffff' })
71
+ default: () => ({ background: 'var(--u-bg-white)' })
72
72
  },
73
73
  /** 导航栏是否固定在顶部 */
74
74
  isFixed: {
@@ -46,7 +46,7 @@
46
46
  <view
47
47
  class="u-navbar-placeholder"
48
48
  v-if="props.isFixed && !props.immersive"
49
- :style="{ width: '100%', height: Number(navbarHeight) + Number(statusBarHeight) + 'px' }"
49
+ :style="{ width: '100%', height: `${Number(navbarPlaceholderHeight)}px` }"
50
50
  ></view>
51
51
  </view>
52
52
  </template>
@@ -74,19 +74,19 @@ import { NavbarProps } from './types';
74
74
  * @description 此组件一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uniapp自带的导航栏。
75
75
  * @tutorial https://uviewpro.cn/zh/components/navbar.html
76
76
  * @property {String|Number} height 导航栏高度(不包括状态栏高度在内,内部自动加上),注意这里的单位是px(默认44)
77
- * @property {String} back-icon-color 左边返回图标的颜色(默认#606266
77
+ * @property {String} back-icon-color 左边返回图标的颜色(默认var(--u-content-color)
78
78
  * @property {String} back-icon-name 左边返回图标的名称,只能为uView自带的图标(默认arrow-left)
79
79
  * @property {String|Number} back-icon-size 左边返回图标的大小,单位rpx(默认30)
80
80
  * @property {String} back-text 返回图标右边的辅助提示文字
81
- * @property {Object} back-text-style 返回图标右边的辅助提示文字的样式,对象形式(默认{ color: '#606266' })
81
+ * @property {Object} back-text-style 返回图标右边的辅助提示文字的样式,对象形式(默认{ color: 'var(--u-content-color)' })
82
82
  * @property {String} title 导航栏标题,如设置为空字符,将会隐藏标题占位区域
83
83
  * @property {String|Number} title-width 导航栏标题的最大宽度,内容超出会以省略号隐藏,单位rpx(默认250)
84
- * @property {String} title-color 标题的颜色(默认#606266
84
+ * @property {String} title-color 标题的颜色(默认var(--u-content-color)
85
85
  * @property {String|Number} title-size 导航栏标题字体大小,单位rpx(默认32)
86
86
  * @property {Function} custom-back 自定义返回逻辑方法
87
87
  * @property {String|Number} z-index 固定在顶部时的z-index值(默认980)
88
88
  * @property {Boolean} is-back 是否显示导航栏左边返回图标和辅助文字(默认true)
89
- * @property {Object} background 导航栏背景设置,见官网说明(默认{ background: '#ffffff' })
89
+ * @property {Object} background 导航栏背景设置,见官网说明(默认{ background: 'var(--u-bg-white)' })
90
90
  * @property {Boolean} is-fixed 导航栏是否固定在顶部(默认true)
91
91
  * @property {Boolean} immersive 沉浸式,允许fixed定位后导航栏塌陷,仅fixed定位下生效(默认false)
92
92
  * @property {Boolean} border-bottom 导航栏底部是否显示下边框,如定义了较深的背景颜色,可取消此值(默认true)
@@ -95,6 +95,8 @@ import { NavbarProps } from './types';
95
95
  const props = defineProps(NavbarProps);
96
96
  // 获取系统状态栏的高度
97
97
  const systemInfo = uni.getSystemInfoSync();
98
+ const windowInfo = uni.getWindowInfo();
99
+
98
100
  let menuButtonInfo: any = {};
99
101
  // 如果是小程序,获取右上角胶囊的尺寸信息,避免导航栏右侧内容与胶囊重叠(支付宝小程序非本API,尚未兼容)
100
102
  // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
@@ -102,7 +104,26 @@ menuButtonInfo = uni.getMenuButtonBoundingClientRect();
102
104
  // #endif
103
105
 
104
106
  // 状态栏高度
105
- const statusBarHeight = ref(systemInfo.statusBarHeight);
107
+ const statusBarHeight = ref(windowInfo.statusBarHeight);
108
+
109
+ // 转换字符数值为真正的数值
110
+ const navbarHeight = computed(() => {
111
+ // #ifdef APP || H5
112
+ return props.height ? props.height : 44;
113
+ // #endif
114
+ // #ifdef MP
115
+ // 小程序特别处理,让导航栏高度 = 胶囊高度 + 两倍胶囊顶部与状态栏底部的距离之差(相当于同时获得了导航栏底部与胶囊底部的距离)
116
+ // 此方法有缺陷,暂不用(会导致少了几个px),采用直接固定值的方式
117
+ // return menuButtonInfo.height + (menuButtonInfo.top - this.statusBarHeight) * 2;//导航高度
118
+ let height = systemInfo.platform == 'ios' ? 44 : 48;
119
+ return props.height ? props.height : height;
120
+ // #endif
121
+ });
122
+
123
+ // 导航栏高度加上状态栏高度
124
+ const navbarPlaceholderHeight = computed(() => {
125
+ return Number(navbarHeight.value) + Number(statusBarHeight.value);
126
+ });
106
127
 
107
128
  // 导航栏内部盒子的样式
108
129
  const navbarInnerStyle = computed(() => {
@@ -147,20 +168,6 @@ const titleStyle = computed(() => {
147
168
  return style;
148
169
  });
149
170
 
150
- // 转换字符数值为真正的数值
151
- const navbarHeight = computed(() => {
152
- // #ifdef APP-PLUS || H5
153
- return props.height ? props.height : 44;
154
- // #endif
155
- // #ifdef MP
156
- // 小程序特别处理,让导航栏高度 = 胶囊高度 + 两倍胶囊顶部与状态栏底部的距离之差(相当于同时获得了导航栏底部与胶囊底部的距离)
157
- // 此方法有缺陷,暂不用(会导致少了几个px),采用直接固定值的方式
158
- // return menuButtonInfo.height + (menuButtonInfo.top - this.statusBarHeight) * 2;//导航高度
159
- let height = systemInfo.platform == 'ios' ? 44 : 48;
160
- return props.height ? props.height : height;
161
- // #endif
162
- });
163
-
164
171
  /**
165
172
  * 返回按钮点击事件
166
173
  * 如果自定义了点击返回按钮的函数,则执行,否则执行返回逻辑
@@ -250,7 +250,7 @@ defineExpose({
250
250
  @import '../../libs/css/style.components.scss';
251
251
 
252
252
  .u-no-network {
253
- background-color: #fff;
253
+ background-color: var(--u-bg-white);
254
254
  position: fixed;
255
255
  top: 0;
256
256
  left: 0;
@@ -297,7 +297,7 @@ defineExpose({
297
297
  }
298
298
 
299
299
  .u-retry-hover {
300
- color: #fff;
300
+ color: var(--u-white-color);
301
301
  background-color: $u-tips-color;
302
302
  }
303
303
  </style>