实际上,我们在.vue文件中使用this.$notification.open(opitons),然后它将在我们的web应用程序中显示通知。但是如何在.js文件中使用this.$notification.open(选项)呢?例如,我在.js文件中编写外部函数,如果出现错误,它将显示通知。我尝试导入Antd,然后使用Antd.notification.open(打开)。此代码不起作用。
Ant设计通知链接在此处:https://www.antdv.com/components/notification/
发布于 2020-11-28 03:25:31
您可以直接在.js文件上导入来自ant设计的通知,例如
从‘ant-design-vue’导入{通知};
notification.error({消息:‘错误!',描述: err.response.data.message,类:’错误‘})
https://stackoverflow.com/questions/62605625
复制相似问题