Skip to content

Commit

Permalink
fix: compatible with vue old version inject
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxiong10 committed Nov 13, 2019
1 parent c7fd2df commit c03632f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/mixin/format.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { format } from 'date-format-parse';
import { getLocale } from '../locale';
import LocaleMixin from './locale';

export default {
inject: {
locale: {
default: getLocale(),
},
},
mixins: [LocaleMixin],
methods: {
formatDate(date, fmt) {
return format(date, fmt, { locale: this.t('formatLocale') });
Expand Down
2 changes: 1 addition & 1 deletion src/mixin/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
methods: {
t(path) {
const arr = path.split('.');
let current = this.locale;
let current = this.locale || getLocale();
let value;
for (let i = 0, len = arr.length; i < len; i++) {
const prop = arr[i];
Expand Down

0 comments on commit c03632f

Please sign in to comment.