Commit 1b785ff08bbf00c96f4b1cdca4d83aef72dd30ef
Committed by
GitHub
Merge pull request #1054 from lcx960324/2.0
Bugfix: Notice & Message's destroy method.
Showing
4 changed files
with
8 additions
and
4 deletions
Show diff stats
examples/routers/notice.vue
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | <Button @click="success(true)">成功</Button> | 10 | <Button @click="success(true)">成功</Button> |
11 | <Button @click="warning(true)">警告</Button> | 11 | <Button @click="warning(true)">警告</Button> |
12 | <Button @click="error(true)">错误</Button> | 12 | <Button @click="error(true)">错误</Button> |
13 | + <Button @click="destroy()">销毁</Button> | ||
13 | </div> | 14 | </div> |
14 | </template> | 15 | </template> |
15 | <script> | 16 | <script> |
@@ -38,6 +39,9 @@ | @@ -38,6 +39,9 @@ | ||
38 | title: '这是通知标题', | 39 | title: '这是通知标题', |
39 | desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' | 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 => { | @@ -25,10 +25,10 @@ Notification.newInstance = properties => { | ||
25 | notification.close(name); | 25 | notification.close(name); |
26 | }, | 26 | }, |
27 | component: notification, | 27 | component: notification, |
28 | - destroy () { | 28 | + destroy (element) { |
29 | notification.closeAll(); | 29 | notification.closeAll(); |
30 | setTimeout(function() { | 30 | setTimeout(function() { |
31 | - document.body.removeChild(document.getElementsByClassName('ivu-message')[0].parentElement); | 31 | + document.body.removeChild(document.getElementsByClassName(element)[0]); |
32 | }, 500); | 32 | }, 500); |
33 | } | 33 | } |
34 | }; | 34 | }; |
src/components/message/index.js
@@ -119,6 +119,6 @@ export default { | @@ -119,6 +119,6 @@ export default { | ||
119 | destroy () { | 119 | destroy () { |
120 | let instance = getMessageInstance(); | 120 | let instance = getMessageInstance(); |
121 | messageInstance = null; | 121 | messageInstance = null; |
122 | - instance.destroy(); | 122 | + instance.destroy('ivu-message'); |
123 | } | 123 | } |
124 | }; | 124 | }; |
125 | \ No newline at end of file | 125 | \ No newline at end of file |
src/components/notice/index.js
@@ -113,6 +113,6 @@ export default { | @@ -113,6 +113,6 @@ export default { | ||
113 | destroy () { | 113 | destroy () { |
114 | let instance = getNoticeInstance(); | 114 | let instance = getNoticeInstance(); |
115 | noticeInstance = null; | 115 | noticeInstance = null; |
116 | - instance.destroy(); | 116 | + instance.destroy('ivu-notice'); |
117 | } | 117 | } |
118 | }; | 118 | }; |
119 | \ No newline at end of file | 119 | \ No newline at end of file |