H
H
hackuun2018-07-13 18:03:10
Vue.js
hackuun, 2018-07-13 18:03:10

Why is the component not destroyed when the condition is met?

There is a component

<section v-if="$route.name === 'index'">
   ...
</section>

Why is it not destroyed when switching to another route? How can I force it to reload when the condition is met?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
floydback, 2018-07-21
@floydback

Vue caches this for optimization. To force Vue to re-render a component, use :key on the component, with a unique value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question