Commit c856d926 authored by wacky6.AriesMBP's avatar wacky6.AriesMBP Committed by 杨奕

date-picker: support array for name attr

parent a76865fd
......@@ -47,6 +47,7 @@
:placeholder="startPlaceholder"
:value="displayValue && displayValue[0]"
:disabled="disabled"
:name="name && name[0]"
@input="handleStartInput"
@change="handleStartChange"
@focus="handleFocus"
......@@ -56,6 +57,7 @@
:placeholder="endPlaceholder"
:value="displayValue && displayValue[1]"
:disabled="disabled"
:name="name && name[1]"
@input="handleEndInput"
@change="handleEndChange"
@focus="handleFocus"
......@@ -266,6 +268,10 @@ const valueEquals = function(a, b) {
return false;
};
const isString = function(val) {
return typeof val === 'string' || val instanceof String;
};
export default {
mixins: [Emitter, NewPopper, Focus('reference')],
......@@ -283,7 +289,18 @@ export default {
placeholder: String,
startPlaceholder: String,
endPlaceholder: String,
name: String,
name: {
default: '',
validator(val) {
// either: String, Array of String, null / undefined
return (
val === null ||
val === undefined ||
isString(val) ||
(Array.isArray(val) && val.length === 2 && val.every(isString))
);
}
},
disabled: Boolean,
clearable: {
type: Boolean,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment