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