📝(修正描述): ✨(radio-group): 新增 name 属性, 简化 radio 配置
This commit is contained in:
parent
e2f4b7d0d6
commit
9e970e99ac
@ -26,12 +26,12 @@ const isGroup = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const naiveName = computed(() => {
|
const naiveName = computed(() => {
|
||||||
if(radioGroup.naiveName) {
|
if (radioGroup.naiveName) {
|
||||||
return radioGroup.naiveName;
|
return radioGroup.naiveName;
|
||||||
} else {
|
} else {
|
||||||
return props.name;
|
return props.name;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
const isChecked = computed({
|
const isChecked = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -18,7 +18,11 @@ const emit = defineEmits(["update:modelValue", "change"]);
|
|||||||
|
|
||||||
const modelValue = ref(props.modelValue);
|
const modelValue = ref(props.modelValue);
|
||||||
|
|
||||||
provide("radioGroup", { name: "LayRadioGroup", modelValue: modelValue, naiveName: props.name });
|
provide("radioGroup", {
|
||||||
|
name: "LayRadioGroup",
|
||||||
|
modelValue: modelValue,
|
||||||
|
naiveName: props.name,
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => modelValue,
|
() => modelValue,
|
||||||
|
@ -97,7 +97,7 @@ export default {
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
::: title 事件回调
|
::: title 单选分组
|
||||||
:::
|
:::
|
||||||
|
|
||||||
::: demo
|
::: demo
|
||||||
|
Loading…
Reference in New Issue
Block a user