From 2719667fedcb129c2d33f0225b8385506df8b93d Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Wed, 4 Jan 2017 15:52:35 +0800 Subject: [PATCH 1/2] Notification: supports VNode, #1885 --- examples/docs/en-US/notification.md | 14 ++++++---- examples/docs/zh-CN/notification.md | 12 ++++++--- packages/message-box/src/main.vue | 2 +- packages/notification/src/main.js | 8 +++++- packages/notification/src/main.vue | 4 +-- packages/theme-default/src/notification.css | 24 +++++++++-------- src/utils/vdom.js | 6 +++++ test/unit/specs/notification.spec.js | 29 +++++++++++++++++++-- 8 files changed, 73 insertions(+), 26 deletions(-) create mode 100644 src/utils/vdom.js diff --git a/examples/docs/en-US/notification.md b/examples/docs/en-US/notification.md index 796a6d1e3..dd17ff0aa 100644 --- a/examples/docs/en-US/notification.md +++ b/examples/docs/en-US/notification.md @@ -2,9 +2,11 @@ module.exports = { methods: { open() { + const h = this.$createElement; + this.$notify({ title: 'Title', - message: 'This is a reminder' + message: h('p', { style: 'color: red' }, 'This is a reminder') }); }, @@ -61,14 +63,14 @@ }; -## Notification +## Notification Displays a global notification message at the upper right corner of the page. ### Basic usage ::: demo Element has registered the `$notify` method and it receives an object as its parameter. In the simplest case, you can set the `title` field and the` message` field for the title and body of the notification. By default, the notification automatically closes after 4500ms, but by setting `duration` you can control its duration. Specifically, if set to `0`, it will not close automatically. Note that `duration` receives a `Number` in milliseconds. - + ```html