网上有用的解决方法:vue 国际化在弹出框中$t()报错:TypeError: Cannot read property '_t' of undefined
大佬给出的解决方法:
弹窗是一个新的Vue对象,只需要单独给弹窗重新绑定i18n即可。
代码:
// dialog/main.js
import customDialog from './dialog.vue'
import i18n from '@/i18n'
const NewDialog = Vue.extend(customDialog)
function 弹窗工厂(config) {
// 具体代码参考elementui弹窗源码
...
...
const Dialog = function (options) {
...
const instance = new NewDialog ({
i18n,
data
})
instance.$mount()
....
}
....
return Dialog
}
export default 弹窗工厂
- TypeError undefined property Cannot 问题typeerror undefined property cannot properties typeerror undefined reading properties typeerror undefined uncaught properties undefined reading cannot properties typeerror reading cannot typeerror non-mysql undefined property typeerror undefined property webpack typeerror undefined uncaught property typeerror undefined property upgrade quot properties typeerror undefined