The elementui message component removes the icon in front of the text, sets the type, and sets the duration

The elementui message component removes the icon in front of the text, sets the type, and sets the duration

1. Document reference

Setting iconClass will overwrite type, so you need to set customClass.
insert image description here

  • The attribute customClass, I add other class names defined by myself during the debugging process does not take effect, only write el-message–error these messages to prompt the class name to take effect, what type of information needs to be displayed can be set by yourself according to the class names below , info is the default, no additional setting
    .el-message--error\ .el-message--warning\.el-message--success

2. The effect is as follows:

insert image description here

3. Code implementation

this.$message({
  message: '这是一条提示信息',
  type: 'error',
  iconClass: ' ', // 这个会覆盖图标类名,为了实现去掉图标的操作
  customClass: 'el-message--error', // 这个是由于上面设置了iconClass会覆盖掉type,所以需要再设置
  duration: 5000 // 这个是时长设置
});

Friends who have other needs can refer to the official documents or leave a message below to discuss~~

Guess you like

Origin blog.csdn.net/DarlingYL/article/details/125847733