Files
lilishop-ui/im/src/App.vue
lifenlong 832fda813b 升级Vue3,iView替换ElementPlus
- 删除babel配置、更新依赖与入口初始化
- 全量替换UI组件、样式适配,新增迁移文档与标签/过滤器自动化替换脚本
2026-06-05 17:49:43 +08:00

51 lines
1.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div id="app">
<router-view v-if="showView" />
</div>
</template>
<script>
import { setRefreshView } from "@/utils/app-bridge";
export default {
name: 'App',
data () {
return {
// 用于点击当前页的router时刷新当前页
showView: true,
beforeUnload: '',
Handler: ''
}
},
methods: {
// 刷新当前路由方法
refreshView () {
this.showView = false
this.$nextTick(() => (this.showView = true))
},
beforeunloadHandler () {
this.beforeUnload = new Date().getTime();
},
// 页面关闭后 重置btnHide
unloadHandler (e) {
this.Handler = new Date().getTime() - this.beforeUnload;
if (this.Handler <= 5) {
var storage = window.localStorage;
storage.clear()
localStorage.setItem('btnHide', 1)
}
},
},
mounted () {
setRefreshView(this.refreshView.bind(this));
window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
window.addEventListener('unload', e => this.unloadHandler(e))
},
beforeUnmount () {
window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
window.removeEventListener('unload', e => this.unloadHandler(e))
},
}
</script>