-
您好,请问应如何在 DataTable 中 渲染多个带 NTooltip 的按钮? 目前遇到的问题是,如果按照如下代码编写,只有第一个按钮(’编辑‘ 按钮)会正常工作(并且显示提示),然后控制台提示 目前的代码: render(row: StaffInfoModel) {
return h(
'div',
{},
h(NSpace, null, () => {
const vNodes: VNodeChild = [];
vNodes.push(
h(NTooltip, null, {
trigger: () =>
h(
NButton,
{
size: 'small',
onClick: () => popupMsg.info('edit test')
},
() => h(Icon, { icon: 'carbon:edit' })
),
default: () => '编辑'
})
);
if (row.isEnabled) {
vNodes.push(
h(
NTooltip, null, {
trigger: () => {
h(
NButton,
{
size: 'small',
type: 'warning',
onClick: () => popupMsg.info('disable test')
},
() => h(Icon, { icon: 'fe:disabled' })
);
},
default: () => '禁用'
})
);
}
vNodes.push(
h(NTooltip, null, {
trigger: () => {
h(
NButton,
{
size: 'small',
type: 'error',
onClick: () => popupMsg.info('delete test')
},
() => h(Icon, { icon: 'carbon:delete' })
);
},
default: () => '删除'
})
);
return vNodes;
})
);
} 谢谢! |
Beta Was this translation helpful? Give feedback.
Answered by
07akioni
Jan 16, 2022
Replies: 1 comment 1 reply
-
你后面两段代码都写的不对,箭头函数没有返回值
你应该加上 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
07akioni
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
你后面两段代码都写的不对,箭头函数没有返回值
你应该加上
return