我试图向通知消息添加一个链接,但它总是被解释为一个字符串
我在用蚂蚁设计Vue
this.$notification.error({
message: 'error please contact <href="mailto:test@test.com?subject=test">',
duration: 15
});
});我尝试了很多事情,但都没有起作用,我也尝试了"message“,这是一个函数,它用html返回字符串,但不起作用!
发布于 2020-07-31 09:48:22
正如文档所说,message类型是string|vueNode |function(h)。
所以您可以使用vueNode或function(h)来创建html string。
下面是职能(h)示例。
this.$notification.error({
message: function(h) {
return h("div", [
"error please contact",
h(
"a",
{
attrs: {
href: "mailto:test@test.com?subject=test"
}
},
["link name"]
)
]);
},
duration: 15
});https://codesandbox.io/s/polished-butterfly-z1zf8?file=/src/App.vue
https://stackoverflow.com/questions/63173621
复制相似问题