Skip to content

Commit c6715ed

Browse files
authored
fix: null access on mount hook (#876)
related: #793 #873
1 parent 8a8b034 commit c6715ed

File tree

1 file changed

+11
-9
lines changed
  • packages/vue-i18n-core/src/mixins

1 file changed

+11
-9
lines changed

packages/vue-i18n-core/src/mixins/next.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,17 @@ export function defineMixin(
100100
},
101101

102102
mounted(): void {
103-
/* istanbul ignore if */
104-
if ((__DEV__ || __FEATURE_PROD_VUE_DEVTOOLS__) && !__NODE_JS__) {
105-
this.$el.__VUE_I18N__ = this.$i18n.__composer
106-
const emitter: VueDevToolsEmitter = (this.__v_emitter =
107-
createEmitter<VueDevToolsEmitterEvents>())
108-
const _vueI18n = this.$i18n as unknown as VueI18nInternal
109-
_vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter)
110-
emitter.on('*', addTimelineEvent)
111-
}
103+
nextTick(() => {
104+
/* istanbul ignore if */
105+
if ((__DEV__ || __FEATURE_PROD_VUE_DEVTOOLS__) && !__NODE_JS__) {
106+
this.$el.__VUE_I18N__ = this.$i18n.__composer
107+
const emitter: VueDevToolsEmitter = (this.__v_emitter =
108+
createEmitter<VueDevToolsEmitterEvents>())
109+
const _vueI18n = this.$i18n as unknown as VueI18nInternal
110+
_vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter)
111+
emitter.on('*', addTimelineEvent)
112+
}
113+
})
112114
},
113115

114116
unmounted(): void {

0 commit comments

Comments
 (0)