🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## v-item-group - 可以绑定多个可用于点击的主键,如 `v-chip`,`v-card` 等 - 相当于可以不用js 获取点击事件,传递给内部组件 - `v-item=v-slot`的槽类型有 `isSelected,selectedClass,select,value,disabled`,都可以传递给`v-item`包裹的组件 示例: v-chip ``` <v-item-group selected-class="bg-purple"> <v-item v-slot="{selectedClass,toggle}"> <v-chip :class="selectedClass" @click="toggle"> hello</v-chip> </v-item> <v-item v-slot="{selectedClass,toggle}"> <v-chip :class="selectedClass" @click="toggle"> world</v-chip> </v-item> <v-item v-slot="{selectedClass,toggle}"> <v-chip :class="selectedClass" @click="toggle"> world</v-chip> </v-item> </v-item-group> ``` 示例:v-card ``` <v-item-group selected-class="bg-purple"> <v-item v-slot="{selectedClass,toggle}"> <v-card :class="selectedClass" @click="toggle"> hello</v-card> </v-item> <v-item v-slot="{selectedClass,toggle}"> <v-card :class="selectedClass" @click="toggle"> world</v-card> </v-item> <v-item v-slot="{selectedClass,toggle}"> <v-card :class="selectedClass" @click="toggle"> world</v-card> </v-item> ```