Skip to content

Commit

Permalink
🐛 bug(extend): fix TypeError: Cannot redefine property: $i18n (#422) by
Browse files Browse the repository at this point in the history
@HadiChen

* fix TypeError: Cannot redefine property: $i18n

fix #421

* flow:$FlowFixMe with object literal
  • Loading branch information
HadiChan authored and kazupon committed Oct 14, 2018
1 parent 43931f5 commit cb19082
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/extend.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* @flow */

export default function extend (Vue: any): void {
// $FlowFixMe
Object.defineProperty(Vue.prototype, '$i18n', {
get () { return this._i18n }
})
if (!Vue.prototype.hasOwnProperty('$i18n')) {
// $FlowFixMe
Object.defineProperty(Vue.prototype, '$i18n', {
get () { return this._i18n }
})
}

Vue.prototype.$t = function (key: Path, ...values: any): TranslateResult {
const i18n = this.$i18n
Expand Down

0 comments on commit cb19082

Please sign in to comment.