Merge pull request #50 from kristianmandrup/master

pass on  DOM event for checkbox and radio
This commit is contained in:
Marcos Moura 2016-11-11 17:35:30 -02:00 committed by GitHub
commit dd8773f5ac
2 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,6 @@
<template>
<div class="md-checkbox" :class="classes">
<div class="md-checkbox-container" @click="toggleCheck" v-md-ink-ripple="disabled">
<div class="md-checkbox-container" @click="toggleCheck($event)" v-md-ink-ripple="disabled">
<input type="checkbox" :name="name" :id="id" :disabled="disabled" :value="value">
</div>
@ -34,11 +34,11 @@
}
},
methods: {
toggleCheck() {
toggleCheck($event) {
if (!this.disabled) {
this.checked = !this.checked;
this.$emit('change', this.checked);
this.$emit('input', this.checked);
this.$emit('change', this.checked, $event);
this.$emit('input', this.checked, $event);
}
}
}

View file

@ -1,6 +1,6 @@
<template>
<div class="md-radio" :class="classes">
<div class="md-radio-container" @click="toggleCheck" v-md-ink-ripple="disabled">
<div class="md-radio-container" @click="toggleCheck($event)" v-md-ink-ripple="disabled">
<input type="radio" :name="name" :id="id" :disabled="disabled" :value="value">
</div>
@ -33,10 +33,10 @@
}
},
methods: {
toggleCheck() {
toggleCheck($event) {
if (!this.disabled) {
this.$emit('change', this.mdValue);
this.$emit('input', this.mdValue);
this.$emit('change', this.mdValue, $event);
this.$emit('input', this.mdValue, $event);
}
}
}