自定义Naive UI的数据表格Data Table中按钮Button图标


在Naive UI官网中详细介绍了[数据表格 Data Table](数据表格 Data Table - Naive UI)的使用方式

{
	title: "Action",
	key: "actions",
	render(row) {
		return h(
			NButton,
			{
				strong: true,
				tertiary: true,
				size: "small",
				onClick: () => play(row),
			},
			{ default: () => "Play" }
		);
	},
},

根据案例可知default是设置文字的,在[Button](按钮 Button - Naive UI)的Slot中还有一个icon,这个就是自定义按钮图标的

名称 参数 说明
default () 按钮的内容
icon () 按钮的图标

使用方法如下