el -notification框只显示三个
时间: 2023-12-10 09:40:46 浏览: 28
el-notification框只显示三个是因为默认情况下,el-notification组件只会同时显示三个通知。如果你想增加或减少同时显示的通知数量,可以在el-notification组件中设置max-size属性的值。例如,将max-size设置为5,即可同时显示最多5个通知:
```html
<el-notification :max-size="5"></el-notification>
```
另外,如果你需要显示更多的通知,可以考虑使用其他的通知组件或者自己实现一个通知组件。
相关问题
el -notification通知只显示三个stack属性
`el-notification` 组件默认只显示三个 `stack` 属性,分别是 `title`、`message` 和 `type`。如果你想在通知中显示其他属性,可以使用 `customClass` 属性自定义样式,并在自定义样式中添加需要显示的属性。
例如,在 `el-notification` 组件中添加一个 `duration` 属性,可以按照以下方式进行:
```html
<template>
<el-notification
:title="title"
:message="message"
:type="type"
:duration="duration"
:custom-class="customClass"
>
{{ description }}
</el-notification>
</template>
<script>
export default {
data() {
return {
title: '标题',
message: '消息内容',
type: 'success',
duration: 3000,
description: '这是一条通知消息',
customClass: 'my-notification'
};
}
};
</script>
<style scoped>
.my-notification {
display: flex;
align-items: center;
}
.my-notification .el-notification__content {
margin-left: 10px;
}
.my-notification .el-notification__description {
font-size: 14px;
color: #999;
}
</style>
```
在上面的示例中,我们通过设置 `customClass` 属性自定义了通知样式,并在自定义样式中添加了 `duration` 属性。同时还添加了一个 `description` 属性,用于在通知中显示更多信息。
el-Notification 样式穿透
el-Notification 是 Element UI 组件库中的通知组件,它的样式可以通过 CSS 穿透的方式进行修改。
穿透方式如下:
1.在样式中使用 ::v-deep 伪元素来穿透样式。
例如,修改通知框背景颜色和字体颜色:
```css
/* 通过 ::v-deep 穿透样式 */
.el-notification__content ::v-deep {
background-color: #f0ad4e;
color: #fff;
}
```
2.在样式中使用 /deep/ 或 >>> 运算符来穿透样式。
例如,修改通知框的圆角大小:
```css
/* 通过 /deep/ 或 >>> 运算符穿透样式 */
.el-notification__group /deep/ .el-notification__content {
border-radius: 10px;
}
```
需要注意的是,以上的样式穿透方式可能会有一定的兼容性问题,建议在实际使用中进行测试。