uview-pro 0.6.4 → 0.6.6
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 +37 -12
- package/components/u-action-sheet/types.ts +2 -4
- package/components/u-action-sheet/u-action-sheet.vue +7 -2
- package/components/u-calendar/types.ts +4 -6
- package/components/u-calendar/u-calendar.vue +9 -5
- package/components/u-input/types.ts +1 -4
- package/components/u-input/u-input.vue +7 -3
- package/components/u-keyboard/types.ts +2 -5
- package/components/u-keyboard/u-keyboard.vue +6 -2
- package/components/u-link/types.ts +2 -4
- package/components/u-link/u-link.vue +9 -3
- package/components/u-loadmore/types.ts +1 -5
- package/components/u-loadmore/u-loadmore.vue +13 -4
- package/components/u-modal/types.ts +4 -6
- package/components/u-modal/u-modal.vue +20 -3
- package/components/u-no-network/types.ts +1 -4
- package/components/u-no-network/u-no-network.vue +4 -1
- package/components/u-pagination/types.ts +2 -5
- package/components/u-pagination/u-pagination.vue +9 -3
- package/components/u-picker/types.ts +3 -5
- package/components/u-picker/u-picker.vue +9 -3
- package/components/u-read-more/types.ts +3 -5
- package/components/u-read-more/u-read-more.vue +7 -2
- package/components/u-search/types.ts +65 -68
- package/components/u-search/u-search.vue +296 -291
- package/components/u-section/types.ts +1 -4
- package/components/u-section/u-section.vue +7 -2
- package/components/u-select/types.ts +3 -5
- package/components/u-select/u-select.vue +9 -4
- package/components/u-upload/types.ts +1 -4
- package/components/u-upload/u-upload.vue +1 -1
- package/components/u-verification-code/types.ts +3 -6
- package/components/u-verification-code/u-verification-code.vue +16 -9
- package/locale/lang/en-US.ts +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
|
-
## 0.6.
|
|
2
|
-
|
|
3
|
-
###
|
|
4
|
-
|
|
5
|
-
- **u-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
## 0.6.6(2026-06-10)
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
4
|
+
|
|
5
|
+
- **u-calendar:** 修复日历标题无法实时通过切换多语言更新的问题,初始化英文日历默认分隔符(#166) ([18beabb](https://github.com/anyup/uView-Pro/commit/18beabbd72c4e21eb19b417d09073bd87457cefc))
|
|
6
|
+
|
|
7
|
+
### 👥 Contributors
|
|
8
|
+
|
|
9
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
10
|
+
|
|
11
|
+
## 0.6.5(2026-06-05)
|
|
12
|
+
|
|
13
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
14
|
+
|
|
15
|
+
- **locale:** 修复多个组件在多语言切换时不能实时更新的问题,统一默认值处理方式 ([86dbc61](https://github.com/anyup/uView-Pro/commit/86dbc61d4ffb9f70f2b98e11566b7ca90549a687))
|
|
16
|
+
|
|
17
|
+
### ✨ Features | 新功能
|
|
18
|
+
|
|
19
|
+
- **demo:** 新增多语言切换图标到演示页面的头部 ([9dfd98e](https://github.com/anyup/uView-Pro/commit/9dfd98e5ef8e1e0d5a091cd256fefee2a3ae8064))
|
|
20
|
+
- **loadmore,verificationCode:** 优化loadmore和verificationCode组件的演示示例 ([cddfaf9](https://github.com/anyup/uView-Pro/commit/cddfaf94354ebf5fde954f0098e23a7debc5c550))
|
|
21
|
+
|
|
22
|
+
### 👥 Contributors
|
|
23
|
+
|
|
24
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
25
|
+
|
|
26
|
+
## 0.6.4(2026-06-02)
|
|
27
|
+
|
|
28
|
+
### ✨ Features | 新功能
|
|
29
|
+
|
|
30
|
+
- **u-input:** 新增readonly输入属性,支持设置输入框只读状态,新增禁用与只读示例页面及配置项(#160) ([6a92373](https://github.com/anyup/uView-Pro/commit/6a92373a6c8a1c2875b93d6dbb3985df34887c4e))
|
|
31
|
+
- **u-textarea:** 新增click事件支持,在只读/非禁用状态下可触发点击回调,更新演示页面(#160) ([a79dc57](https://github.com/anyup/uView-Pro/commit/a79dc57262bfb3909d2f35bbf26589906e9a4c8d))
|
|
32
|
+
- **u-field:** 新增readonly属性支持,设置后可点击但无法输入,调整disabled和readonly状态的遮罩逻辑与样式(#160) ([708f13b](https://github.com/anyup/uView-Pro/commit/708f13bb3601c0c77a0a75f1b4d1c148f28c7229))
|
|
33
|
+
|
|
34
|
+
### 👥 Contributors
|
|
35
|
+
|
|
36
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
37
|
+
|
|
13
38
|
## 0.6.3(2026-05-28)
|
|
14
39
|
|
|
15
40
|
### 🐛 Bug Fixes | Bug 修复
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ActionSheetItem, ActionSheetTips } from '../../types/global';
|
|
3
|
-
import { getColor
|
|
4
|
-
|
|
5
|
-
const { t } = useLocale();
|
|
3
|
+
import { getColor } from '../../';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* actionSheet 操作菜单
|
|
@@ -42,7 +40,7 @@ export const ActionSheetProps = {
|
|
|
42
40
|
/** 弹出的z-index值 */
|
|
43
41
|
zIndex: { type: [String, Number], default: 0 },
|
|
44
42
|
/** 取消按钮的文字提示 */
|
|
45
|
-
cancelText: { type: String, default:
|
|
43
|
+
cancelText: { type: String, default: '' },
|
|
46
44
|
/** 字体颜色 */
|
|
47
45
|
color: { type: String, default: () => getColor('mainColor') },
|
|
48
46
|
/** 字体大小 */
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
v-if="cancelBtn"
|
|
41
41
|
@tap="close"
|
|
42
42
|
>
|
|
43
|
-
{{
|
|
43
|
+
{{ getCancelText }}
|
|
44
44
|
</view>
|
|
45
45
|
</u-popup>
|
|
46
46
|
</template>
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
|
|
61
61
|
<script setup lang="ts">
|
|
62
62
|
import { computed } from 'vue';
|
|
63
|
-
import { $u, useParent } from '../..';
|
|
63
|
+
import { $u, useParent, useLocale } from '../..';
|
|
64
64
|
import { ActionSheetProps } from './types';
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -85,6 +85,8 @@ const props = defineProps(ActionSheetProps);
|
|
|
85
85
|
|
|
86
86
|
const emit = defineEmits(['update:modelValue', 'click', 'close']);
|
|
87
87
|
|
|
88
|
+
const { t } = useLocale();
|
|
89
|
+
|
|
88
90
|
useParent('u-action-sheet');
|
|
89
91
|
|
|
90
92
|
const popupValue = computed({
|
|
@@ -92,6 +94,9 @@ const popupValue = computed({
|
|
|
92
94
|
set: (val: boolean) => emit('update:modelValue', val)
|
|
93
95
|
});
|
|
94
96
|
|
|
97
|
+
// 国际化计算属性
|
|
98
|
+
const getCancelText = computed(() => props.cancelText || t('uActionSheet.cancelText'));
|
|
99
|
+
|
|
95
100
|
// 顶部提示的样式
|
|
96
101
|
const tipsStyle = computed(() => {
|
|
97
102
|
let style: Record<string, string> = {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { CalendarChangeDate, CalendarChangeRange, CalendarMode, ThemeType } from '../../types/global';
|
|
3
|
-
import { getColor
|
|
4
|
-
|
|
5
|
-
const { t } = useLocale();
|
|
3
|
+
import { getColor } from '../../';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* calendar 日历类型定义
|
|
@@ -58,9 +56,9 @@ export const CalendarProps = {
|
|
|
58
56
|
/** 范围内日期字体颜色 */
|
|
59
57
|
rangeColor: { type: String, default: () => getColor('primary') },
|
|
60
58
|
/** mode=range时生效,起始日期自定义文案 */
|
|
61
|
-
startText: { type: String, default:
|
|
59
|
+
startText: { type: String, default: '' },
|
|
62
60
|
/** mode=range时生效,结束日期自定义文案 */
|
|
63
|
-
endText: { type: String, default:
|
|
61
|
+
endText: { type: String, default: '' },
|
|
64
62
|
/** 按钮样式类型 */
|
|
65
63
|
btnType: { type: String as PropType<ThemeType>, default: 'primary' },
|
|
66
64
|
/** 当前选中日期带选中效果 */
|
|
@@ -72,7 +70,7 @@ export const CalendarProps = {
|
|
|
72
70
|
/** 是否显示右上角的关闭图标 */
|
|
73
71
|
closeable: { type: Boolean, default: true },
|
|
74
72
|
/** 顶部的提示文字 */
|
|
75
|
-
toolTip: { type: String, default:
|
|
73
|
+
toolTip: { type: String, default: '' },
|
|
76
74
|
/** 是否显示农历 */
|
|
77
75
|
showLunar: { type: Boolean, default: false },
|
|
78
76
|
/** 是否在页面中显示 */
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
>
|
|
19
19
|
<view class="u-calendar__header" v-if="!props.isPage">
|
|
20
20
|
<view class="u-calendar__header__text" v-if="!slots.tooltip">
|
|
21
|
-
{{
|
|
21
|
+
{{ getToolTip }}
|
|
22
22
|
</view>
|
|
23
23
|
<slot v-else name="tooltip" />
|
|
24
24
|
</view>
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
class="u-calendar__content__item__lunar"
|
|
142
142
|
:style="{ color: activeColor }"
|
|
143
143
|
>
|
|
144
|
-
{{
|
|
144
|
+
{{ getStartText }}
|
|
145
145
|
</view>
|
|
146
146
|
<!-- 范围选择结束日期显示"结束" -->
|
|
147
147
|
<view
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
class="u-calendar__content__item__lunar"
|
|
153
153
|
:style="{ color: activeColor }"
|
|
154
154
|
>
|
|
155
|
-
{{
|
|
155
|
+
{{ getEndText }}
|
|
156
156
|
</view>
|
|
157
157
|
<!-- 节日名称 -->
|
|
158
158
|
<view
|
|
@@ -275,7 +275,6 @@ const weekdayArr = ref<number[]>([]);
|
|
|
275
275
|
const days = ref(0);
|
|
276
276
|
const daysArr = ref<number[]>([]);
|
|
277
277
|
const lunarArr = ref<any[]>([]);
|
|
278
|
-
const showTitle = ref('');
|
|
279
278
|
const year = ref(2020);
|
|
280
279
|
const month = ref(0);
|
|
281
280
|
// 当前月有多少天
|
|
@@ -347,6 +346,12 @@ const btnDisable = computed(() => {
|
|
|
347
346
|
return disable;
|
|
348
347
|
});
|
|
349
348
|
|
|
349
|
+
// 国际化计算属性
|
|
350
|
+
const getStartText = computed(() => props.startText || t('uCalendar.startText'));
|
|
351
|
+
const getEndText = computed(() => props.endText || t('uCalendar.endText'));
|
|
352
|
+
const getToolTip = computed(() => props.toolTip || t('uCalendar.toolTip'));
|
|
353
|
+
const showTitle = computed(() => `${year.value}${t('uCalendar.year')}${month.value}${t('uCalendar.month')}`);
|
|
354
|
+
|
|
350
355
|
watch([dataChange, lunarChange], () => {
|
|
351
356
|
init();
|
|
352
357
|
});
|
|
@@ -812,7 +817,6 @@ function changeData() {
|
|
|
812
817
|
daysArr.value = generateArray(1, days.value);
|
|
813
818
|
weekday.value = getWeekday(year.value, month.value);
|
|
814
819
|
weekdayArr.value = generateArray(1, weekday.value);
|
|
815
|
-
showTitle.value = `${year.value}${t('uCalendar.year')}${month.value}${t('uCalendar.month')}`;
|
|
816
820
|
if (props.showLunar) {
|
|
817
821
|
lunarArr.value = [];
|
|
818
822
|
daysArr.value.forEach(d => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { InputAlign, InputConfirmType, InputType, SizeType } from '../../types/global';
|
|
3
|
-
import { useLocale } from '../../';
|
|
4
|
-
|
|
5
|
-
const { t } = useLocale();
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* u-input 组件 props 类型定义
|
|
@@ -43,7 +40,7 @@ export const InputProps = {
|
|
|
43
40
|
/** placeholder显示值(默认 '请输入内容') */
|
|
44
41
|
placeholder: {
|
|
45
42
|
type: String,
|
|
46
|
-
default:
|
|
43
|
+
default: ''
|
|
47
44
|
},
|
|
48
45
|
/** 是否禁用输入框(默认false) */
|
|
49
46
|
disabled: {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
class="u-input__input u-input__textarea"
|
|
22
22
|
:style="getStyle"
|
|
23
23
|
:value="inputValue"
|
|
24
|
-
:placeholder="
|
|
24
|
+
:placeholder="getPlaceholder"
|
|
25
25
|
:placeholderStyle="getPlaceholderStyle"
|
|
26
26
|
:disabled="disabled"
|
|
27
27
|
:readonly="readonly"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
:style="getStyle"
|
|
48
48
|
:value="inputValue"
|
|
49
49
|
:password="type == 'password' && !showPassword"
|
|
50
|
-
:placeholder="
|
|
50
|
+
:placeholder="getPlaceholder"
|
|
51
51
|
:placeholderStyle="getPlaceholderStyle"
|
|
52
52
|
:disabled="disabled || type === 'select'"
|
|
53
53
|
:readonly="readonly"
|
|
@@ -126,13 +126,15 @@ export default {
|
|
|
126
126
|
|
|
127
127
|
<script setup lang="ts">
|
|
128
128
|
import { ref, computed, watch } from 'vue';
|
|
129
|
-
import { $u, useChildren } from '../..';
|
|
129
|
+
import { $u, useChildren, useLocale } from '../..';
|
|
130
130
|
import { InputProps } from './types';
|
|
131
131
|
import type { SizeType } from '../../types/global';
|
|
132
132
|
|
|
133
133
|
const props = defineProps(InputProps);
|
|
134
134
|
const emit = defineEmits(['update:modelValue', 'input', 'blur', 'focus', 'confirm', 'click']);
|
|
135
135
|
|
|
136
|
+
const { t } = useLocale();
|
|
137
|
+
|
|
136
138
|
const { emitToParent } = useChildren('u-input', 'u-form-item');
|
|
137
139
|
const { parentExposed } = useChildren('u-input', 'u-form');
|
|
138
140
|
|
|
@@ -262,6 +264,8 @@ const getCursorSpacing = computed(() => Number(props.cursorSpacing));
|
|
|
262
264
|
const uSelectionStart = computed(() => String(props.selectionStart));
|
|
263
265
|
// 光标结束位置
|
|
264
266
|
const uSelectionEnd = computed(() => String(props.selectionEnd));
|
|
267
|
+
// placeholder 国际化
|
|
268
|
+
const getPlaceholder = computed(() => props.placeholder || t('uInput.placeholder'));
|
|
265
269
|
|
|
266
270
|
/**
|
|
267
271
|
* change 事件
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { useLocale } from '../../';
|
|
3
|
-
|
|
4
|
-
const { t } = useLocale();
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
4
|
* u-keyboard 组件 Props 类型定义
|
|
@@ -35,9 +32,9 @@ export const KeyboardProps = {
|
|
|
35
32
|
/** z-index值 */
|
|
36
33
|
zIndex: { type: [Number, String] as PropType<string | number>, default: '' },
|
|
37
34
|
/** 取消按钮的文字 */
|
|
38
|
-
cancelText: { type: String, default:
|
|
35
|
+
cancelText: { type: String, default: '' },
|
|
39
36
|
/** 确认按钮的文字 */
|
|
40
|
-
confirmText: { type: String, default:
|
|
37
|
+
confirmText: { type: String, default: '' }
|
|
41
38
|
};
|
|
42
39
|
|
|
43
40
|
export type KeyboardProps = ExtractPropTypes<typeof KeyboardProps>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<slot />
|
|
14
14
|
<view class="u-tooltip" v-if="tooltip">
|
|
15
15
|
<view class="u-tooltip-item u-tooltip-cancel" hover-class="u-tooltip-cancel-hover" @tap="onCancel">
|
|
16
|
-
{{ cancelBtn ?
|
|
16
|
+
{{ cancelBtn ? getCancelText : '' }}
|
|
17
17
|
</view>
|
|
18
18
|
<view v-if="showTips" class="u-tooltip-item u-tooltip-tips">
|
|
19
19
|
{{
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
class="u-tooltip-item u-tooltips-submit"
|
|
33
33
|
hover-class="u-tooltips-submit-hover"
|
|
34
34
|
>
|
|
35
|
-
{{ confirmBtn ?
|
|
35
|
+
{{ confirmBtn ? getConfirmText : '' }}
|
|
36
36
|
</view>
|
|
37
37
|
</view>
|
|
38
38
|
<block v-if="mode == 'number' || mode == 'card'">
|
|
@@ -99,6 +99,10 @@ const { t } = useLocale();
|
|
|
99
99
|
|
|
100
100
|
const uZIndex = computed(() => (props.zIndex ? props.zIndex : $u.zIndex.popup));
|
|
101
101
|
|
|
102
|
+
// 国际化计算属性
|
|
103
|
+
const getCancelText = computed(() => props.cancelText || t('uKeyboard.cancelText'));
|
|
104
|
+
const getConfirmText = computed(() => props.confirmText || t('uKeyboard.confirmText'));
|
|
105
|
+
|
|
102
106
|
const popupValue = computed({
|
|
103
107
|
get: () => props.modelValue,
|
|
104
108
|
set: (val: boolean) => emit('update:modelValue', val)
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { getColor
|
|
3
|
-
|
|
4
|
-
const { t } = useLocale();
|
|
2
|
+
import { getColor } from '../../';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* u-link 组件 props 类型定义
|
|
@@ -31,7 +29,7 @@ export const LinkProps = {
|
|
|
31
29
|
/** 小程序中复制到粘贴板的提示语 */
|
|
32
30
|
mpTips: {
|
|
33
31
|
type: String,
|
|
34
|
-
default:
|
|
32
|
+
default: ''
|
|
35
33
|
},
|
|
36
34
|
/** 下划线颜色 */
|
|
37
35
|
lineColor: {
|
|
@@ -27,8 +27,9 @@ export default {
|
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<script setup lang="ts">
|
|
30
|
-
import { $u } from '../..';
|
|
30
|
+
import { $u, useLocale } from '../..';
|
|
31
31
|
import { LinkProps } from './types';
|
|
32
|
+
import { computed } from 'vue';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* link 超链接
|
|
@@ -45,6 +46,11 @@ import { LinkProps } from './types';
|
|
|
45
46
|
const props = defineProps(LinkProps);
|
|
46
47
|
const emit = defineEmits(['click']);
|
|
47
48
|
|
|
49
|
+
const { t } = useLocale();
|
|
50
|
+
|
|
51
|
+
// 国际化计算属性
|
|
52
|
+
const getMpTips = computed(() => props.mpTips || t('uLink.mpTips'));
|
|
53
|
+
|
|
48
54
|
/**
|
|
49
55
|
* 打开链接方法
|
|
50
56
|
* 不同平台有不同表现形式
|
|
@@ -70,8 +76,8 @@ function openLink() {
|
|
|
70
76
|
data: props.href,
|
|
71
77
|
success: () => {
|
|
72
78
|
uni.hideToast();
|
|
73
|
-
if (typeof $u !== 'undefined' && $u.toast
|
|
74
|
-
$u.toast(
|
|
79
|
+
if (typeof $u !== 'undefined' && $u.toast) {
|
|
80
|
+
$u.toast(getMpTips.value);
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
});
|
|
@@ -53,11 +53,7 @@ export const LoadmoreProps = {
|
|
|
53
53
|
/** 显示的文字 */
|
|
54
54
|
loadText: {
|
|
55
55
|
type: Object as PropType<LoadmoreText>,
|
|
56
|
-
default: () => ({
|
|
57
|
-
loadmore: t('uLoadmore.loadmore'),
|
|
58
|
-
loading: t('uLoadmore.loading'),
|
|
59
|
-
nomore: t('uLoadmore.nomore')
|
|
60
|
-
})
|
|
56
|
+
default: () => ({})
|
|
61
57
|
},
|
|
62
58
|
/** 在“没有更多”状态下,是否显示粗点 */
|
|
63
59
|
isDot: {
|
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
|
|
52
52
|
<script setup lang="ts">
|
|
53
53
|
import { ref, computed } from 'vue';
|
|
54
|
-
import { $u } from '../..';
|
|
54
|
+
import { $u, useLocale } from '../..';
|
|
55
55
|
import { LoadmoreProps } from './types';
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -73,6 +73,7 @@ import { LoadmoreProps } from './types';
|
|
|
73
73
|
*/
|
|
74
74
|
const props = defineProps(LoadmoreProps);
|
|
75
75
|
const emits = defineEmits(['loadmore']);
|
|
76
|
+
const { t } = useLocale();
|
|
76
77
|
|
|
77
78
|
// 粗点
|
|
78
79
|
const dotText = ref('●');
|
|
@@ -105,10 +106,18 @@ const flowerStyle = computed(() => {
|
|
|
105
106
|
// 显示的提示文字
|
|
106
107
|
const showText = computed(() => {
|
|
107
108
|
let text = '';
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
// 获取国际化默认值
|
|
110
|
+
const defaultLoadText = {
|
|
111
|
+
loadmore: t('uLoadmore.loadmore'),
|
|
112
|
+
loading: t('uLoadmore.loading'),
|
|
113
|
+
nomore: t('uLoadmore.nomore')
|
|
114
|
+
};
|
|
115
|
+
// 合并用户传入的值和默认值
|
|
116
|
+
const loadText = { ...defaultLoadText, ...props.loadText };
|
|
117
|
+
if (props.status === 'loadmore') text = loadText.loadmore;
|
|
118
|
+
else if (props.status === 'loading') text = loadText.loading;
|
|
110
119
|
else if (props.status === 'nomore' && props.isDot) text = dotText.value;
|
|
111
|
-
else text =
|
|
120
|
+
else text = loadText.nomore;
|
|
112
121
|
return text;
|
|
113
122
|
});
|
|
114
123
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { getColor
|
|
3
|
-
|
|
4
|
-
const { t } = useLocale();
|
|
2
|
+
import { getColor } from '../../';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* u-modal 组件 props 类型定义
|
|
@@ -31,7 +29,7 @@ export const ModalProps = {
|
|
|
31
29
|
/** 标题 */
|
|
32
30
|
title: {
|
|
33
31
|
type: String,
|
|
34
|
-
default:
|
|
32
|
+
default: ''
|
|
35
33
|
},
|
|
36
34
|
/** 弹窗宽度 */
|
|
37
35
|
width: {
|
|
@@ -61,12 +59,12 @@ export const ModalProps = {
|
|
|
61
59
|
/** 确认文案 */
|
|
62
60
|
confirmText: {
|
|
63
61
|
type: String,
|
|
64
|
-
default:
|
|
62
|
+
default: ''
|
|
65
63
|
},
|
|
66
64
|
/** 取消文案 */
|
|
67
65
|
cancelText: {
|
|
68
66
|
type: String,
|
|
69
|
-
default:
|
|
67
|
+
default: ''
|
|
70
68
|
},
|
|
71
69
|
/** 确认按钮颜色 */
|
|
72
70
|
confirmColor: {
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
<script setup lang="ts">
|
|
82
82
|
import { ref, computed, watch, useSlots, onMounted, onBeforeUnmount } from 'vue';
|
|
83
83
|
import { onPageHide, onPageShow } from '@dcloudio/uni-app';
|
|
84
|
-
import { $u } from '../..';
|
|
84
|
+
import { $u, useLocale } from '../..';
|
|
85
85
|
import { ModalProps } from './types';
|
|
86
86
|
import {
|
|
87
87
|
U_MODAL_EVENT_CLEAR_LOADING,
|
|
@@ -127,6 +127,9 @@ import {
|
|
|
127
127
|
const props = defineProps(ModalProps);
|
|
128
128
|
const emit = defineEmits(['update:modelValue', 'confirm', 'cancel']);
|
|
129
129
|
const slots = useSlots();
|
|
130
|
+
|
|
131
|
+
const { t } = useLocale();
|
|
132
|
+
|
|
130
133
|
// 是否已经初始化事件监听
|
|
131
134
|
const isInit = ref(false);
|
|
132
135
|
// 确认按钮是否正在加载中
|
|
@@ -191,6 +194,11 @@ const tempConfig = ref<Partial<ModalPayload>>({});
|
|
|
191
194
|
// 函数式调用时的内部显示状态(用于 global 模式)
|
|
192
195
|
const internalShow = ref(false);
|
|
193
196
|
|
|
197
|
+
// 国际化计算属性
|
|
198
|
+
const getTitle = computed(() => props.title || t('uModal.title'));
|
|
199
|
+
const getConfirmText = computed(() => props.confirmText || t('uModal.confirmText'));
|
|
200
|
+
const getCancelText = computed(() => props.cancelText || t('uModal.cancelText'));
|
|
201
|
+
|
|
194
202
|
// 有效的配置(函数式调用时合并 tempConfig 和 props,v-model 时使用 props)
|
|
195
203
|
const effectiveConfig = computed(() => {
|
|
196
204
|
// 如果有临时配置(函数式调用),合并用户配置与 props 默认值
|
|
@@ -201,10 +209,19 @@ const effectiveConfig = computed(() => {
|
|
|
201
209
|
result[key] = (tempConfig.value as Record<string, any>)[key] ?? (props as Record<string, any>)[key];
|
|
202
210
|
}
|
|
203
211
|
result.zIndex = tempConfig.value.zIndex ?? props.zIndex ?? $u.zIndex.popup;
|
|
212
|
+
// 处理国际化字段
|
|
213
|
+
result.title = result.title || t('uModal.title');
|
|
214
|
+
result.confirmText = result.confirmText || t('uModal.confirmText');
|
|
215
|
+
result.cancelText = result.cancelText || t('uModal.cancelText');
|
|
204
216
|
return result;
|
|
205
217
|
}
|
|
206
|
-
// v-model 直接控制时使用 props
|
|
207
|
-
return
|
|
218
|
+
// v-model 直接控制时使用 props,但处理国际化
|
|
219
|
+
return {
|
|
220
|
+
...props,
|
|
221
|
+
title: getTitle.value,
|
|
222
|
+
confirmText: getConfirmText.value,
|
|
223
|
+
cancelText: getCancelText.value
|
|
224
|
+
};
|
|
208
225
|
});
|
|
209
226
|
// 取消按钮样式
|
|
210
227
|
const cancelBtnStyle = computed(() => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import zIndex from '../../libs/config/zIndex';
|
|
3
|
-
import { useLocale } from '../../';
|
|
4
|
-
|
|
5
|
-
const { t } = useLocale();
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* u-no-network 组件 props 类型定义
|
|
@@ -12,7 +9,7 @@ export const NoNetworkProps = {
|
|
|
12
9
|
/** 页面文字提示 */
|
|
13
10
|
tips: {
|
|
14
11
|
type: String,
|
|
15
|
-
default:
|
|
12
|
+
default: ''
|
|
16
13
|
},
|
|
17
14
|
/** 一个z-index值,用于设置没有网络这个组件的层次 */
|
|
18
15
|
zIndex: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<view class="u-inner">
|
|
4
4
|
<image class="u-error-icon" :src="image" mode="widthFix"></image>
|
|
5
5
|
<view class="u-tips">
|
|
6
|
-
{{
|
|
6
|
+
{{ getTips }}
|
|
7
7
|
</view>
|
|
8
8
|
<!-- 只有APP平台,才能跳转设置页,因为需要调用plus环境 -->
|
|
9
9
|
<!-- #ifdef APP-PLUS -->
|
|
@@ -55,6 +55,9 @@ const props = defineProps(NoNetworkProps);
|
|
|
55
55
|
|
|
56
56
|
const { t } = useLocale();
|
|
57
57
|
|
|
58
|
+
// 国际化计算属性
|
|
59
|
+
const getTips = computed(() => props.tips || t('uNoNetwork.tips'));
|
|
60
|
+
|
|
58
61
|
const isConnected = ref(true); // 是否有网络连接
|
|
59
62
|
const networkType = ref<string>('none'); // 网络类型
|
|
60
63
|
const isIOS = ref(false); // 是否iOS平台
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { PaginationChangePayload } from '../../types/global';
|
|
2
|
-
import { useLocale } from '../../';
|
|
3
2
|
import type { PropType } from 'vue';
|
|
4
3
|
|
|
5
|
-
const { t } = useLocale();
|
|
6
|
-
|
|
7
4
|
/**
|
|
8
5
|
* pagination 分页类型定义
|
|
9
6
|
* @description 供 u-pagination 组件 props 使用
|
|
@@ -21,9 +18,9 @@ export const PaginationProps = {
|
|
|
21
18
|
default: ''
|
|
22
19
|
},
|
|
23
20
|
/** 左侧按钮文字 */
|
|
24
|
-
prevText: { type: String, default:
|
|
21
|
+
prevText: { type: String, default: '' },
|
|
25
22
|
/** 右侧按钮文字 */
|
|
26
|
-
nextText: { type: String, default:
|
|
23
|
+
nextText: { type: String, default: '' },
|
|
27
24
|
/** 总条目数 */
|
|
28
25
|
total: Number,
|
|
29
26
|
/** 每页数据量 */
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@click="handleChange('prev')"
|
|
11
11
|
>
|
|
12
12
|
<u-icon v-if="showIcon" :name="prevIcon"></u-icon>
|
|
13
|
-
<text v-else>{{
|
|
13
|
+
<text v-else>{{ getPrevText }}</text>
|
|
14
14
|
</u-button>
|
|
15
15
|
<view class="u-pagination-text">
|
|
16
16
|
<slot>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
@click="handleChange('next')"
|
|
30
30
|
>
|
|
31
31
|
<u-icon v-if="showIcon" :name="nextIcon"></u-icon>
|
|
32
|
-
<text v-else>{{
|
|
32
|
+
<text v-else>{{ getNextText }}</text>
|
|
33
33
|
</u-button>
|
|
34
34
|
</view>
|
|
35
35
|
</template>
|
|
@@ -51,7 +51,9 @@ export default {
|
|
|
51
51
|
import { computed } from 'vue';
|
|
52
52
|
import { type PaginationEmits, PaginationProps } from './types';
|
|
53
53
|
import type { PaginationDirection } from '../../types/global';
|
|
54
|
-
import { $u } from '../../';
|
|
54
|
+
import { $u, useLocale } from '../../';
|
|
55
|
+
|
|
56
|
+
const { t } = useLocale();
|
|
55
57
|
|
|
56
58
|
const props = defineProps(PaginationProps);
|
|
57
59
|
const emit = defineEmits<PaginationEmits>();
|
|
@@ -64,6 +66,10 @@ const totalPages = computed(() => {
|
|
|
64
66
|
return Math.ceil((props.total || 0) / size);
|
|
65
67
|
});
|
|
66
68
|
|
|
69
|
+
// 国际化计算属性
|
|
70
|
+
const getPrevText = computed(() => props.prevText || t('uPagination.prevText'));
|
|
71
|
+
const getNextText = computed(() => props.nextText || t('uPagination.nextText'));
|
|
72
|
+
|
|
67
73
|
// 切换分页
|
|
68
74
|
function handleChange(type: PaginationDirection) {
|
|
69
75
|
// 先计算新值,确保获取到的是更新后的值
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { PickerMode, PickerParams } from '../../types/global';
|
|
3
|
-
import { getColor
|
|
3
|
+
import { getColor } from '../../';
|
|
4
4
|
import zIndex from '../../libs/config/zIndex';
|
|
5
5
|
|
|
6
|
-
const { t } = useLocale();
|
|
7
|
-
|
|
8
6
|
const defaultParams: PickerParams = {
|
|
9
7
|
year: true,
|
|
10
8
|
month: true,
|
|
@@ -130,12 +128,12 @@ export const PickerProps = {
|
|
|
130
128
|
/** 取消按钮的文字 */
|
|
131
129
|
cancelText: {
|
|
132
130
|
type: String,
|
|
133
|
-
default:
|
|
131
|
+
default: ''
|
|
134
132
|
},
|
|
135
133
|
/** 确认按钮的文字 */
|
|
136
134
|
confirmText: {
|
|
137
135
|
type: String,
|
|
138
|
-
default:
|
|
136
|
+
default: ''
|
|
139
137
|
}
|
|
140
138
|
};
|
|
141
139
|
|