mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-20 21:11:52 +00:00
fix disabled selects being selectable. fix #159
This commit is contained in:
parent
7d869f4402
commit
ecd920f3f8
3 changed files with 35 additions and 2 deletions
|
|
@ -193,7 +193,7 @@ $input-size: 32px;
|
|||
}
|
||||
|
||||
&.md-has-select:hover {
|
||||
.md-select:after {
|
||||
.md-select:not(.md-disabled):after {
|
||||
color: rgba(#000, .87);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,16 @@ $select-height: 32px;
|
|||
}
|
||||
}
|
||||
|
||||
&.md-disabled {
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
user-drag: none;
|
||||
|
||||
&:after {
|
||||
color: rgba(#000, .38);
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
position: absolute;
|
||||
left: -999em;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<select :name="name" :id="id" :required="required" tabindex="-1">
|
||||
<select :name="name" :id="id" :required="required" :disabled="disabled" tabindex="-1">
|
||||
<option :value="value">{{ value }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -43,6 +43,8 @@
|
|||
},
|
||||
computed: {
|
||||
classes() {
|
||||
console.log(this.disabled);
|
||||
|
||||
return {
|
||||
'md-disabled': this.disabled
|
||||
};
|
||||
|
|
@ -58,9 +60,27 @@
|
|||
watch: {
|
||||
value(value) {
|
||||
this.setTextAndValue(value);
|
||||
},
|
||||
disabled() {
|
||||
this.setParentDisabled();
|
||||
},
|
||||
required() {
|
||||
this.setParentRequired();
|
||||
},
|
||||
placeholder() {
|
||||
this.setParentPlaceholder();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setParentDisabled() {
|
||||
this.parentContainer.isDisabled = this.disabled;
|
||||
},
|
||||
setParentRequired() {
|
||||
this.parentContainer.isRequired = this.required;
|
||||
},
|
||||
setParentPlaceholder() {
|
||||
this.parentContainer.hasPlaceholder = !!this.placeholder;
|
||||
},
|
||||
getSingleValue(value) {
|
||||
let output = {};
|
||||
|
||||
|
|
@ -144,6 +164,9 @@
|
|||
this.setTextAndValue(this.value);
|
||||
|
||||
if (this.parentContainer) {
|
||||
this.setParentDisabled();
|
||||
this.setParentRequired();
|
||||
this.setParentPlaceholder();
|
||||
this.parentContainer.setValue(this.value);
|
||||
this.parentContainer.hasSelect = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue