Commit 1b785ff08bbf00c96f4b1cdca4d83aef72dd30ef

Authored by Aresn
Committed by GitHub
2 parents 48e7799e 1c82a9ab

Merge pull request #1054 from lcx960324/2.0

Bugfix: Notice & Message's destroy method.
examples/routers/notice.vue
... ... @@ -10,6 +10,7 @@
10 10 <Button @click="success(true)">成功</Button>
11 11 <Button @click="warning(true)">警告</Button>
12 12 <Button @click="error(true)">错误</Button>
  13 + <Button @click="destroy()">销毁</Button>
13 14 </div>
14 15 </template>
15 16 <script>
... ... @@ -38,6 +39,9 @@
38 39 title: '这是通知标题',
39 40 desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述'
40 41 });
  42 + },
  43 + destroy () {
  44 + this.$Notice.destroy();
41 45 }
42 46 }
43 47 }
... ...
src/components/base/notification/index.js
... ... @@ -25,10 +25,10 @@ Notification.newInstance = properties =&gt; {
25 25 notification.close(name);
26 26 },
27 27 component: notification,
28   - destroy () {
  28 + destroy (element) {
29 29 notification.closeAll();
30 30 setTimeout(function() {
31   - document.body.removeChild(document.getElementsByClassName('ivu-message')[0].parentElement);
  31 + document.body.removeChild(document.getElementsByClassName(element)[0]);
32 32 }, 500);
33 33 }
34 34 };
... ...
src/components/message/index.js
... ... @@ -119,6 +119,6 @@ export default {
119 119 destroy () {
120 120 let instance = getMessageInstance();
121 121 messageInstance = null;
122   - instance.destroy();
  122 + instance.destroy('ivu-message');
123 123 }
124 124 };
125 125 \ No newline at end of file
... ...
src/components/notice/index.js
... ... @@ -113,6 +113,6 @@ export default {
113 113 destroy () {
114 114 let instance = getNoticeInstance();
115 115 noticeInstance = null;
116   - instance.destroy();
  116 + instance.destroy('ivu-notice');
117 117 }
118 118 };
119 119 \ No newline at end of file
... ...