fix(radio-group): restore name (#7810)

* fix(radio-group): restore name

* fix(radio-group): restore name
This commit is contained in:
Xc 2022-05-20 21:16:16 +08:00 committed by GitHub
parent ac83f03894
commit d56520e4be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,16 @@
</template>
<script lang="ts" setup>
import { nextTick, onMounted, provide, reactive, ref, toRefs, watch } from 'vue'
import {
computed,
nextTick,
onMounted,
provide,
reactive,
ref,
toRefs,
watch,
} from 'vue'
import { UPDATE_MODEL_EVENT } from '@element-plus/constants'
import { radioGroupKey } from '@element-plus/tokens'
import {
@ -28,6 +37,7 @@ defineOptions({
name: 'ElRadioGroup',
})
let id = 1
const props = defineProps(radioGroupProps)
const emit = defineEmits(radioGroupEmits)
@ -52,11 +62,18 @@ onMounted(() => {
}
})
const randomName = `el-radio-group-${id++}`
const name = computed(() => {
return props.name || randomName
})
provide(
radioGroupKey,
reactive({
...toRefs(props),
changeEvent,
name,
})
)