diff --git a/tool_uniapp.js b/tool_uniapp.js index 4660417..501955d 100644 --- a/tool_uniapp.js +++ b/tool_uniapp.js @@ -64,7 +64,7 @@ module.exports = { i18nText = i18nText || // 如果传入i18n参数 ({zhCN:'...', enUS:'...'}) 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)) { // 必须先检测是否标量值,如果直接返回 i18nText 可能返回{}等,导致依赖于返回空值的前端出错 return i18nText @@ -400,7 +400,7 @@ module.exports = { filePath = tempFilePaths?.[0] // #endif // #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 } else { // #ifdef WEB @@ -421,7 +421,7 @@ module.exports = { filePath = tempFilePaths?.[0] // #endif // #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 } @@ -582,7 +582,7 @@ module.exports = { cloudPath = `WEB_${wo.envar._clientInfo.osName}_${random}${path.extname(tempFiles?.[0]?.name || '')}` // name is available in H5 only. 只包含文件名和后缀名,不包含路径。 // #endif // #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 }