naive-ui
naive-ui copied to clipboard
Dropdown 的 renderOption错误
描述错误
vue:
<n-dropdown v-if="child.menus" placement="top-start" size="medium" :options="child.menus" @select="(key, option) => onSelect(option)" :render-option="renderOption" style="display: flex;flex-direction: column;align-items: start;"> <n-button v-bind="child.props" icon-placement="right" @click="onSelect(child)" :disabled="disabled"> <child-content :child="child"></child-content> <template v-if="!child.hideIcon" #icon> <f-icon icon="icon-shang"></f-icon> </template> </n-button> </n-dropdown>
JS:
const renderOption = (props) => { return h(FTipBtn, props.option?.tipProps, h(NButton, { text: true }, props.node)); }
出现了 Cannot read properties of null (reading 'getBoundingClientRect')
复现步骤
1.<n-dropdown v-if="child.menus" placement="top-start" size="medium" :options="child.menus"
@select="(key, option) => onSelect(option)" :render-option="renderOption"
style="display: flex;flex-direction: column;align-items: start;">
<n-button v-bind="child.props" icon-placement="right" @click="onSelect(child)" :disabled="disabled">
- h函数渲染自定义组件
最小复现链接
/
系统信息
naviui:2.34.3
使用的包管理器
npm