12 changed files with 137 additions and 26 deletions
@ -0,0 +1,33 @@ |
|||
import { ref } from 'vue' |
|||
|
|||
export const useAutoBack = (callback: () => void) => { |
|||
const MIN_TIME = 0 |
|||
const CHECK_TIME = 1000 |
|||
const TO_INDEX_TIME = 10 |
|||
const toIndexTime = ref(TO_INDEX_TIME) //回首页的时间
|
|||
|
|||
const toIndexInterval = ref() |
|||
|
|||
function sleepToIndex() { |
|||
return new Promise<void>(resolve => { |
|||
toIndexInterval.value = setInterval(() => { |
|||
toIndexTime.value-- |
|||
if (toIndexTime.value <= MIN_TIME) { |
|||
clearInterval(toIndexInterval.value) |
|||
resolve() |
|||
} |
|||
}, CHECK_TIME) |
|||
}) |
|||
} |
|||
|
|||
async function checkHandleScreen() { |
|||
toIndexTime.value = TO_INDEX_TIME |
|||
clearInterval(toIndexInterval.value) |
|||
await sleepToIndex() |
|||
callback() |
|||
} |
|||
|
|||
return { |
|||
checkHandleScreen |
|||
} |
|||
} |
|||
@ -1,6 +1,13 @@ |
|||
interface Customer { |
|||
suggestionContent: string |
|||
replyContent: string |
|||
fileList: { |
|||
extCode: string |
|||
fileCode: string |
|||
fileName: string |
|||
filePath: string |
|||
type: string |
|||
}[] |
|||
addTime: string |
|||
updateTime: string |
|||
} |
|||
|
|||
Loading…
Reference in new issue