From b6d0ae476cd1bf79ec35d52ad88fa2ef8c588db4 Mon Sep 17 00:00:00 2001 From: zhouxueli <2841188632@qq.com> Date: Tue, 18 Mar 2025 20:58:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=89=8B=E8=BD=A6=E4=BA=A4=E6=98=93?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E6=88=B7=E7=A6=BB=E5=BC=80=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/secondHandCar/forSale.vue | 6 ++++++ src/views/secondHandCar/wantBuySale.vue | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/views/secondHandCar/forSale.vue b/src/views/secondHandCar/forSale.vue index 2a9e25dc..0413ab1d 100644 --- a/src/views/secondHandCar/forSale.vue +++ b/src/views/secondHandCar/forSale.vue @@ -141,6 +141,12 @@ export default { } this.imgSrcList.unshift(res?.data?.vehicleAnglePhoto) } + document.addEventListener('visibilitychange', async ( ) => { + let state = document.visibilityState + if (state == 'hidden') { // 用户离开了 + this.getDuration() + } + }); }, destroyed() { this.getDuration() diff --git a/src/views/secondHandCar/wantBuySale.vue b/src/views/secondHandCar/wantBuySale.vue index 03e63ff5..79dec68d 100644 --- a/src/views/secondHandCar/wantBuySale.vue +++ b/src/views/secondHandCar/wantBuySale.vue @@ -85,6 +85,12 @@ export default { }) this.detailInfo = res?.data } + document.addEventListener('visibilitychange', async ( ) => { + let state = document.visibilityState + if (state == 'hidden') { // 用户离开了 + this.getDuration() + } + }); }, destroyed() { this.getDuration()