{
title: "Action",
key: "actions",
render(row) {
return h(
NButton,
{
strong: true,
tertiary: true,
size: "small",
onClick: () => play(row),
},
{ default: () => "Play" }
);
},
},
名称 参数 说明 default
按钮的内容 icon
按钮的图标
import { h, defineComponent } from 'vue'
import { NButton } from 'naive-ui'
import { DeleteFilled } from '@vicons/antd'
const createColumns = ({ checkRow, deleteItem }) => {
return [
{
title: "操作",
key: "actions",
align: "center",
width: "200",
render(row) {
return [
h(
NButton,
{
strong: true,
tertiary: true,
size: "small",
onClick: () => checkRow(row),
},
{ default: () => "Check" }
),
h(
NButton,
{
quaternary: true,
circle: true,
size: "small",
style: {
marginLeft: "20px",
},
onClick: () => deleteItem(row),
},
{ icon: () => h(NIcon, null, { default: () => h(DeleteFilled) }) }
),
];
},
},
];
};
export default defineComponent({
setup() {
return {
data: null,
columns: createColumns({
checkRow(row) {
console.log(row)
},
deleteItem(row) {
console.log(row)
}
}),
pagination: false
}
},
});
Original: https://www.cnblogs.com/sw-code/p/16396410.html
Author: sw-code
Title: 自定义Naive UI的数据表格Data Table中按钮Button图标
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/585562/
转载文章受原作者版权保护。转载请注明原作者出处!