<template>
<div>
<input type="text" v-model="name">
<button :disabled="!name_changed">Сохранить</button>
<button :disabled="!name_changed" @click="get">Отмена</button>
</div>
</template>
<script>
export default {
data(){
return {
name:undefined,
name_changed:undefined
}
},
mounted(){
this.get();
},
methods:{
get(){
axios.get('any')
.then(resp=>{
this.name = resp.data.name;
this.name_changed = false;
this.$watch('name', () => this.name_changed = true);
})
}
}
}
</script>
<template>
<div>
<input type="text" v-model="name">
<button :disabled="!name_changed">Сохранить</button>
</div>
</template>
<script>
export default {
data(){
return {
name:undefined,
name_changed:undefined
}
},
watch:{
name(val, old){
this.name_changed = true;
}
},
mounted(){
axios.get('any')
.then(resp=>{
this.name = resp.data.name;
this.name_changed = false;
})
}
}
</script>
Провел работу над ошибками. Проблема решена