uview-pro 0.6.4 → 0.6.5

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 (34) hide show
  1. package/changelog.md +27 -12
  2. package/components/u-action-sheet/types.ts +2 -4
  3. package/components/u-action-sheet/u-action-sheet.vue +7 -2
  4. package/components/u-calendar/types.ts +4 -6
  5. package/components/u-calendar/u-calendar.vue +8 -3
  6. package/components/u-input/types.ts +1 -4
  7. package/components/u-input/u-input.vue +7 -3
  8. package/components/u-keyboard/types.ts +2 -5
  9. package/components/u-keyboard/u-keyboard.vue +6 -2
  10. package/components/u-link/types.ts +2 -4
  11. package/components/u-link/u-link.vue +9 -3
  12. package/components/u-loadmore/types.ts +1 -5
  13. package/components/u-loadmore/u-loadmore.vue +13 -4
  14. package/components/u-modal/types.ts +4 -6
  15. package/components/u-modal/u-modal.vue +20 -3
  16. package/components/u-no-network/types.ts +1 -4
  17. package/components/u-no-network/u-no-network.vue +4 -1
  18. package/components/u-pagination/types.ts +2 -5
  19. package/components/u-pagination/u-pagination.vue +9 -3
  20. package/components/u-picker/types.ts +3 -5
  21. package/components/u-picker/u-picker.vue +9 -3
  22. package/components/u-read-more/types.ts +3 -5
  23. package/components/u-read-more/u-read-more.vue +7 -2
  24. package/components/u-search/types.ts +65 -68
  25. package/components/u-search/u-search.vue +296 -291
  26. package/components/u-section/types.ts +1 -4
  27. package/components/u-section/u-section.vue +7 -2
  28. package/components/u-select/types.ts +3 -5
  29. package/components/u-select/u-select.vue +9 -4
  30. package/components/u-upload/types.ts +1 -4
  31. package/components/u-upload/u-upload.vue +1 -1
  32. package/components/u-verification-code/types.ts +3 -6
  33. package/components/u-verification-code/u-verification-code.vue +16 -9
  34. package/package.json +1 -1
@@ -1,7 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import { getColor, useLocale } from '../../';
3
-
4
- const { t } = useLocale();
2
+ import { getColor } from '../../';
5
3
 
6
4
  /**
7
5
  * ReadMoreProps 阅读更多 props 类型定义
@@ -23,9 +21,9 @@ export const ReadMoreProps = {
23
21
  /** 展开后是否显示"收起"按钮 */
24
22
  toggle: { type: Boolean, default: false },
25
23
  /** 关闭时的提示文字 */
26
- closeText: { type: String, default: () => t('uReadMore.closeText') },
24
+ closeText: { type: String, default: '' },
27
25
  /** 展开时的提示文字 */
28
- openText: { type: String, default: () => t('uReadMore.openText') },
26
+ openText: { type: String, default: '' },
29
27
  /** 提示的文字颜色 */
30
28
  color: { type: String, default: () => getColor('primary') },
31
29
  /** 提示文字的大小 */
@@ -29,7 +29,7 @@
29
29
  color: color
30
30
  }"
31
31
  >
32
- {{ showMore ? openText : closeText }}
32
+ {{ showMore ? getOpenText : getCloseText }}
33
33
  </text>
34
34
  <view class="u-content__showmore-wrap__readmore-btn__icon u-flex">
35
35
  <u-icon :color="color" :size="fontSize" :name="showMore ? 'arrow-up' : 'arrow-down'"></u-icon>
@@ -53,7 +53,7 @@ export default {
53
53
 
54
54
  <script setup lang="ts">
55
55
  import { ref, computed, watch, onMounted, nextTick, getCurrentInstance } from 'vue';
56
- import { $u } from '../..';
56
+ import { $u, useLocale } from '../..';
57
57
  import { ReadMoreProps } from './types';
58
58
 
59
59
  /**
@@ -78,6 +78,8 @@ const props = defineProps(ReadMoreProps);
78
78
 
79
79
  const emit = defineEmits(['open', 'close']);
80
80
 
81
+ const { t } = useLocale();
82
+
81
83
  // 是否需要隐藏一部分内容
82
84
  const isLongContent = ref(false);
83
85
  // 当前隐藏与显示的状态,true-显示,false-收起
@@ -91,6 +93,9 @@ const innerShadowStyle = computed(() => {
91
93
  return showMore.value ? {} : props.shadowStyle;
92
94
  });
93
95
 
96
+ const getOpenText = computed(() => props.openText || t('uReadMore.openText'));
97
+ const getCloseText = computed(() => props.closeText || t('uReadMore.closeText'));
98
+
94
99
  // 监听 toggle 和 showHeight 变化,重新初始化
95
100
  watch(
96
101
  () => `${props.toggle}-${props.showHeight}`,
@@ -1,68 +1,65 @@
1
- import type { ExtractPropTypes, PropType } from 'vue';
2
- import type { InputAlign, SearchShape } from '../../types/global';
3
- import { useLocale } from '../../';
4
-
5
- const { t } = useLocale();
6
-
7
- /**
8
- * SearchProps 搜索框 props 类型定义
9
- * @description 集成常见搜索框功能,开箱即用
10
- */
11
- export const SearchProps = {
12
- /** 自定义根节点样式 */
13
- customStyle: {
14
- type: [String, Object] as PropType<string | Record<string, any>>,
15
- default: () => ({})
16
- },
17
- /** 自定义根节点样式类 */
18
- customClass: {
19
- type: String as unknown as PropType<string>,
20
- default: ''
21
- },
22
- /** 搜索框形状,round-圆形,square-方形 */
23
- shape: { type: String as PropType<SearchShape>, default: 'round' },
24
- /** 搜索框背景色,默认值var(--u-bg-gray-light) */
25
- bgColor: { type: String, default: 'var(--u-bg-gray-light)' },
26
- /** 占位提示文字 */
27
- placeholder: { type: String, default: () => t('uSearch.placeholder') },
28
- /** 是否启用清除控件 */
29
- clearabled: { type: Boolean, default: true },
30
- /** 是否自动聚焦 */
31
- focus: { type: Boolean, default: false },
32
- /** 是否在搜索框右侧显示取消按钮 */
33
- showAction: { type: Boolean, default: true },
34
- /** 右边控件的样式 */
35
- actionStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
36
- /** 取消按钮文字 */
37
- actionText: { type: String, default: () => t('uSearch.actionText') },
38
- /** 输入框内容对齐方式,可选值为 left|center|right */
39
- inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
40
- /** 是否启用输入框 */
41
- disabled: { type: Boolean, default: false },
42
- /** 开启showAction时,是否在input获取焦点时才显示 */
43
- animation: { type: Boolean, default: false },
44
- /** 边框颜色,只要配置了颜色,才会有边框 */
45
- borderColor: { type: String, default: 'none' },
46
- /** 输入框的初始化内容 */
47
- modelValue: { type: String, default: '' },
48
- /** 搜索框高度,单位rpx */
49
- height: { type: [Number, String] as PropType<number | string>, default: 64 },
50
- /** input输入框的样式,可以定义文字颜色,大小等,对象形式 */
51
- inputStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
52
- /** 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档) */
53
- maxlength: { type: [Number, String] as PropType<number | string>, default: '-1' },
54
- /** 搜索图标的颜色,默认同输入框字体颜色 */
55
- searchIconColor: { type: String, default: '' },
56
- /** 输入框字体颜色 */
57
- color: { type: String, default: 'var(--u-content-color)' },
58
- /** placeholder的颜色 */
59
- placeholderColor: { type: String, default: 'var(--u-tips-color)' },
60
- /** 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30rpx"、"30rpx 20rpx"等写法 */
61
- margin: { type: String, default: '0' },
62
- /** 左边输入框的图标,可以为uView图标名称或图片路径 */
63
- searchIcon: { type: String, default: 'search' },
64
- /** 弹出键盘时是否自动调节高度,uni-app默认值是true */
65
- adjustPosition: { type: Boolean, default: true }
66
- };
67
-
68
- export type SearchProps = ExtractPropTypes<typeof SearchProps>;
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { InputAlign, SearchShape } from '../../types/global';
3
+
4
+ /**
5
+ * SearchProps 搜索框 props 类型定义
6
+ * @description 集成常见搜索框功能,开箱即用
7
+ */
8
+ export const SearchProps = {
9
+ /** 自定义根节点样式 */
10
+ customStyle: {
11
+ type: [String, Object] as PropType<string | Record<string, any>>,
12
+ default: () => ({})
13
+ },
14
+ /** 自定义根节点样式类 */
15
+ customClass: {
16
+ type: String as unknown as PropType<string>,
17
+ default: ''
18
+ },
19
+ /** 搜索框形状,round-圆形,square-方形 */
20
+ shape: { type: String as PropType<SearchShape>, default: 'round' },
21
+ /** 搜索框背景色,默认值var(--u-bg-gray-light) */
22
+ bgColor: { type: String, default: 'var(--u-bg-gray-light)' },
23
+ /** 占位提示文字 */
24
+ placeholder: { type: String, default: '' },
25
+ /** 是否启用清除控件 */
26
+ clearabled: { type: Boolean, default: true },
27
+ /** 是否自动聚焦 */
28
+ focus: { type: Boolean, default: false },
29
+ /** 是否在搜索框右侧显示取消按钮 */
30
+ showAction: { type: Boolean, default: true },
31
+ /** 右边控件的样式 */
32
+ actionStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
33
+ /** 取消按钮文字 */
34
+ actionText: { type: String, default: '' },
35
+ /** 输入框内容对齐方式,可选值为 left|center|right */
36
+ inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
37
+ /** 是否启用输入框 */
38
+ disabled: { type: Boolean, default: false },
39
+ /** 开启showAction时,是否在input获取焦点时才显示 */
40
+ animation: { type: Boolean, default: false },
41
+ /** 边框颜色,只要配置了颜色,才会有边框 */
42
+ borderColor: { type: String, default: 'none' },
43
+ /** 输入框的初始化内容 */
44
+ modelValue: { type: String, default: '' },
45
+ /** 搜索框高度,单位rpx */
46
+ height: { type: [Number, String] as PropType<number | string>, default: 64 },
47
+ /** input输入框的样式,可以定义文字颜色,大小等,对象形式 */
48
+ inputStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
49
+ /** 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档) */
50
+ maxlength: { type: [Number, String] as PropType<number | string>, default: '-1' },
51
+ /** 搜索图标的颜色,默认同输入框字体颜色 */
52
+ searchIconColor: { type: String, default: '' },
53
+ /** 输入框字体颜色 */
54
+ color: { type: String, default: 'var(--u-content-color)' },
55
+ /** placeholder的颜色 */
56
+ placeholderColor: { type: String, default: 'var(--u-tips-color)' },
57
+ /** 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30rpx"、"30rpx 20rpx"等写法 */
58
+ margin: { type: String, default: '0' },
59
+ /** 左边输入框的图标,可以为uView图标名称或图片路径 */
60
+ searchIcon: { type: String, default: 'search' },
61
+ /** 弹出键盘时是否自动调节高度,uni-app默认值是true */
62
+ adjustPosition: { type: Boolean, default: true }
63
+ };
64
+
65
+ export type SearchProps = ExtractPropTypes<typeof SearchProps>;