Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

Fadeout row

I have a VueJS table where I have a delete button. I would like to fade out a row after deletion. My code is like below.

<template>
    <table>
        <thead class="thead-light">
            <tr>
                <th>date</th>                                                            
                <th>Action</th>
            </tr>
        </thead>
        <tbody id="set-rows">                                
            <tr :key="time.id" v-for='time in times'>                                    
                <td>{{ date }}</td>                 
                <td> 
                    <button type="button" class="btn btn-sm btn-danger" v-on:click="deleteTime(time.id)">
                        <i class="tio-delete-outlined"></i>
                    </button>    
                </td> 
            </tr>
        </tbody>
    </table>  
</template>

<script>
    export default {
        methods:{
            deleteTime: function (time_id) {
                axios.post('/api/v1/deleteTime/' + time_id)
                    .then(function (response) { }); 
            }
        },
    }
</script>
0 likes
3 replies
vincent15000's avatar

@afoysal Have you seen the first code in the documentation ?

<button @click="show = !show">Toggle</button>
<Transition>
  <p v-if="show">hello</p>
</Transition>

You can for example hide the row before deleting the data.

<Transition>
	<tr v-if="show[index]">
		<td>
			<button @click="delete(id, index)">Delete</button>
		</td>
	</tr>
</Transition>

As you have several rows, you need a specific variable for each one, you can for example use an array of variables.

Then in the delete method, you can manage to toggle the show[index] value and then delete the row in the database.

Please or to participate in this conversation.