From 0b942fa7814c7d96b6e0d66e7b902f13e2b3df2a Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Sat, 22 Oct 2016 22:58:02 +0800 Subject: [PATCH] MessageBox: update animation/add test --- examples/docs/zh-cn/message-box.md | 20 ++- examples/pages/component.vue | 2 +- package.json | 1 + packages/message-box/src/main.vue | 2 +- packages/theme-default/src/message-box.css | 44 ++--- test/unit/specs/message-box.spec.js | 182 +++++++++++++++++++++ 6 files changed, 216 insertions(+), 35 deletions(-) create mode 100644 test/unit/specs/message-box.spec.js diff --git a/examples/docs/zh-cn/message-box.md b/examples/docs/zh-cn/message-box.md index e51774a19..1d79fd017 100644 --- a/examples/docs/zh-cn/message-box.md +++ b/examples/docs/zh-cn/message-box.md @@ -2,7 +2,14 @@ export default { methods: { open() { - this.$alert('这是一段内容', '标题名称'); + this.$alert('这是一段内容', '标题名称', { + callback: action => { + this.$message({ + type: 'info', + message: `action: ${ action }` + }); + } + }); }, open2() { @@ -72,7 +79,7 @@ 当用户进行操作时会被触发,该对话框中断用户操作,直到用户确认知晓后才可关闭。 -:::demo 调用`$alert`方法即可打开消息提示,它模拟了系统的 `alert`,无法通过按下 ESC 或点击框外关闭。此例中接收了两个参数,`message`和`title`。值得一提的是,窗口被关闭后,它会返回一个`Promise`对象便于进行后续操作的处理。 +:::demo 调用`$alert`方法即可打开消息提示,它模拟了系统的 `alert`,无法通过按下 ESC 或点击框外关闭。此例中接收了两个参数,`message`和`title`。值得一提的是,窗口被关闭后,它默认会返回一个`Promise`对象便于进行后续操作的处理。若不确定浏览器是否支持`Promise`,可自行引入第三方 polyfill 或像本例一样使用回调进行后续处理。 ```html