naive-ui icon indicating copy to clipboard operation
naive-ui copied to clipboard

Dropdown 的 renderOption错误

Open a857430369 opened this issue 6 months ago • 7 comments

描述错误

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"> <template v-if="!child.hideIcon" #icon>

  1. h函数渲染自定义组件

最小复现链接

/

系统信息

naviui:2.34.3

使用的包管理器

npm

验证

a857430369 avatar Aug 05 '24 11:08 a857430369