2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-19 21:20:36 +03:00

fix: compatible with vue old version inject

This commit is contained in:
mengxiong10
2019-11-13 15:25:09 +08:00
parent c7fd2df175
commit c03632fa87
2 changed files with 3 additions and 7 deletions
+2 -6
View File
@@ -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') });
+1 -1
View File
@@ -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];