[Vuejs]-V-show and other stuff like this does not work on <template>

0👍

Ok everyone!

I found my mistake! It’s a very novice error :

data: {
    isShow: true
  }

Don’t gonna work , I think i understand why. If I use my react notions I could just suppose it’s because of the ‘state’ of the component (WOAW so obvious sorry but it’s my first time on vue, I learn about my mistakes) but after few documentations I learn more about vue and data like it written above is work as a function and not as an object like I though.

Like this:

data() {
    return { isShow: true }
  }

In fact that’s because each time you use a component, a new instance of it is created. So the component have him own state so if you got 50 render of the same component they ll have they own properties.
What a big misunderstood but know i figured out what was my problem it’s look very logic and natural! I’m happy for that!

Hopefully this response will help some novice like me.

Thx everyone who’s tried to help me.

Leave a comment