JSFiddle - React, Tailwind, and code Playground
by Damian Dulisz
HTML
<div id="app">
<input type="radio" :checked="checked === '1'" value="1" id="one" @change="update($event.target.value)">
<input type="radio" :checked="checked === '2'" value="2" id="two" @change="update($event.target.value)">
<input type="radio" :checked="checked === '3'" value="3" id="three" @change="update($event.target.value)">
{{ checked }}
<button @click="update('2')">make 2</button>
</div>
Babel + JSX
new Vue({
data () {
return {
checked: '1'
}
},
methods: {
update (value) {
this.checked = value
}
}
}).$mount('#app')