在antdv中的notification中,加入换行样式

首先明确一点,antdv的notification组件如果需要换行,可使用ES6的 ` 符号+换行符,并且css设置whiteSpace: 'pre-wrap’属性,用于识别换行符/n,就可以实现换行效果。
具体代码如下:
定义弹出notification的方法:

openNotification(title, message) {
      this.$notification.open({
        message: title,
        description: message,
        onClick: () => {
        },
        style: {
          //width: '600px',
          whiteSpace: 'pre-wrap',
        },
      });
    },

带换行的使用:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42969135/article/details/115956702