Commit d367168798bdaa82706f96304ac999b8af89d506
1 parent
47e58396
add destroy() for message component
add destroy() for message component
Showing
3 changed files
with
10 additions
and
1 deletions
Show diff stats
components/message/index.js
@@ -89,5 +89,10 @@ export default { | @@ -89,5 +89,10 @@ export default { | ||
89 | if (options.duration) { | 89 | if (options.duration) { |
90 | defaultDuration = options.duration; | 90 | defaultDuration = options.duration; |
91 | } | 91 | } |
92 | + }, | ||
93 | + destroy () { | ||
94 | + let instance = getMessageInstance(); | ||
95 | + messageInstance = null; | ||
96 | + instance.destroy(); | ||
92 | } | 97 | } |
93 | } | 98 | } |
94 | \ No newline at end of file | 99 | \ No newline at end of file |
local/routers/msg.vue
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | <Button @click="error">error</Button> | 4 | <Button @click="error">error</Button> |
5 | <Button @click="warning">warning</Button> | 5 | <Button @click="warning">warning</Button> |
6 | <Button @click="loading">手动消失</Button> | 6 | <Button @click="loading">手动消失</Button> |
7 | + <Button @click="destroy">destroy</Button> | ||
7 | </template> | 8 | </template> |
8 | <script> | 9 | <script> |
9 | import { Message, Button } from 'iview'; | 10 | import { Message, Button } from 'iview'; |
@@ -45,6 +46,9 @@ | @@ -45,6 +46,9 @@ | ||
45 | const hide = Message.loading('我是loading', 0); | 46 | const hide = Message.loading('我是loading', 0); |
46 | 47 | ||
47 | setTimeout(hide, 5000); | 48 | setTimeout(hide, 5000); |
49 | + }, | ||
50 | + destroy () { | ||
51 | + Message.destroy(); | ||
48 | } | 52 | } |
49 | }, | 53 | }, |
50 | ready () { | 54 | ready () { |
package.json
1 | { | 1 | { |
2 | "name": "iview", | 2 | "name": "iview", |
3 | - "version": "0.0.8", | 3 | + "version": "0.0.9", |
4 | "title": "iView", | 4 | "title": "iView", |
5 | "description": "A high quality UI components Library with Vue.js", | 5 | "description": "A high quality UI components Library with Vue.js", |
6 | "homepage": "http://www.iviewui.com", | 6 | "homepage": "http://www.iviewui.com", |