console
var app = new Vue({
el: '#app',
data() {
return {
args: [],
formEdit: {}
}
},
watch: {
'formEditComputed': {
handler: function(newVal, oldVal) {
console.log(oldVal);
console.log(newVal);
}
}
},
computed: {
formEditComputed() {
return {
answer_rule: this.formEdit.answer_rule
}
}
},
methods: {
click1(row) {
this.formEdit = row;
}
},
mounted() {
axios.get('http://httpbin.org/get?answer_rule=2').then(response => {
this.args = [response.data.args];
}).catch(function (error) {
console.log(error);
});
}
});
<div id="app">
<div v-for="(r,k) in args" :key="k">
<button @click="click1(r)">{{r}}</button>
</div>
{{formEditComputed.answer_rule}}
</div>