清缓存

This commit is contained in:
lf 2024-06-19 15:05:02 +08:00
parent 15baf12899
commit 1365c942da
1 changed files with 15 additions and 0 deletions

View File

@ -29,6 +29,7 @@ const { safeAreaInsets } = uni.getSystemInfoSync()
const contentData = reactive<any>({})
const query = ref<string>('')
const useStore = useUserStore()
let timer = null
interface SrcListType {
url?: string
@ -116,6 +117,15 @@ const initContent = async () => {
}
onLoad(() => {
timer = setInterval(async () => {
const params = {
activity_code: query.value || '',
}
const res: any = await getContent(params)
if (JSON.stringify(res.data) !== JSON.stringify(useStore.userInfo.contentData)) {
initContent()
}
}, 60000)
// activity_id
query.value = getUrlPathName()
if (!useStore.userInfo.srcList.url || useStore.userInfo.query !== query.value) {
@ -128,6 +138,11 @@ onLoad(() => {
})
}
})
onUnload(() => {
clearInterval(timer)
timer = null
})
</script>
<style>