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