<!-- 列表页右上角按钮组 --> <script lang="ts" setup name="ButtonBox"> import type { PropType } from 'vue' import { ref } from 'vue' import type { IMenu } from '../../views/device/receive/receive' const props = defineProps({ active: String, menu: { type: Array as PropType<IMenu[]>, }, }) const emits = defineEmits(['changeCurrentButton']) const current = ref('') watch(current, (newValue) => { emits('changeCurrentButton', newValue) }) watch(() => props.active, (newValue) => { current.value = newValue! console.log('pppppp', newValue) }) </script> <template> <div class="container"> <div class="btns"> <el-radio-group v-model="current"> <el-radio-button v-for="item in menu" :key="item.id" :label="item.id"> {{ item.name }} </el-radio-button> </el-radio-group> </div> </div> </template> <style lang="scss" scoped> .container { position: relative; .btns { position: fixed; top: 69px; right: 15px; z-index: 999; } } </style>