import {ElNotification} from 'element-plus' ElNotification({ message: successMessage, dangerouslyUseHTMLString: true, type: 'success', }) .el-notification__success { background-color: #67C23A; color: #fff; } .el-notification__error { background-color: #F56C6C; color: #fff; }为什么自定义样式没有引入
时间: 2024-03-10 21:44:49 浏览: 16
根据你提供的代码,我没有看到自定义样式被引入。你需要在 HTML 文件中引入自定义样式表。你可以在 HTML 文件中使用 `<link>` 标签引入样式表。
例如:
```
<link rel="stylesheet" href="path/to/custom.css">
```
请确保将 `path/to/custom.css` 替换为你自己的样式表路径。如果你已经引入了样式表,但是自定义样式没有生效,你可以检查自定义样式的选择器是否与元素匹配。
相关问题
import {ElNotification} from 'element-plus' ElNotification({ message: successMessage, dangerouslyUseHTMLString: true, type: 'success', }) .el-notification__success { background-color: #67C23A; color: #fff; } .el-notification__error { background-color: #F56C6C; color: #fff; }为什么样式没有覆盖
根据你提供的代码,我发现你将样式定义放在了 `ElNotification` 的调用之后,这样是无法实现样式覆盖的。
你需要将样式定义放在 `ElNotification` 调用之前,或者将样式定义放在样式表中并在 HTML 文件中引入样式表,这样才能实现样式覆盖。
例如:
```
.el-notification__success {
background-color: #67C23A;
color: #fff;
}
.el-notification__error {
background-color: #F56C6C;
color: #fff;
}
```
请确保将样式定义放在 `ElNotification` 调用之前或者在 HTML 文件中正确引入样式表。
怎么设置element-plus ElNotification({ message: errorMessage, dangerouslyUseHTMLString: true, type: 'warning', })背景,字体,边框颜色
你可以通过以下方式来设置ElNotification的背景、字体和边框颜色:
1. 设置背景颜色:
你可以使用CSS来设置ElNotification的背景颜色,例如:
```css
.el-notification__group {
background-color: #f0f0f0; /* 设置背景颜色 */
}
```
2. 设置字体颜色:
同样可以使用CSS来设置ElNotification的字体颜色,例如:
```css
.el-notification__content {
color: #000; /* 设置字体颜色 */
}
```
3. 设置边框颜色:
也可以使用CSS来设置ElNotification的边框颜色,例如:
```css
.el-notification__group {
border: 1px solid #ccc; /* 设置边框 */
}
```
注意:以上CSS代码仅为示例,你需要根据自己的需求进行调整。此外,还可以使用element-plus提供的props进行样式设置,例如:
```html
<el-notification
:title="'提示'"
:message="'这是一条警告信息'"
:type="'warning'"
:dangerously-use-html-string="true"
:offset="50"
:duration="3000"
:show-close="true"
:custom-class="'my-notification'"
:position="'bottom-right'"
:z-index="99999"
:style="{backgroundColor: '#f0f0f0', color: '#000', border: '1px solid #ccc'}"
></el-notification>
```
在style中设置对应的属性即可。