javascript - 在消息部分使用带有链接的 ant-design-vue 通知
问题描述
我正在尝试向通知消息添加链接,但它总是被解释为字符串
我正在为 Vue 使用 ant 设计
this.$notification.error({
message: 'error please contact <href="mailto:test@test.com?subject=test">',
duration: 15
});
});
我尝试了很多东西但没有任何效果,我还尝试将“消息”变成一个返回带有 html 的字符串但没有用的函数!
解决方案
正如文档所说,message
类型是string|vueNode |function(h)
.
所以你可以使用vueNode
orfunction(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/poliished-butterfly-z1zf8?file=/src/App.vue
推荐阅读
- javascript - react-big-calendar - 悬停在无事件日期时显示工具提示消息
- flutter - 不尊重 AspectRatio() 小部件的纵横比
- blockchain - 用于调用链码交易的 IBP Python SDK 功能
- sql - Airflow/SQLAlchemy 错误 - 在加载/刷新处理程序中加载上下文已更改
- java - 我应该在单个循环中使用多个流吗?
- c - K&R c 编程书籍第 2 版,第 2 章中的 strcat 示例
- c# - CultureInfo.GetCultureInfo 导致不正确的格式错误
- css - 防止 Angular 6 组件中 Styles.css 中的所有样式
- c# - 监听来自编辑器脚本的键输入
- javascript - Angular IE11 文件上传取消事件