Skip to content

Commit

Permalink
Merge pull request #38 from Leopoldthecoder/master
Browse files Browse the repository at this point in the history
notification 可设置为不自动关闭
  • Loading branch information
Leopoldthecoder committed May 12, 2016
2 parents 4d8c98c + 617e594 commit 98903a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ import { Notification } from 'vue-desktop'

- title: Notification 显示的标题。
- message: Notification 显示的内容。
- type: Notification 显示的图标的类型,可选值:success、info、warning、error,默认值为info
- duration: Notification 显示的时长,单位为秒,默认值为5
- type: Notification 显示的图标的类型,可选值:success、info、warning、error,默认值为 info
- duration: Notification 显示的时长,单位为秒,默认值为 5。设置为 0 则会一直显示,直到用户手动关闭
- callback: Notification 关闭后的回调函数,参数 instance 为对应于该 Notification 的 Vue 实例对象,它具有上述四个属性,instance.id 为唯一性标识。
2 changes: 1 addition & 1 deletion examples/service/notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
title: '通知',
message: '通知信息',
type: 'warning',
duration: 2
duration: 0
});
},
notification4() {
Expand Down
22 changes: 13 additions & 9 deletions src/service/notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,25 @@
startTimer() {
var self = this;
if (this.duration > 0) {
this.timer = setTimeout(function() {
if (!self.closed) {
self.handleClose();
}
}, this.duration * 1000);
}
}
},
ready() {
var self = this;
if (this.duration > 0) {
this.timer = setTimeout(function() {
if (!self.closed) {
self.handleClose();
}
}, this.duration * 1000);
}
},
ready() {
var self = this;
this.timer = setTimeout(function() {
if (!self.closed) {
self.handleClose();
}
}, this.duration * 1000);
}
};
</script>

0 comments on commit 98903a7

Please sign in to comment.