mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-22 05:51:52 +00:00
Rename change method and simplify the slot check
This commit is contained in:
parent
5044f35d26
commit
7f53a13f6d
2 changed files with 1 additions and 14 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<input type="checkbox" :name="name" :id="id" :disabled="disabled" :value="value">
|
||||
</div>
|
||||
|
||||
<label :for="id || name" class="md-checkbox-label" v-if="hasSlot">
|
||||
<label :for="id || name" class="md-checkbox-label" v-if="$slots.default">
|
||||
<slot></slot>
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -22,7 +22,6 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
hasSlot: true,
|
||||
checked: this.value
|
||||
};
|
||||
},
|
||||
|
|
@ -42,13 +41,6 @@
|
|||
this.$emit('input', this.checked);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.value) {
|
||||
this.checked = true;
|
||||
}
|
||||
|
||||
this.hasSlot = this.$el.querySelector('label').innerHTML.trim() !== '';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@
|
|||
return {
|
||||
checkbox: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onChange(change) {
|
||||
console.log('Change', change);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue