Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unmount vuejs instance from DOM

Tags:

vue.js

Is there any way to unmount vuejs Instance from DOM? I want to mount and unmount the Vue instance for suited condition.

like image 425
chougle saud Avatar asked Oct 29 '25 12:10

chougle saud


1 Answers

There is an vm.unmount() method on Vue 3 instance. If you are using Vue 2 you can use vm.$destroy().

If you are using file template you can use v-if condition on your component. That will remove element from DOM based on condition.

like image 80
Gurkan Ugurlu Avatar answered Nov 01 '25 03:11

Gurkan Ugurlu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!