[Vuejs]-How do you switch all the other booleans to false when you click a button

0๐Ÿ‘

โœ…

I do not see any problem with using this method for transition between sections. It is up to your preference. You can write a method in order to manipulate two different data at the same time. It should look like this:

<script>
export default {
  data() {
    return {
      drawer: false,
      show: false,
      show2: false,
      cards: [{ name: "card 1" }, { name: "card 1" }, { name: "card 1" }],
    };
  },
  methods: {
    clickShowOne() {
            this.show2 = false;
            this.show = !this.show;
        },
        clickShowTwo() {
            this.show2 = !this.show2;
        }
  }

};
</script>

And use it like this:

 <v-list-item @click="drawer = !drawer">
            <v-icon>mdi-chevron-right</v-icon>
          </v-list-item>
          <v-list-item @click="clickShowOne">
            show1
          </v-list-item>
          <v-list-item @click="clickShowTwo">
            show2
</v-list-item>

Leave a comment