Vuejs2 如何在元素库的表列中使用render header函数?
我需要为元素表定制一个表头(title+svg+工具提示)。 我正在尝试使用“渲染头”函数,但运气不好。 更具体地说,如何为每一列打印标签+SVG(悬停时有工具提示) Html: 谢谢。这是我的解决方案:Vuejs2 如何在元素库的表列中使用render header函数?,vuejs2,element-ui,Vuejs2,Element Ui,我需要为元素表定制一个表头(title+svg+工具提示)。 我正在尝试使用“渲染头”函数,但运气不好。 更具体地说,如何为每一列打印标签+SVG(悬停时有工具提示) Html: 谢谢。这是我的解决方案: appendTip(h, { column, $index }) { // Function(h, { column, $index }) return h("span", [ column.label, h( "el
appendTip(h, { column, $index }) {
// Function(h, { column, $index })
return h("span", [
column.label,
h(
"el-popover",
{
props: {
placement: "top",
// title: "hello",
// width: "200",
trigger: "hover",
content: this.test(column.label)
}
},
[
h(
"i",
{
slot: "reference",
class: "el-icon-info"
//style: "color:gray;font-size:16px;margin-left:10px;"
},
""
)
]
)
]);
我将此作为参考:
我对我的要求做了一些修改, 我不需要popover的[I]按钮,我需要标题文本上的popover,所以下面给出了适用于我的语法
appendTip: function (h, { column, $index }) {
var content = "Popover content"
if (column.property == "isrequired") {
content = "Value is Required";
}
else {
return column.label;
}
return h(
"el-popover",
{
props: {
placement: "top",
// title: "hello",
// width: "200",
trigger: "hover",
}
},
[
content,
h(
"span",
{
slot: "reference",
},
column.label
)
]
);
},
谢谢你的回答,这对我帮助很大
appendTip(h, { column, $index }) {
// Function(h, { column, $index })
return h("span", [
column.label,
h(
"el-popover",
{
props: {
placement: "top",
// title: "hello",
// width: "200",
trigger: "hover",
content: this.test(column.label)
}
},
[
h(
"i",
{
slot: "reference",
class: "el-icon-info"
//style: "color:gray;font-size:16px;margin-left:10px;"
},
""
)
]
)
]);
appendTip: function (h, { column, $index }) {
var content = "Popover content"
if (column.property == "isrequired") {
content = "Value is Required";
}
else {
return column.label;
}
return h(
"el-popover",
{
props: {
placement: "top",
// title: "hello",
// width: "200",
trigger: "hover",
}
},
[
content,
h(
"span",
{
slot: "reference",
},
column.label
)
]
);
},