2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-25 06:50: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 { format } from 'date-format-parse';
import { getLocale } from '../locale'; import LocaleMixin from './locale';
export default { export default {
inject: { mixins: [LocaleMixin],
locale: {
default: getLocale(),
},
},
methods: { methods: {
formatDate(date, fmt) { formatDate(date, fmt) {
return format(date, fmt, { locale: this.t('formatLocale') }); return format(date, fmt, { locale: this.t('formatLocale') });
+1 -1
View File
@@ -9,7 +9,7 @@ export default {
methods: { methods: {
t(path) { t(path) {
const arr = path.split('.'); const arr = path.split('.');
let current = this.locale; let current = this.locale || getLocale();
let value; let value;
for (let i = 0, len = arr.length; i < len; i++) { for (let i = 0, len = arr.length; i < len; i++) {
const prop = arr[i]; const prop = arr[i];