Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit cc362a3

Browse files
committed
⚡ improvement(mixin): release i18n instance
1 parent 8187eca commit cc362a3

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/mixin.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,9 @@ export default {
4848
// root i18n
4949
this.$i18n = this.$root.$i18n
5050
}
51+
},
52+
53+
beforeDestroy () {
54+
this.$i18n = null
5155
}
5256
}

test/unit/component.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ describe('component translation', () => {
8585
assert.equal(child1Fallback.textContent, 'fallback')
8686
assert.equal(child2.textContent, 'root')
8787
assert.equal(subChild1.textContent, 'root')
88+
vm.$destroy()
89+
}).then(() => {
90+
assert(vm.$i18n === null)
8891
}).then(done)
8992
})
9093
})

0 commit comments

Comments
 (0)