WIP Изменила инпут, сделала документы
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
:readonly="readonly",
|
||||
:disable="disabled",
|
||||
mask="##.##.####",
|
||||
:rules="[checkInput]",
|
||||
:rules="[(val) => rule ? rule(val) : defaultRule(val)]",
|
||||
:lazy-rules="lazyRule",
|
||||
:item-aligned="itemAligned",
|
||||
no-error-icon,
|
||||
@@ -60,7 +60,8 @@ export default {
|
||||
width: Number,
|
||||
lazyRule: [Boolean, String],
|
||||
itemAligned: Boolean,
|
||||
modelValue: Date,
|
||||
rule: Function,
|
||||
modelValue: String,
|
||||
placeholder: String,
|
||||
disabled: Boolean,
|
||||
label: String,
|
||||
@@ -74,32 +75,21 @@ export default {
|
||||
return {
|
||||
calendarVisibility: false,
|
||||
internalDate: null,
|
||||
//internalValue: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
if (
|
||||
moment(this.modelValue).isValid() &&
|
||||
typeof this.modelValue === "object"
|
||||
) {
|
||||
this.changeInternalDate(moment(this.modelValue));
|
||||
return moment(this.modelValue).format("DD.MM.YYYY");
|
||||
}
|
||||
if (moment(this.convertFormat(this.modelValue)).isValid()) {
|
||||
this.changeInternalDate(moment(this.modelValue));
|
||||
return this.modelValue;
|
||||
}
|
||||
this.changeInternalDate(null);
|
||||
return null;
|
||||
},
|
||||
set(value) {
|
||||
this.$emit(
|
||||
"update:modelValue",
|
||||
moment(this.convertFormat(value)).isValid()
|
||||
? new Date(moment(this.convertFormat(value)))
|
||||
this.changeInternalDate(
|
||||
moment(this.convertFormat(this.modelValue)).isValid()
|
||||
? moment(this.convertFormat(this.modelValue))
|
||||
: null
|
||||
);
|
||||
return this.modelValue;
|
||||
},
|
||||
set(value) {
|
||||
this.$emit("update:modelValue", value);
|
||||
},
|
||||
},
|
||||
sizeVariable() {
|
||||
@@ -153,8 +143,8 @@ export default {
|
||||
? date.split(".").reverse().join("-")
|
||||
: null;
|
||||
},
|
||||
checkInput(val) {
|
||||
return moment(this.convertFormat(val)).isValid();
|
||||
defaultRule(val) {
|
||||
return !val || moment(this.convertFormat(val)).isValid();
|
||||
},
|
||||
closeCalendar() {
|
||||
this.calendarVisibility = false;
|
||||
|
||||
Reference in New Issue
Block a user