diff --git a/index.js b/index.js index c91a3f1..cebd380 100644 --- a/index.js +++ b/index.js @@ -403,7 +403,7 @@ export default { showToast({ tool, type, image, title, duration = 2000, ...rest }) { const pageNow = this?.$store ? this // 对于组件内定义的 i18nText,要使用 this 来获得组建内的 i18nText,而不是 getCurrentPages[...] 去访问全局页面的 i18nText。 : getCurrentPages()[getCurrentPages().length - 1] - if (tool === 'uni' || !(pageNow.$refs && pageNow.$refs.toast)) { + if (tool === 'uni' || ! pageNow?.$refs?.toast) { // #ifdef APP-PLUS uni.showToast({ icon: 'none', title, duration, ...rest }) // #endif