📝(修正描述): (radio-group): 新增 name 属性, 简化 radio 配置

This commit is contained in:
就眠儀式 2022-06-08 09:28:58 +08:00
parent e2f4b7d0d6
commit 9e970e99ac
3 changed files with 8 additions and 4 deletions

View File

@ -26,12 +26,12 @@ const isGroup = computed(() => {
});
const naiveName = computed(() => {
if(radioGroup.naiveName) {
if (radioGroup.naiveName) {
return radioGroup.naiveName;
} else {
return props.name;
}
})
});
const isChecked = computed({
get() {

View File

@ -18,7 +18,11 @@ const emit = defineEmits(["update:modelValue", "change"]);
const modelValue = ref(props.modelValue);
provide("radioGroup", { name: "LayRadioGroup", modelValue: modelValue, naiveName: props.name });
provide("radioGroup", {
name: "LayRadioGroup",
modelValue: modelValue,
naiveName: props.name,
});
watch(
() => modelValue,

View File

@ -97,7 +97,7 @@ export default {
:::
::: title 事件回调
::: title 单选分组
:::
::: demo