优化页面
This commit is contained in:
26
App.vue
26
App.vue
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
|
||||
// #ifdef APP-PLUS || H5
|
||||
import { TUIChatKit } from './TUIKit';
|
||||
import { useCounterStore } from '@/stores/counter'
|
||||
const counter = useCounterStore()
|
||||
import { TUIChatKit } from "./TUIKit";
|
||||
import { useCounterStore } from "@/stores/counter";
|
||||
import { onMounted } from "vue";
|
||||
const counter = useCounterStore();
|
||||
TUIChatKit.init();
|
||||
// #endif
|
||||
// Required information
|
||||
@@ -19,27 +19,27 @@ export default {
|
||||
chatInfo: {},
|
||||
};
|
||||
},
|
||||
|
||||
onLoad(option) {
|
||||
AutomaticCleaning()
|
||||
this.AutomaticCleaning();
|
||||
uni.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.info = res.data;
|
||||
counter.$patch({ myitem:this.info})
|
||||
counter.$patch({ myitem: this.info });
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
})
|
||||
fail: () => {},
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//自动清理缓存
|
||||
AutomaticCleaning(){
|
||||
const lastCleanTime = uni.getStorageSync('last_clean_time') || 0;
|
||||
AutomaticCleaning() {
|
||||
const lastCleanTime = uni.getStorageSync("last_clean_time") || 0;
|
||||
const now = Date.now();
|
||||
if (now - lastCleanTime < 7 * 24 * 3600 * 1000) return; // 7 days
|
||||
uni.clearStorage();
|
||||
uni.setStorageSync('last_clean_time', now);
|
||||
}
|
||||
uni.setStorageSync("last_clean_time", now);
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user