Skip to content

Commit

Permalink
fix(radio): fix placement get value priority
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Dec 6, 2024
1 parent eaaef59 commit ca41d18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/radio/radio.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inject, computed, defineComponent, Ref } from 'vue';
import { inject, computed, defineComponent, Ref, getCurrentInstance } from 'vue';
import { CheckIcon, CheckCircleFilledIcon } from 'tdesign-icons-vue-next';
import { useDefault } from '../shared';
import config from '../config';
Expand All @@ -18,6 +18,7 @@ export default defineComponent({
const renderTNodeContent = useContent();
const renderTNodeJSX = useTNodeJSX();
const radioClass = usePrefixClass('radio');
const { vnode } = getCurrentInstance();

const [innerChecked, setInnerChecked] = useDefault<boolean, TdRadioProps>(props, context.emit, 'checked', 'change');

Expand All @@ -36,7 +37,11 @@ export default defineComponent({
return props.borderless;
});
const finalPlacement = computed(() => {
if (props.placement == null && 'placement' in rootGroupProps) return rootGroupProps.placement;
const vProps = vnode.props || {};
if (Reflect.has(vProps, 'placement')) return props.placement;

if ('placement' in rootGroupProps) return rootGroupProps.placement;

return props.placement || 'left';
});

Expand Down

0 comments on commit ca41d18

Please sign in to comment.