task#15348,司机app自动刷新功能

This commit is contained in:
2024-10-11 20:47:49 +08:00
parent 36d2895f2b
commit b6a9836932
2 changed files with 16 additions and 9 deletions

View File

@ -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() {

View File

@ -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() {