Commit a8abe07f authored by Cyril Su's avatar Cyril Su Committed by 杨奕

Input: bind id only when given (#10360)

parent 8c2afa57
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
:readonly="!editable || readonly" :readonly="!editable || readonly"
:disabled="pickerDisabled" :disabled="pickerDisabled"
:size="pickerSize" :size="pickerSize"
:id="id"
:name="name" :name="name"
v-bind="firstInputId"
v-if="!ranged" v-if="!ranged"
v-clickoutside="handleClose" v-clickoutside="handleClose"
:placeholder="placeholder" :placeholder="placeholder"
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
:placeholder="startPlaceholder" :placeholder="startPlaceholder"
:value="displayValue && displayValue[0]" :value="displayValue && displayValue[0]"
:disabled="pickerDisabled" :disabled="pickerDisabled"
:id="id && id[0]" v-bind="firstInputId"
:readonly="!editable || readonly" :readonly="!editable || readonly"
:name="name && name[0]" :name="name && name[0]"
@input="handleStartInput" @input="handleStartInput"
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
:placeholder="endPlaceholder" :placeholder="endPlaceholder"
:value="displayValue && displayValue[1]" :value="displayValue && displayValue[1]"
:disabled="pickerDisabled" :disabled="pickerDisabled"
:id="id && id[1]" v-bind="secondInputId"
:readonly="!editable || readonly" :readonly="!editable || readonly"
:name="name && name[1]" :name="name && name[1]"
@input="handleEndInput" @input="handleEndInput"
...@@ -492,6 +492,28 @@ export default { ...@@ -492,6 +492,28 @@ export default {
pickerDisabled() { pickerDisabled() {
return this.disabled || (this.elForm || {}).disabled; return this.disabled || (this.elForm || {}).disabled;
},
firstInputId() {
const obj = {};
let id;
if (this.ranged) {
id = this.id && this.id[0];
} else {
id = this.id;
}
if (id) obj.id = id;
return obj;
},
secondInputId() {
const obj = {};
let id;
if (this.ranged) {
id = this.id && this.id[1];
}
if (id) obj.id = id;
return obj;
} }
}, },
......
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