This commit is contained in:
luk 2025-12-09 20:41:30 +08:00
parent f9ffbb4989
commit 95c5416959

View File

@ -64,7 +64,7 @@ module.exports = {
i18nText = i18nText =
i18nText || // 如果传入i18n参数 ({zhCN:'...', enUS:'...'}) i18nText || // 如果传入i18n参数 ({zhCN:'...', enUS:'...'})
this.i18nText || // 1) 如果挂载到具体页面的 computed { lote: wo?.localizeText } 那么 this 就是当前页面,直接取用 this.i18nText 即可。2) 对于组件内定义的 i18nText要使用 this 来获得组件内的 i18nText this.i18nText || // 1) 如果挂载到具体页面的 computed { lote: wo?.localizeText } 那么 this 就是当前页面,直接取用 this.i18nText 即可。2) 对于组件内定义的 i18nText要使用 this 来获得组件内的 i18nText
getCurrentPages()?.pop()?.i18nText // 如果不是挂载到 Vue.prototype 而是 挂载到 wo 下调用,那么 this.i18nText 就不存在了。因此通过 pageNow.i18nText 访问。 getCurrentPages?.()?.pop?.()?.i18nText // 如果不是挂载到 Vue.prototype 而是 挂载到 wo 下调用,那么 this.i18nText 就不存在了。因此通过 pageNow.i18nText 访问。
if (['string', 'number', 'boolean'].includes(typeof i18nText)) { if (['string', 'number', 'boolean'].includes(typeof i18nText)) {
// 必须先检测是否标量值,如果直接返回 i18nText 可能返回{}等,导致依赖于返回空值的前端出错 // 必须先检测是否标量值,如果直接返回 i18nText 可能返回{}等,导致依赖于返回空值的前端出错
return i18nText return i18nText
@ -400,7 +400,7 @@ module.exports = {
filePath = tempFilePaths?.[0] filePath = tempFilePaths?.[0]
// #endif // #endif
// #ifndef WEB // #ifndef WEB
return { _state: 'UNSUPPORTED_FILETYPE', _msg: { zhCN: '请切换到网页端上传文件!', enUS: 'Please switch to WebApp to upload files.' } } return { _state: 'UNSUPPORTED_FILETYPE', _msg: { zhCN: '请切换到网页端上传文件!', enUS: 'Please switch to Web App to upload files.' } }
// #endif // #endif
} else { } else {
// #ifdef WEB // #ifdef WEB
@ -421,7 +421,7 @@ module.exports = {
filePath = tempFilePaths?.[0] filePath = tempFilePaths?.[0]
// #endif // #endif
// #ifndef WEB // #ifndef WEB
return { _state: 'UNSUPPORTED_FILETYPE', _msg: { zhCN: '请切换到网页端上传文件!', enUS: 'Please switch to WebApp to upload files.' } } return { _state: 'UNSUPPORTED_FILETYPE', _msg: { zhCN: '请切换到网页端上传文件!', enUS: 'Please switch to Web App to upload files.' } }
// #endif // #endif
} }
@ -582,7 +582,7 @@ module.exports = {
cloudPath = `WEB_${wo.envar._clientInfo.osName}_${random}${path.extname(tempFiles?.[0]?.name || '')}` // name is available in H5 only. 只包含文件名和后缀名,不包含路径。 cloudPath = `WEB_${wo.envar._clientInfo.osName}_${random}${path.extname(tempFiles?.[0]?.name || '')}` // name is available in H5 only. 只包含文件名和后缀名,不包含路径。
// #endif // #endif
// #ifndef WEB // #ifndef WEB
return { _state: 'UNSUPPORTED_FILETYPE', _msg: { zhCN: '请切换到网页端上传文件!', enUS: 'Please switch to WebApp to upload files.' } } return { _state: 'UNSUPPORTED_FILETYPE', _msg: { zhCN: '请切换到网页端上传文件!', enUS: 'Please switch to Web App to upload files.' } }
// #endif // #endif
} }