
hi,what i want the result is once i click the icon it will update the database status from 0 to 1, icon color change to green and click again it will go back from 1 to 0 and icon color change from green to grey in bootstrap vue
<b-card v-else style="border:none;" >
<b-row v-for="(data,index) in my_name" :key="index" class=" p-3 bg-light" style="margin-bottom: 30px;" >
<b-col cols="12">
<b-row>
<b-col class="font-weight-bold">{{data.name}}<br><span class="font-weight-normal" style="color:#817F7F;"> </b-col>
<b-col class="mt-3 mb-0 view-more d-flex align-items-center justify-content-end" @click="changeStatus(data.id)">
<b-icon v-if="data.status=='done'" icon="check-circle-fill" font-scale="2" variant="success"></b-icon>
<b-icon v-else icon="check-circle-fill" font-scale="2" variant="secondary" ></b-icon>
</b-col>
</b-row>
</b-col>
</b-row>
</b-card>
export default {
data: () => ({
my_name:[],
}),
created(){
},
methods: {
changeStatus(id) {
axios.post('/api/name/update_my_name',{id,id}).then(res => res.data).then(res => {
if(this.res.data.status =='0'){
this.res.data.status == '1'
}
else{
this.res.data.status == '0'
}
})
.catch((error) => {
let error_msg = error.res.data.message;
this.$bvToast.toast(error_msg,{ variant:'danger', noCloseButton: true, solid:true})
this.loading = false;
});
},
}