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:
+2
-6
@@ -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
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user