vue: Click button to control div display/hide

Suppose I have 10 divs, and each div corresponds to a button button. The button controls the display and hiding of the corresponding div. The first one is displayed by default. Click on one to display it, and the rest are hidden.

Vue components, plug and play.

Results as shown below,

Please add image description

<template>
    <div>

        <button v-for="(isShown, index) in divStates" :key="index" @click="showDiv(index)"

Guess you like

Origin blog.csdn.net/yyyyyyyyyyy_9/article/details/132761714