Commit 52d2b38b by 前端

commit

1 parent ac9e433e
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
}, },
mounted() { mounted() {
this.initWx() this.initWx()
// this.id = window.localStorage.getItem('dj_scrm_id') ? JSON.parse(window.localStorage.getItem('dj_scrm_id')) : 0 this.id = window.localStorage.getItem('dj_scrm_id') ? JSON.parse(window.localStorage.getItem('dj_scrm_id')) : 0
this.getReportId() this.getReportId()
}, },
methods: { methods: {
...@@ -46,10 +46,24 @@ export default { ...@@ -46,10 +46,24 @@ export default {
window.$wx.hideOptionMenu() window.$wx.hideOptionMenu()
}) })
}, },
setTitle() {
this.batterData.type == 3 ? (document.title = '喜报通知') : (document.title = '战报通知')
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
// 这个就是我们异步获取 title 的函数
let fn = function () {
setTimeout(function () {
iframe.removeEventListener('load', fn)
document.body.removeChild(iframe)
}, 0)
}
iframe.addEventListener('load', fn)
document.body.appendChild(iframe)
},
getReportId() { getReportId() {
poster.getReportId({ id: this.id }).then(res => { poster.getReportId({ id: this.id }).then(res => {
this.batterData = res this.batterData = res
this.batterData.type == 3 ? (document.title = '喜报通知') : (document.title = '战报通知') this.setTitle()
window.$wx.hideOptionMenu() window.$wx.hideOptionMenu()
}) })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!