|
@@ -5,6 +5,16 @@
|
|
this.$message('This is a message.');
|
|
this.$message('This is a message.');
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ openVn() {
|
|
|
|
+ const h = this.$createElement;
|
|
|
|
+ this.$message({
|
|
|
|
+ message: h('p', null, [
|
|
|
|
+ h('span', null, 'Message can be '),
|
|
|
|
+ h('i', { style: 'color: teal' }, 'VNode')
|
|
|
|
+ ])
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
open2() {
|
|
open2() {
|
|
this.$message({
|
|
this.$message({
|
|
message: 'Congrats, this is a success message.',
|
|
message: 'Congrats, this is a success message.',
|
|
@@ -65,11 +75,12 @@ Used to show feedback after an activity. The difference with Notification is tha
|
|
|
|
|
|
Displays at the top, and disappears after 3 seconds.
|
|
Displays at the top, and disappears after 3 seconds.
|
|
|
|
|
|
-:::demo The setup of Message is very similar to notification, so parts of the options won't be explained in detail here. You can check the options table below combined with notification doc to understand it. Element has registered a `$message` method for invoking. Message can take a string as parameter, and it will be shown as the main body.
|
|
|
|
|
|
+:::demo The setup of Message is very similar to notification, so parts of the options won't be explained in detail here. You can check the options table below combined with notification doc to understand it. Element has registered a `$message` method for invoking. Message can take a string or VNode as parameter, and it will be shown as the main body.
|
|
|
|
|
|
```html
|
|
```html
|
|
<template>
|
|
<template>
|
|
<el-button :plain="true" @click="open">Show message</el-button>
|
|
<el-button :plain="true" @click="open">Show message</el-button>
|
|
|
|
+ <el-button :plain="true" @click="openVn">VNode</el-button>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -77,6 +88,16 @@ Displays at the top, and disappears after 3 seconds.
|
|
methods: {
|
|
methods: {
|
|
open() {
|
|
open() {
|
|
this.$message('This is a message.');
|
|
this.$message('This is a message.');
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ openVn() {
|
|
|
|
+ const h = this.$createElement;
|
|
|
|
+ this.$message({
|
|
|
|
+ message: h('p', null, [
|
|
|
|
+ h('span', null, 'Message can be '),
|
|
|
|
+ h('i', { style: 'color: teal' }, 'VNode')
|
|
|
|
+ ])
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -196,7 +217,7 @@ You can call `Message.closeAll()` to manually close all the instances.
|
|
### Options
|
|
### Options
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
|
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
|
-| message | message text | string | — | — |
|
|
|
|
|
|
+| message | message text | string / VNode | — | — |
|
|
| type | message type | string | success/warning/info/error | info |
|
|
| type | message type | string | success/warning/info/error | info |
|
|
| iconClass | custom icon's class, overrides `type` | string | — | — |
|
|
| iconClass | custom icon's class, overrides `type` | string | — | — |
|
|
| customClass | custom class name for Message | string | — | — |
|
|
| customClass | custom class name for Message | string | — | — |
|