a标签img标签等的render函数需要使用attrs设置参数,Button等组件需要props设置属性
table: {
columns: [
{
key: "id",
title: "ID"
},
{
key: "demo_a",
title: "a标签示例",
render: (h, params) => {
return h("a", {
attrs: { // 如果要在标签中加入属性,例如img中src属性,a标签中href属性,此时需要用到attrs来加入而不是props
href: " https://www.liepin.com/" + params.row.demo_a,
target: "_blank"
}
},
params.row.demo_a // 此处为a标签的展示文本
);
}
},
{
key: "demo_button",
title: "button标签示例",
render: (h, params) => {
return h("div", [
h("Button", {
props: { // 如果要在Button中加入属性,此时需要用到props来加入而不是attrs
type: "primary",
size: "small"
},
style: {
marginRight: "8px"
},
on: {
click: function() {
mCheck.singleShow(params.row);
}
}
},
"查看" // 此处为Button的展示文本
),
h("Button", {
props: {
type: "error",
size: "small"
},
on: {
click: function() {
mCheck.singleDel(params.row, params.index);
}
}
},
"删除" // 此处为Button的展示文本
)
]);
}
}
],
data:[]
}