vue浏览器消息提示
JS部分
suportNotify() {if (window.Notification) {console.log("支持" + "Web Notifications API");this.showMess(event)} else {this.$notify("不支持 Web Notifications API");}
},
showMess() {var that =thissetTimeout(function() {console.log('1:' + Notification.permission);if (window.Notification && Notification.permission !== "denied") {Notification.requestPermission(function(status) {if (status === "granted") {var m = new Notification('测试标题', {body: '测试内容', icon: '测试icon' });m.onclick = function() { that.$router.push({path:'/Reception/chatpage'})window.focus();},m.onclose = function(){m.close()}} else {that.$notify('当前浏览器不支持弹出消息')}});}}, 1000)},
效果图展示
