Commit d367168798bdaa82706f96304ac999b8af89d506

Authored by 梁灏
1 parent 47e58396

add destroy() for message component

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