fix(yuyue-date): 修复国际化语言key的命名不一致问题
将所有组件内的语言key从components.yuyueDate改为components.yuyue-date,统一命名格式,确保多语言配置可以正确加载对应文案。
This commit is contained in:
@@ -39,13 +39,13 @@ export function timeStamp(time) {
|
||||
const hour = dates.getHours()
|
||||
const min = dates.getMinutes()
|
||||
const weekDays = [
|
||||
$lang('components.yuyueDate.weekSunday'),
|
||||
$lang('components.yuyueDate.weekMonday'),
|
||||
$lang('components.yuyueDate.weekTuesday'),
|
||||
$lang('components.yuyueDate.weekWednesday'),
|
||||
$lang('components.yuyueDate.weekThursday'),
|
||||
$lang('components.yuyueDate.weekFriday'),
|
||||
$lang('components.yuyueDate.weekSaturday'),
|
||||
$lang('components.yuyue-date.weekSunday'),
|
||||
$lang('components.yuyue-date.weekMonday'),
|
||||
$lang('components.yuyue-date.weekTuesday'),
|
||||
$lang('components.yuyue-date.weekWednesday'),
|
||||
$lang('components.yuyue-date.weekThursday'),
|
||||
$lang('components.yuyue-date.weekFriday'),
|
||||
$lang('components.yuyue-date.weekSaturday'),
|
||||
]
|
||||
return {
|
||||
allDate: `${year}/${strFormat(month)}/${strFormat(date)}`,
|
||||
@@ -63,9 +63,9 @@ export function initData(appointedDay = '') {
|
||||
const now = date.getTime() //获取当前日期的时间戳
|
||||
let timeStr = 3600 * 24 * 1000 //一天的时间戳
|
||||
let obj = {
|
||||
0: $lang('components.yuyueDate.today'),
|
||||
1: $lang('components.yuyueDate.tomorrow'),
|
||||
2: $lang('components.yuyueDate.dayAfterTomorrow')
|
||||
0: $lang('components.yuyue-date.today'),
|
||||
1: $lang('components.yuyue-date.tomorrow'),
|
||||
2: $lang('components.yuyue-date.dayAfterTomorrow')
|
||||
}
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const timeObj = {}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</scroll-view>
|
||||
<div class="appointed-day">
|
||||
<uni-datetime-picker type="date" :start="pickerStartDay" :end="pickerEndDay" @change="change">
|
||||
<text class="day-box">{{ $lang('components.yuyueDate.appointedDate') }}</text>
|
||||
<text class="day-box">{{ $lang('components.yuyue-date.appointedDate') }}</text>
|
||||
<text class="iconfont iconyoujiantou"></text>
|
||||
</uni-datetime-picker>
|
||||
</div>
|
||||
@@ -191,24 +191,24 @@
|
||||
disableTextI18n() {
|
||||
return this.disableText && this.disableText !== '已约满'
|
||||
? this.disableText
|
||||
: this.$lang('components.yuyueDate.fullyBooked');
|
||||
: this.$lang('components.yuyue-date.fullyBooked');
|
||||
},
|
||||
undisableTextI18n() {
|
||||
return this.undisableText && this.undisableText !== '可预约'
|
||||
? this.undisableText
|
||||
: this.$lang('components.yuyueDate.available');
|
||||
: this.$lang('components.yuyue-date.available');
|
||||
},
|
||||
// 周几名称数组(索引 0-6 对应周日到周六,与 Date.getDay() 返回值一致)
|
||||
// 用于显示层(Toast 等),会随语言切换
|
||||
weekBox() {
|
||||
return [
|
||||
this.$lang('components.yuyueDate.weekSunday'),
|
||||
this.$lang('components.yuyueDate.weekMonday'),
|
||||
this.$lang('components.yuyueDate.weekTuesday'),
|
||||
this.$lang('components.yuyueDate.weekWednesday'),
|
||||
this.$lang('components.yuyueDate.weekThursday'),
|
||||
this.$lang('components.yuyueDate.weekFriday'),
|
||||
this.$lang('components.yuyueDate.weekSaturday'),
|
||||
this.$lang('components.yuyue-date.weekSunday'),
|
||||
this.$lang('components.yuyue-date.weekMonday'),
|
||||
this.$lang('components.yuyue-date.weekTuesday'),
|
||||
this.$lang('components.yuyue-date.weekWednesday'),
|
||||
this.$lang('components.yuyue-date.weekThursday'),
|
||||
this.$lang('components.yuyue-date.weekFriday'),
|
||||
this.$lang('components.yuyue-date.weekSaturday'),
|
||||
];
|
||||
},
|
||||
// 中文周几名称数组(用于与 disableWeek prop 做数据匹配,保持兼容性)
|
||||
@@ -241,7 +241,7 @@
|
||||
let dayIndex = new Date(e).getDay();
|
||||
if (this.disableWeek.indexOf(this.weekBoxCn[dayIndex]) != -1) {
|
||||
uni.showToast({
|
||||
title: this.$lang('components.yuyueDate.weekdayCannotBook', { weekday: this.weekBox[dayIndex] }),
|
||||
title: this.$lang('components.yuyue-date.weekdayCannotBook', { weekday: this.weekBox[dayIndex] }),
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
@@ -307,7 +307,7 @@
|
||||
this.isSection && (item.isInclude = false);
|
||||
});
|
||||
|
||||
this.orderDateTime = isFullTime ? this.$lang('components.yuyueDate.noSelection') : this.selectDate;
|
||||
this.orderDateTime = isFullTime ? this.$lang('components.yuyue-date.noSelection') : this.selectDate;
|
||||
this.timeActive = -1;
|
||||
for (let i = 0, len = this.timeArr.length; i < len; i++) {
|
||||
if (!this.timeArr[i].disable) {
|
||||
@@ -327,7 +327,7 @@
|
||||
let dayIndex = new Date(item.timeStamp).getDay();
|
||||
if (this.disableWeek.indexOf(this.weekBoxCn[dayIndex]) != -1) {
|
||||
uni.showToast({
|
||||
title: this.$lang('components.yuyueDate.weekdayCannotBook', { weekday: this.weekBox[dayIndex] }),
|
||||
title: this.$lang('components.yuyue-date.weekdayCannotBook', { weekday: this.weekBox[dayIndex] }),
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user