Rename change method and simplify the slot check

This commit is contained in:
Marcos Moura 2016-09-05 22:10:58 -03:00
parent 5044f35d26
commit 7f53a13f6d
2 changed files with 1 additions and 14 deletions

View file

@ -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>

View file

@ -42,11 +42,6 @@
return {
checkbox: true
};
},
methods: {
onChange(change) {
console.log('Change', change);
}
}
};
</script>