uview-pro 0.1.1 → 0.2.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.
package/changelog.md CHANGED
@@ -1,3 +1,60 @@
1
+ ## 0.2.1(2025-09-29)
2
+
3
+ ### 🚀 Chore | 构建/工程依赖/工具
4
+
5
+ - 优化代码格式化和 ESLint 配置 ([771eacd](https://github.com/anyup/uView-Pro/commit/771eacd58d410e468a8aec4225bbe7b402480b2f))
6
+
7
+ ### ⚡ Performance Improvements | 性能优化
8
+
9
+ - 压缩部分js工具库 ([6615b70](https://github.com/anyup/uView-Pro/commit/6615b7085a51c4fbc9f884ec68e05db1a1e89e27))
10
+
11
+ ### ✨ Features | 新功能
12
+
13
+ - **u-calendar:** 日历组件增加农历显示功能 ([e2368ac](https://github.com/anyup/uView-Pro/commit/e2368ac88b0abb4493ab12a1785eb2a0e38e502c))
14
+
15
+ ### ♻️ Code Refactoring | 代码重构
16
+
17
+ - **calendar:** 重构日历组件类型定义 ([0040e9e](https://github.com/anyup/uView-Pro/commit/0040e9e1095446536370e9aca3c135bc05527acb))
18
+
19
+ ### 🐛 Bug Fixes | Bug 修复
20
+
21
+ - **u-input:** 修复输入框禁用状态时清空按钮仍显示的问题 ([722715f](https://github.com/anyup/uView-Pro/commit/722715f7d6607584c0e158ba2de2342147e3be17))
22
+
23
+ ## 0.2.0(2025-09-28)
24
+
25
+ ### ♻️ Code Refactoring | 代码重构
26
+
27
+ - **example:** 优化 about 页面中的链接处理 ([d04ba8a](https://github.com/anyup/uView-Pro/commit/d04ba8a26278b6a0ea4f5e906bfec89ce6954459))
28
+ - **css:** 重构 CSS 样式并添加新样式 ([50b2670](https://github.com/anyup/uView-Pro/commit/50b2670a5e09aff9994a97f60a7d376b5b99a544))
29
+ - **libs:** 重构 libs 工具类代码并优化导出方式 ([10a604e](https://github.com/anyup/uView-Pro/commit/10a604e86f8712ee65c658a019c231b56cdcc7e7))
30
+ - **u-icon:** 移除 customStyle 属性并整合全局样式 ([cd52e14](https://github.com/anyup/uView-Pro/commit/cd52e14739604f1f126205e16383f187f1d38e8e))
31
+ - **props:** 优化 Props 类型定义和样式处理 ([c6ca0de](https://github.com/anyup/uView-Pro/commit/c6ca0de0876cb61671c25e58f33e51674edab266))
32
+ - **u-text:** 优化文本组件的样式和布局 ([885a0cf](https://github.com/anyup/uView-Pro/commit/885a0cf3f348184b3546979f1cc1914ded198411))
33
+ - **u-text:** 优化文本组件样式和属性 ([315d437](https://github.com/anyup/uView-Pro/commit/315d4379148fddbed059e55e5f9a0d0268345e62))
34
+ - **pages:** 优化微信小程序多个页面的用户提示展示,审核相关 ([0f3741f](https://github.com/anyup/uView-Pro/commit/0f3741f65d39f74bc3dc27df8514324e02c3582a))
35
+ - **pages:** 添加微信小程序端布局演示提示 ([9eaac70](https://github.com/anyup/uView-Pro/commit/9eaac70cf143327589d56a627160f33c56585d2e))
36
+
37
+ ### ✨ Features | 新功能
38
+
39
+ - **components:** 添加 input 组件演示页面 ([91baf00](https://github.com/anyup/uView-Pro/commit/91baf0012e381856b79ca49edb60735928d78099))
40
+ - **collapse:** 更新折叠面板组件默认配置和样式 ([a03e0be](https://github.com/anyup/uView-Pro/commit/a03e0be3a9f8ac8b03dbd406d5d8c37227e869bd))
41
+ - **components:** 新增 Text 组件 ([a034f9d](https://github.com/anyup/uView-Pro/commit/a034f9d029ab38dbf1a066978f3c62c1328c96a5))
42
+ - **hooks:** 重构 useParent 并添加父子组件关系管理 ([37e35d8](https://github.com/anyup/uView-Pro/commit/37e35d84112a08b3d28aa8e5caec12a0a2696594))
43
+ - **hooks:** 新增自定义 Hooks 工具库 ([0b3f680](https://github.com/anyup/uView-Pro/commit/0b3f68051b09917fbd39006093291f6dcc4eb0ef))
44
+
45
+ ### 📝 Documentation | 文档
46
+
47
+ - 添加 Copilot 提示词 ([c10cd20](https://github.com/anyup/uView-Pro/commit/c10cd201214907ae2ac8228498927a59f8411cfb))
48
+
49
+ ### 🐛 Bug Fixes | Bug 修复
50
+
51
+ - **u-collapse:** 重构手风琴组件并解决手风琴失效问题 ([a64e607](https://github.com/anyup/uView-Pro/commit/a64e6075f556ffeb3f5ad6b9ea443e3a22f83a86))
52
+ - **u-collapse:** 修复折叠面板内容高度在头条小程序适配 ([5fdcd26](https://github.com/anyup/uView-Pro/commit/5fdcd262ab3e134a97a4f25482d188d93222fddf))
53
+
54
+ ### 👷 Continuous Integration | CI 配置
55
+
56
+ - **vscode:** 设置 Vue 文件默认格式化工具为 Prettier ([84d5259](https://github.com/anyup/uView-Pro/commit/84d52599f2632e814a137e8d553793fb3cdad1f1))
57
+
1
58
  ## 0.1.1(2025-09-22)
2
59
 
3
60
  ### ♻️ Code Refactoring | 代码重构
@@ -0,0 +1,22 @@
1
+ import type { PropType } from 'vue';
2
+
3
+ export const stringProp = <T>(defaultVal: T) => ({
4
+ type: String as unknown as PropType<T>,
5
+ default: defaultVal
6
+ });
7
+
8
+ export const stringOrObjectProp = <T>(defaultVal: T) => ({
9
+ type: [String, Object] as PropType<string | Record<string, any>>,
10
+ default: defaultVal
11
+ });
12
+
13
+ export const baseProps = {
14
+ /**
15
+ * 自定义根节点样式
16
+ */
17
+ customStyle: stringOrObjectProp(''),
18
+ /**
19
+ * 自定义根节点样式类
20
+ */
21
+ customClass: stringProp('')
22
+ };
@@ -1,11 +1,13 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
- import type { CalendarMode, ThemeType } from '../../types/global';
2
+ import type { CalendarChangeDate, CalendarChangeRange, CalendarMode, ThemeType } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * calendar 日历类型定义
6
7
  * @description 供 u-calendar 组件 props 使用
7
8
  */
8
9
  export const CalendarProps = {
10
+ ...baseProps,
9
11
  /** 是否开启底部安全区适配 */
10
12
  safeAreaInsetBottom: { type: Boolean, default: false },
11
13
  /** 是否允许通过点击遮罩关闭Picker */
@@ -57,7 +59,15 @@ export const CalendarProps = {
57
59
  /** 是否显示右上角的关闭图标 */
58
60
  closeable: { type: Boolean, default: true },
59
61
  /** 顶部的提示文字 */
60
- toolTip: { type: String, default: '选择日期' }
62
+ toolTip: { type: String, default: '选择日期' },
63
+ /** 是否显示农历 */
64
+ showLunar: { type: Boolean, default: false }
61
65
  };
62
66
 
63
67
  export type CalendarProps = ExtractPropTypes<typeof CalendarProps>;
68
+
69
+ export type CalendarEmits = {
70
+ (e: 'update:modelValue', value: boolean): void;
71
+ (e: 'input', value: boolean): void;
72
+ (e: 'change', value: CalendarChangeDate | CalendarChangeRange): void;
73
+ };
@@ -11,7 +11,7 @@
11
11
  :border-radius="borderRadius"
12
12
  :closeable="closeable"
13
13
  >
14
- <view class="u-calendar">
14
+ <view class="u-calendar" :class="props.customClass" :style="$u.toStyle(customStyle)">
15
15
  <view class="u-calendar__header">
16
16
  <view class="u-calendar__header__text" v-if="!slots.tooltip">
17
17
  {{ toolTip }}
@@ -65,6 +65,17 @@
65
65
  <view class="u-calendar__content__item__tips" :style="{ color: activeColor }" v-if="mode == 'range' && endDate == `${year}-${month}-${index + 1}`">{{
66
66
  endText
67
67
  }}</view>
68
+ <view
69
+ v-if="
70
+ props.showLunar &&
71
+ !(mode == 'range' && startDate == `${year}-${month}-${index + 1}` && startDate != endDate) &&
72
+ !(mode == 'range' && endDate == `${year}-${month}-${index + 1}`)
73
+ "
74
+ class="u-calendar__content__item__tips"
75
+ :style="{ color: getColor(index, 2) }"
76
+ >
77
+ {{ lunarArr[index]?.dayCn === '初一' ? lunarArr[index].monthCn : (lunarArr[index]?.dayCn ?? '') }}
78
+ </view>
68
79
  </view>
69
80
  <view class="u-calendar__content__bg-month">{{ month }}</view>
70
81
  </view>
@@ -84,7 +95,8 @@
84
95
  <script setup lang="ts">
85
96
  import { ref, computed, watch, onMounted, useSlots } from 'vue';
86
97
  import { $u } from '../..';
87
- import { CalendarProps } from './types';
98
+ import { CalendarProps, type CalendarEmits } from './types';
99
+ import Calendar from '../../libs/util/calendar';
88
100
 
89
101
  defineOptions({
90
102
  name: 'u-calendar'
@@ -121,7 +133,7 @@ defineOptions({
121
133
  */
122
134
 
123
135
  const props = defineProps(CalendarProps);
124
- const emit = defineEmits(['update:modelValue', 'input', 'change']);
136
+ const emit = defineEmits<CalendarEmits>();
125
137
  const slots = useSlots();
126
138
 
127
139
  // 组件内部状态
@@ -130,6 +142,7 @@ const weekday = ref(1);
130
142
  const weekdayArr = ref<number[]>([]);
131
143
  const days = ref(0);
132
144
  const daysArr = ref<number[]>([]);
145
+ const lunarArr = ref<any[]>([]);
133
146
  const showTitle = ref('');
134
147
  const year = ref(2020);
135
148
  const month = ref(0);
@@ -151,6 +164,7 @@ const max = ref<{ year: number; month: number; day: number } | null>(null);
151
164
  const weekDayZh = ref(['日', '一', '二', '三', '四', '五', '六']);
152
165
 
153
166
  const dataChange = computed(() => `${props.mode}-${props.minDate}-${props.maxDate}`);
167
+ const lunarChange = computed(() => props.showLunar);
154
168
  // 如果用户有传递z-index值,优先使用
155
169
  const uZIndex = computed(() => (props.zIndex ? props.zIndex : $u.zIndex.popup));
156
170
  const popupValue = computed({
@@ -158,7 +172,7 @@ const popupValue = computed({
158
172
  set: (val: boolean) => emit('update:modelValue', val)
159
173
  });
160
174
 
161
- watch(dataChange, () => {
175
+ watch([dataChange, lunarChange], () => {
162
176
  init();
163
177
  });
164
178
 
@@ -327,11 +341,33 @@ function changeData() {
327
341
  weekday.value = getWeekday(year.value, month.value);
328
342
  weekdayArr.value = generateArray(1, weekday.value);
329
343
  showTitle.value = `${year.value}年${month.value}月`;
344
+ if (props.showLunar) {
345
+ lunarArr.value = [];
346
+ daysArr.value.forEach(d => {
347
+ lunarArr.value.push(getLunar(year.value, month.value, d));
348
+ });
349
+ }
330
350
  if (props.isChange && props.mode == 'date') {
331
351
  btnFix(true);
332
352
  }
333
353
  }
334
354
 
355
+ /**
356
+ * 获取农历
357
+ */
358
+ function getLunar(year, month, day) {
359
+ const val = Calendar.solar2lunar(year, month, day);
360
+ return {
361
+ dayCn: val.IDayCn,
362
+ weekCn: val.ncWeek,
363
+ monthCn: val.IMonthCn,
364
+ day: val.lDay,
365
+ week: val.nWeek,
366
+ month: val.lMonth,
367
+ year: val.lYear
368
+ };
369
+ }
370
+
335
371
  /**
336
372
  * 日期点击事件
337
373
  */
@@ -403,6 +439,7 @@ function btnFix(show: boolean) {
403
439
  // 今天
404
440
  isToday = true;
405
441
  }
442
+ const lunar = props.showLunar ? getLunar(y, m, d) : null;
406
443
  emit('change', {
407
444
  year: y,
408
445
  month: m,
@@ -410,7 +447,8 @@ function btnFix(show: boolean) {
410
447
  days: daysNum,
411
448
  result: result,
412
449
  week: weekText,
413
- isToday: isToday
450
+ isToday: isToday,
451
+ lunar: lunar
414
452
  // switch: show //是否是切换年月操作
415
453
  });
416
454
  } else {
@@ -423,6 +461,12 @@ function btnFix(show: boolean) {
423
461
  let endDayStr = formatNum(endDay.value);
424
462
  let endDateStr = `${endYear.value}-${endMonthStr}-${endDayStr}`;
425
463
  let endWeek = getWeekText(endDateStr);
464
+ let startLunar = null;
465
+ let endLunar = null;
466
+ if (props.showLunar) {
467
+ startLunar = getLunar(startYear.value, startMonth.value, startDay.value);
468
+ endLunar = getLunar(endYear.value, endMonth.value, endDay.value);
469
+ }
426
470
  emit('change', {
427
471
  startYear: startYear.value,
428
472
  startMonth: startMonth.value,
@@ -433,7 +477,9 @@ function btnFix(show: boolean) {
433
477
  endMonth: endMonth.value,
434
478
  endDay: endDay.value,
435
479
  endDate: endDateStr,
436
- endWeek: endWeek
480
+ endWeek: endWeek,
481
+ startLunar: startLunar,
482
+ endLunar: endLunar
437
483
  });
438
484
  }
439
485
  }
@@ -1,4 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
2
3
 
3
4
  /**
4
5
  * u-collapse 手风琴 Props
@@ -12,6 +13,7 @@ import type { ExtractPropTypes, PropType } from 'vue';
12
13
  * @property {String} hoverClass 样式类名,按下时有效(默认u-hover-class)
13
14
  */
14
15
  export const CollapseProps = {
16
+ ...baseProps,
15
17
  /** 是否手风琴模式 */
16
18
  accordion: { type: Boolean, default: true },
17
19
  /** 头部的样式 */
@@ -1,16 +1,24 @@
1
1
  <template>
2
- <view class="u-collapse">
2
+ <view class="u-collapse" :style="$u.toStyle(customStyle)" :class="customClass">
3
3
  <slot />
4
4
  </view>
5
5
  </template>
6
6
 
7
+ <script lang="ts">
8
+ export default {
9
+ name: 'u-collapse',
10
+ options: {
11
+ addGlobalClass: true,
12
+ virtualHost: true,
13
+ styleIsolation: 'shared'
14
+ }
15
+ };
16
+ </script>
17
+
7
18
  <script setup lang="ts">
8
- import { ref, provide } from 'vue';
19
+ import { ref } from 'vue';
9
20
  import { CollapseProps } from './types';
10
-
11
- defineOptions({
12
- name: 'u-collapse'
13
- });
21
+ import { $u } from '../../';
14
22
 
15
23
  /**
16
24
  * collapse 手风琴
@@ -48,13 +56,6 @@ function onChange(index: string | number) {
48
56
  emit('change', index);
49
57
  }
50
58
 
51
- provide('u-collapse', {
52
- children,
53
- props,
54
- init,
55
- onChange
56
- });
57
-
58
59
  defineExpose({
59
60
  props,
60
61
  children,
@@ -1,11 +1,13 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { TextAlign } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * u-collapse-item 手风琴Item Props
6
7
  * @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
7
8
  */
8
9
  export const CollapseItemProps = {
10
+ ...baseProps,
9
11
  /** 标题 */
10
12
  title: { type: String, default: '' },
11
13
  /** 标题的对齐方式 */
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="u-collapse-item" :style="itemStyle">
2
+ <view class="u-collapse-item" :style="`${$u.toStyle(itemStyle)}${$u.toStyle(customStyle)}`" :class="customClass">
3
3
  <view :hover-stay-time="200" class="u-collapse-head" @tap.stop="headClick" :hover-class="hoverClass" :style="headStyle">
4
4
  <template v-if="!slots['title-all']">
5
5
  <view v-if="!slots['title']" class="u-collapse-title u-line-1" :style="[{ textAlign: align ? align : 'left' }, isShow && activeStyle && !arrow ? activeStyle : '']">
@@ -13,7 +13,7 @@
13
13
  <slot v-else name="title-all" />
14
14
  </view>
15
15
 
16
- <view class="u-collapse-body" :style="{ height: isShow ? height + 'px' : '0' }">
16
+ <view class="u-collapse-body" :style="{ height: isShow ? height : '0' }">
17
17
  <view class="u-collapse-content" :id="elId" :style="bodyStyle">
18
18
  <slot></slot>
19
19
  </view>
@@ -21,12 +21,22 @@
21
21
  </view>
22
22
  </template>
23
23
 
24
+ <script lang="ts">
25
+ export default {
26
+ name: 'u-collapse-item',
27
+ options: {
28
+ addGlobalClass: true,
29
+ virtualHost: true,
30
+ styleIsolation: 'shared'
31
+ }
32
+ };
33
+ </script>
34
+
24
35
  <script setup lang="ts">
25
36
  import { ref, watch, onMounted, useSlots, getCurrentInstance, nextTick, inject } from 'vue';
26
- import { $u } from '../..';
37
+ import { $u, toStyle } from '../..';
27
38
  import { CollapseItemProps } from './types';
28
-
29
- defineOptions({ name: 'u-collapse-item' });
39
+ import { useParent } from '../../libs/hooks/useParent';
30
40
 
31
41
  /**
32
42
  * collapseItem 手风琴Item
@@ -49,7 +59,7 @@ const instance = getCurrentInstance();
49
59
 
50
60
  const isShow = ref(false);
51
61
  const elId = ref('');
52
- const height = ref(0); // body内容的高度
62
+ const height = ref('0'); // body内容的高度
53
63
  const headStyle = ref<Record<string, any>>({}); // 头部样式,对象形式
54
64
  const bodyStyle = ref<Record<string, any>>({}); // 主体部分样式
55
65
  const itemStyle = ref<Record<string, any>>({}); // 每个item的整体样式
@@ -58,7 +68,7 @@ const hoverClass = ref(''); // 头部按下时的效果样式类
58
68
  const accordion = ref(true); // 是否显示右侧箭头
59
69
  const arrow = ref(true);
60
70
 
61
- const parent = inject<any>('u-collapse', null);
71
+ const { parent, parentExposed } = useParent('u-collapse');
62
72
 
63
73
  watch(
64
74
  () => props.open,
@@ -73,17 +83,13 @@ watch(
73
83
  */
74
84
  function init() {
75
85
  if (parent) {
76
- // 不存在时才添加本实例
77
- if (!parent.children.value.includes(instance?.exposed)) {
78
- parent.children.value.push(instance?.exposed);
79
- }
80
- headStyle.value = parent.props.headStyle;
81
- bodyStyle.value = parent.props.bodyStyle;
82
- arrowColor.value = parent.props.arrowColor;
83
- hoverClass.value = parent.props.hoverClass;
84
- arrow.value = parent.props.arrow;
85
- itemStyle.value = parent.props.itemStyle;
86
- accordion.value = parent.props.accordion;
86
+ headStyle.value = parentExposed.props.headStyle;
87
+ bodyStyle.value = parentExposed.props.bodyStyle;
88
+ arrowColor.value = parentExposed.props.arrowColor;
89
+ hoverClass.value = parentExposed.props.hoverClass;
90
+ arrow.value = parentExposed.props.arrow;
91
+ itemStyle.value = parentExposed.props.itemStyle;
92
+ accordion.value = parentExposed.props.accordion;
87
93
  }
88
94
  elId.value = $u.guid();
89
95
  nextTick(() => {
@@ -96,16 +102,15 @@ function init() {
96
102
  */
97
103
  function headClick() {
98
104
  if (props.disabled) return;
99
-
100
105
  if (accordion.value && parent) {
101
- parent.children.value.forEach((vm: any) => {
102
- if (vm.elId !== elId.value) {
103
- vm.isShow = false;
106
+ parent.children.forEach((vm: any) => {
107
+ if (vm.exposed.elId.value !== elId.value) {
108
+ vm.exposed.isShow.value = false;
104
109
  } else {
105
- vm.isShow = !vm.isShow;
110
+ vm.exposed.isShow.value = !vm.exposed.isShow.value;
106
111
  emit('change', {
107
112
  index: props.index,
108
- show: vm.isShow
113
+ show: vm.exposed.isShow.value
109
114
  });
110
115
  }
111
116
  });
@@ -116,18 +121,20 @@ function headClick() {
116
121
  show: isShow.value
117
122
  });
118
123
  }
119
-
120
- if (isShow.value) parent && parent.onChange && parent.onChange(props.index);
124
+ if (isShow.value) parentExposed && parentExposed.onChange && parentExposed.onChange(props.index);
121
125
  }
122
126
 
123
127
  /**
124
128
  * 查询内容高度
125
129
  */
126
130
  function queryRect() {
127
- // getRect为uView自带的节点查询简化方法,详见文档介绍:https://uviewpro.cn/zh/js/getRect.html
131
+ // getRect为uView自带的节点查询简化方法,详见文档介绍:https://uviewpro.cn/zh/tools/getRect.html
128
132
  // 组件内部一般用this.$uGetRect,对外的为this.$u.getRect,二者功能一致,名称不同
129
133
  $u.getRect('#' + elId.value, instance).then((res: any) => {
130
- height.value = res.height;
134
+ height.value = res.height + 'px';
135
+ // #ifdef MP-TOUTIAO
136
+ height.value = 'auto';
137
+ // #endif
131
138
  });
132
139
  }
133
140
 
@@ -1,11 +1,13 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { IconLabelPosition, ImgMode } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * u-icon 组件 Props 类型定义
6
7
  * 所有属性均带详细注释,类型安全,便于 IDE 智能提示
7
8
  */
8
9
  export const IconProps = {
10
+ ...baseProps,
9
11
  /** 图标名称,见示例图标集 */
10
12
  name: { type: String, default: '' },
11
13
  /** 图标颜色,可接受主题色 */
@@ -40,8 +42,6 @@ export const IconProps = {
40
42
  space: { type: [String, Number] as PropType<string | number>, default: '' },
41
43
  /** 图片的mode,参考uni-app image组件 */
42
44
  imgMode: { type: String as PropType<ImgMode>, default: 'widthFix' },
43
- /** 自定义样式,对象形式 */
44
- customStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
45
45
  /** 用于显示图片小图标时,图片的宽度,单位rpx */
46
46
  width: { type: [String, Number] as PropType<string | number>, default: '' },
47
47
  /** 用于显示图片小图标时,图片的高度,单位rpx */
@@ -10,15 +10,22 @@
10
10
  </view>
11
11
  </template>
12
12
 
13
+ <script lang="ts">
14
+ export default {
15
+ name: 'u-icon',
16
+ options: {
17
+ addGlobalClass: true,
18
+ virtualHost: true,
19
+ styleIsolation: 'shared'
20
+ }
21
+ };
22
+ </script>
23
+
13
24
  <script setup lang="ts">
14
25
  import { computed } from 'vue';
15
26
  import { $u } from '../..';
16
27
  import { IconProps } from './types';
17
28
 
18
- defineOptions({
19
- name: 'u-icon'
20
- });
21
-
22
29
  /**
23
30
  * icon 图标
24
31
  * @description 基于字体的图标集,包含了大多数常见场景的图标。
@@ -58,7 +58,7 @@
58
58
  @confirm="onConfirm"
59
59
  />
60
60
  <view class="u-input__right-icon u-flex">
61
- <view class="u-input__right-icon__clear u-input__right-icon__item" v-if="clearable && modelValue != ''">
61
+ <view class="u-input__right-icon__clear u-input__right-icon__item" v-if="clearable && modelValue != '' && !disabled">
62
62
  <u-icon size="32" name="close-circle-fill" color="#c0c4cc" @click="onClear" />
63
63
  </view>
64
64
  <view class="u-input__right-icon__clear u-input__right-icon__item" v-if="passwordIcon && type == 'password'">
@@ -0,0 +1,69 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { ThemeType } from '../../types/global';
3
+ import { baseProps } from '../common/props';
4
+
5
+ export const TextProps = {
6
+ ...baseProps,
7
+ // 主题颜色
8
+ type: { type: String as PropType<ThemeType>, default: '' },
9
+ /** 是否显示文本 */
10
+ show: { type: Boolean, default: true },
11
+ /** 显示的值 */
12
+ text: { type: [String, Number] as PropType<string | number>, default: '' },
13
+ /** 前置图标 */
14
+ prefixIcon: { type: String, default: '' },
15
+ /** 后置图标 */
16
+ suffixIcon: { type: String, default: '' },
17
+ /** 文本处理模式 */
18
+ mode: { type: String as PropType<'text' | 'price' | 'phone' | 'name' | 'date' | 'link'>, default: 'text' },
19
+ /** 链接地址 */
20
+ href: { type: String, default: '' },
21
+ /** 格式化规则 */
22
+ format: { type: [String, Function] as PropType<string | ((val: any) => any)>, default: '' },
23
+ /** 是否拨打电话 */
24
+ call: { type: Boolean, default: false },
25
+ /** 小程序打开方式 */
26
+ openType: { type: String, default: '' },
27
+ /** 是否粗体 */
28
+ bold: { type: Boolean, default: false },
29
+ /** 是否块状 */
30
+ block: { type: Boolean, default: false },
31
+ /** 显示行数,超出省略号 */
32
+ lines: { type: [String, Number] as PropType<string | number>, default: '' },
33
+ /** 文本颜色 */
34
+ color: { type: String, default: '#303133' },
35
+ /** 字体大小 */
36
+ size: { type: [String, Number] as PropType<string | number>, default: 28 },
37
+ /** 图标样式 */
38
+ iconStyle: { type: [Object, String] as PropType<Record<string, any> | string>, default: () => ({ fontSize: '15px' }) },
39
+ /** 文字样式 */
40
+ textStyle: { type: [Object, String] as PropType<Record<string, any> | string>, default: () => ({}) },
41
+ /** 文字装饰 */
42
+ decoration: { type: String as PropType<'none' | 'underline' | 'line-through'>, default: 'none' },
43
+ /** 外边距 */
44
+ margin: { type: [Object, String, Number] as PropType<Record<string, any> | string | number>, default: 0 },
45
+ /** 行高 */
46
+ lineHeight: { type: [String, Number] as PropType<string | number>, default: '' },
47
+ /** 对齐方式 */
48
+ align: { type: String as PropType<'left' | 'center' | 'right'>, default: 'left' },
49
+ /** 换行方式 */
50
+ wordWrap: { type: String as PropType<'break-word' | 'normal' | 'anywhere'>, default: 'normal' },
51
+ /** 语言 */
52
+ lang: { type: String, default: '' },
53
+ /** 会话来源 */
54
+ sessionFrom: { type: String, default: '' },
55
+ /** 消息标题 */
56
+ sendMessageTitle: { type: String, default: '' },
57
+ /** 消息路径 */
58
+ sendMessagePath: { type: String, default: '' },
59
+ /** 消息图片 */
60
+ sendMessageImg: { type: String, default: '' },
61
+ /** 是否显示消息卡片 */
62
+ showMessageCard: { type: Boolean, default: false },
63
+ /** app参数 */
64
+ appParameter: { type: String, default: '' },
65
+ /** 表单类型 */
66
+ formType: { type: String, default: '' }
67
+ };
68
+
69
+ export type TextProps = ExtractPropTypes<typeof TextProps>;