task#15348,司机app自动刷新功能
This commit is contained in:
@ -75,10 +75,17 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log("mountedmounted")
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
this.supplierId = urlParams.get('supplierId');
|
||||
this.getTrainingList();
|
||||
document.addEventListener('visibilitychange', async ( ) => {
|
||||
let state = document.visibilityState
|
||||
if (state == 'hidden') { // 用户离开了
|
||||
}
|
||||
if (state == 'visible') {
|
||||
this.getTrainingList();
|
||||
}
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
onRefresh() {
|
||||
|
@ -61,14 +61,6 @@
|
||||
<script>
|
||||
import {myMixins} from "@/utils/myMixins"
|
||||
import {driverTrainList} from "@/api/mine"
|
||||
window.onpageshow = function(event) {
|
||||
// 检查页面是否是从缓存中加载的
|
||||
if (event.persisted) {
|
||||
// 重新获取数据
|
||||
console.log("重新获取数据")
|
||||
// fetchData();
|
||||
}
|
||||
};
|
||||
export default {
|
||||
name: "driverTrainingList",
|
||||
computed: {
|
||||
@ -89,6 +81,14 @@ export default {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
this.driverId = urlParams.get('driverId');
|
||||
this.getList();
|
||||
document.addEventListener('visibilitychange', async ( ) => {
|
||||
let state = document.visibilityState
|
||||
if (state == 'hidden') { // 用户离开了
|
||||
}
|
||||
if (state == 'visible') {
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
onRefresh() {
|
||||
|
Reference in New Issue
Block a user