JSFiddle - React, Tailwind, and code Playground
by mattoconnell408
HTML
<script src="https://rawgit.com/yyx990803/vue/master/dist/vue.js"></script>
<div id="app">
<input type="checkbox" @change="change" v-model="isChecked">
<button :class="{ active: isActive }" @click="isActive = !isActive">
test</button>
{{isChecked}}
</div>
JavaScript
const test = {
count: 0
};
console.log(1, test);
const vm = new Vue({
el: '#app',
data() {
return {
isChecked: this.checked,
isActive: false,
testObj: {
count: 0
}
};
},
methods: {
change() {
this.testObj.count++;
console.log(this.testObj);
console.log({ ...this.testObj });
this.$emit('change', this.isChecked);
}
}
});
vm.$on('change', isChecked => console.log(isChecked));