With this code, how to expand and collapse..toggle all el-collapse-items of ElementPlus Vue3 library with one button?
<template> <div class="demo-collapse"> <el-collapse v-model="activeName" accordion> <el-collapse-item title="Consistency" name="1"> <script lang="ts" setup> import { ref } from 'vue' const activeName = ref('1') </script>
https://element-plus.org/en-US/component/collapse.html#accordion
Please take a look at the following code snippet:
You cannot perform this operation in Accordion mode. As the documentation states:
To do this, you have to remove the accordion attribute and change the activeName value to an array, like in the documentation:
To expand/collapse all items, you can create a function that will change the value of activeNames to include all names of el-collapse-item/ em> component or empty, for example