修改bug 52615 征求意见:添加数据完成后 页面需要自动刷新 现在是手动刷新
This commit is contained in:
+2
-1
@@ -46,7 +46,8 @@ import 'vant/lib/index.css';
|
|||||||
//vant
|
//vant
|
||||||
|
|
||||||
import animate from 'animate.css'
|
import animate from 'animate.css'
|
||||||
|
import tool from './utils/tool'
|
||||||
|
Vue.use(tool)
|
||||||
// 引入路由器
|
// 引入路由器
|
||||||
import router from './router'
|
import router from './router'
|
||||||
// 路由解析器
|
// 路由解析器
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ export default {
|
|||||||
console.log(res.data.records);
|
console.log(res.data.records);
|
||||||
this.total = res.data.total
|
this.total = res.data.total
|
||||||
this.spinShow = false
|
this.spinShow = false
|
||||||
|
localStorage.setItem('refreshFlag', false)
|
||||||
}, e => {
|
}, e => {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -557,6 +558,13 @@ export default {
|
|||||||
},
|
},
|
||||||
handleQueryPdf(file){
|
handleQueryPdf(file){
|
||||||
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + file.attId))
|
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + file.attId))
|
||||||
|
},
|
||||||
|
isVisible(e) {
|
||||||
|
if (e.target.visibilityState === "visible") {
|
||||||
|
this.getList()
|
||||||
|
} else if (e.target.visibilityState === "hidden") {
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -572,6 +580,17 @@ export default {
|
|||||||
...mapGetters(['refreshFlag'])
|
...mapGetters(['refreshFlag'])
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
const that = this;
|
||||||
|
//监听缓存中指定key的值变化
|
||||||
|
window.addEventListener("setItemEvent",function(e){
|
||||||
|
//e.key : 是值发生变化的key
|
||||||
|
//例如 e.key==="token";
|
||||||
|
//e.newValue : 是可以对应的新值
|
||||||
|
if(e.key === "refreshFlag" && e.newValue === true){
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
document.addEventListener('visibilitychange', that.isVisible)
|
||||||
if (this.lawsStand) {
|
if (this.lawsStand) {
|
||||||
this.form = {
|
this.form = {
|
||||||
ideaId: this.lawsStand.id,
|
ideaId: this.lawsStand.id,
|
||||||
@@ -613,7 +632,10 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
this.getIdeaKey()
|
this.getIdeaKey()
|
||||||
this.getFileInfo()
|
this.getFileInfo()
|
||||||
}
|
},
|
||||||
|
destroyed() {
|
||||||
|
document.removeEventListener('visibilitychange', this.isVisible)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
function dispatchEventStroage() {
|
||||||
|
const signSetItem = localStorage.setItem
|
||||||
|
localStorage.setItem = function(key, val) {
|
||||||
|
let setEvent = new Event('setItemEvent')
|
||||||
|
setEvent.key = key
|
||||||
|
setEvent.newValue = val
|
||||||
|
window.dispatchEvent(setEvent)
|
||||||
|
signSetItem.apply(this, arguments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default dispatchEventStroage
|
||||||
|
|
||||||
Reference in New Issue
Block a user