fix(yuyue-date): 修复国际化语言key的命名不一致问题

将所有组件内的语言key从components.yuyueDate改为components.yuyue-date,统一命名格式,确保多语言配置可以正确加载对应文案。
This commit is contained in:
2026-07-03 14:06:00 +08:00
parent b93badedd4
commit 80d390886a
2 changed files with 23 additions and 23 deletions

View File

@@ -39,13 +39,13 @@ export function timeStamp(time) {
const hour = dates.getHours() const hour = dates.getHours()
const min = dates.getMinutes() const min = dates.getMinutes()
const weekDays = [ const weekDays = [
$lang('components.yuyueDate.weekSunday'), $lang('components.yuyue-date.weekSunday'),
$lang('components.yuyueDate.weekMonday'), $lang('components.yuyue-date.weekMonday'),
$lang('components.yuyueDate.weekTuesday'), $lang('components.yuyue-date.weekTuesday'),
$lang('components.yuyueDate.weekWednesday'), $lang('components.yuyue-date.weekWednesday'),
$lang('components.yuyueDate.weekThursday'), $lang('components.yuyue-date.weekThursday'),
$lang('components.yuyueDate.weekFriday'), $lang('components.yuyue-date.weekFriday'),
$lang('components.yuyueDate.weekSaturday'), $lang('components.yuyue-date.weekSaturday'),
] ]
return { return {
allDate: `${year}/${strFormat(month)}/${strFormat(date)}`, allDate: `${year}/${strFormat(month)}/${strFormat(date)}`,
@@ -63,9 +63,9 @@ export function initData(appointedDay = '') {
const now = date.getTime() //获取当前日期的时间戳 const now = date.getTime() //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000 //一天的时间戳 let timeStr = 3600 * 24 * 1000 //一天的时间戳
let obj = { let obj = {
0: $lang('components.yuyueDate.today'), 0: $lang('components.yuyue-date.today'),
1: $lang('components.yuyueDate.tomorrow'), 1: $lang('components.yuyue-date.tomorrow'),
2: $lang('components.yuyueDate.dayAfterTomorrow') 2: $lang('components.yuyue-date.dayAfterTomorrow')
} }
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
const timeObj = {} const timeObj = {}

View File

@@ -20,7 +20,7 @@
</scroll-view> </scroll-view>
<div class="appointed-day"> <div class="appointed-day">
<uni-datetime-picker type="date" :start="pickerStartDay" :end="pickerEndDay" @change="change"> <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> <text class="iconfont iconyoujiantou"></text>
</uni-datetime-picker> </uni-datetime-picker>
</div> </div>
@@ -191,24 +191,24 @@
disableTextI18n() { disableTextI18n() {
return this.disableText && this.disableText !== '已约满' return this.disableText && this.disableText !== '已约满'
? this.disableText ? this.disableText
: this.$lang('components.yuyueDate.fullyBooked'); : this.$lang('components.yuyue-date.fullyBooked');
}, },
undisableTextI18n() { undisableTextI18n() {
return this.undisableText && this.undisableText !== '可预约' return this.undisableText && this.undisableText !== '可预约'
? this.undisableText ? this.undisableText
: this.$lang('components.yuyueDate.available'); : this.$lang('components.yuyue-date.available');
}, },
// 周几名称数组(索引 0-6 对应周日到周六,与 Date.getDay() 返回值一致) // 周几名称数组(索引 0-6 对应周日到周六,与 Date.getDay() 返回值一致)
// 用于显示层(Toast 等),会随语言切换 // 用于显示层(Toast 等),会随语言切换
weekBox() { weekBox() {
return [ return [
this.$lang('components.yuyueDate.weekSunday'), this.$lang('components.yuyue-date.weekSunday'),
this.$lang('components.yuyueDate.weekMonday'), this.$lang('components.yuyue-date.weekMonday'),
this.$lang('components.yuyueDate.weekTuesday'), this.$lang('components.yuyue-date.weekTuesday'),
this.$lang('components.yuyueDate.weekWednesday'), this.$lang('components.yuyue-date.weekWednesday'),
this.$lang('components.yuyueDate.weekThursday'), this.$lang('components.yuyue-date.weekThursday'),
this.$lang('components.yuyueDate.weekFriday'), this.$lang('components.yuyue-date.weekFriday'),
this.$lang('components.yuyueDate.weekSaturday'), this.$lang('components.yuyue-date.weekSaturday'),
]; ];
}, },
// 中文周几名称数组(用于与 disableWeek prop 做数据匹配,保持兼容性) // 中文周几名称数组(用于与 disableWeek prop 做数据匹配,保持兼容性)
@@ -241,7 +241,7 @@
let dayIndex = new Date(e).getDay(); let dayIndex = new Date(e).getDay();
if (this.disableWeek.indexOf(this.weekBoxCn[dayIndex]) != -1) { if (this.disableWeek.indexOf(this.weekBoxCn[dayIndex]) != -1) {
uni.showToast({ 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' icon: 'none'
}) })
return false; return false;
@@ -307,7 +307,7 @@
this.isSection && (item.isInclude = false); 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; this.timeActive = -1;
for (let i = 0, len = this.timeArr.length; i < len; i++) { for (let i = 0, len = this.timeArr.length; i < len; i++) {
if (!this.timeArr[i].disable) { if (!this.timeArr[i].disable) {
@@ -327,7 +327,7 @@
let dayIndex = new Date(item.timeStamp).getDay(); let dayIndex = new Date(item.timeStamp).getDay();
if (this.disableWeek.indexOf(this.weekBoxCn[dayIndex]) != -1) { if (this.disableWeek.indexOf(this.weekBoxCn[dayIndex]) != -1) {
uni.showToast({ 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' icon: 'none'
}) })
return false; return false;