message: '<strong>This is <i>HTML</i> string</strong>'
});
},
open13() {
this.$notify.success({
title: 'Info',
message: 'This is a message without close button',
showClose: false
});
},
onClose() {
console.log('Notification is closed');
...
...
@@ -343,6 +351,36 @@ Customize Notification's offset from the edge of the screen.
```
:::
### Hide Close button
It is possible to hide the close button
::: demo Set the `showClose` attribute to `false` so the notification cannot be closed by the user.
```html
<template>
<el-button
plain
@click="open13">
Hide close button
</el-button>
</template>
<script>
exportdefault{
methods:{
open13(){
this.$notify.success({
title:'Info',
message:'This is a message without close button',
showClose:false
});
}
}
}
</script>
```
:::
:::warning
Although `message` property supports HTML strings, dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). So when `dangerouslyUseHTMLString` is on, please make sure the content of `message` is trusted, and **never** assign `message` to user-provided content.
:::
...
...
@@ -371,6 +409,7 @@ In this case you should call `Notification(options)`. We have also registered me
| iconClass | custom icon's class. It will be overridden by `type` | string | — | — |
| customClass | custom class name for Notification | string | — | — |
| duration | duration before close. It will not automatically close if set 0 | number | — | 4500 |
| showClose | whether to show a close button | boolean | — | true |
| onClose | callback function when closed | function | — | — |
| onClick | callback function when notification clicked | function | — | — |
| offset | offset from the top edge of the screen. Every Notification instance of the same moment should have the same offset | number | — | 0 |