mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 17:07:19 +08:00
60 lines
1.7 KiB
Vue
60 lines
1.7 KiB
Vue
<template>
|
|
<el-config-provider :locale="currentLocale">
|
|
<router-view />
|
|
<ReDialog />
|
|
</el-config-provider>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, h } from "vue";
|
|
import { checkVersion } from "version-rocket";
|
|
import { ElConfigProvider, ElNotification } from "element-plus";
|
|
import en from "element-plus/dist/locale/en.mjs";
|
|
import { ReDialog } from "@/components/ReDialog";
|
|
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
|
|
|
|
export default defineComponent({
|
|
name: "app",
|
|
components: {
|
|
[ElConfigProvider.name]: ElConfigProvider,
|
|
ReDialog
|
|
},
|
|
computed: {
|
|
currentLocale() {
|
|
return this.$storage.locale?.locale === "zh" ? zhCn : en;
|
|
}
|
|
},
|
|
beforeCreate() {
|
|
const { version, name: title } = __APP_INFO__.pkg;
|
|
const { VITE_PUBLIC_PATH, MODE } = import.meta.env;
|
|
// https://github.com/guMcrey/version-rocket/blob/main/README.zh-CN.md#api
|
|
if (MODE === "production") {
|
|
// 版本实时更新检测,只作用于线上环境
|
|
checkVersion(
|
|
// config
|
|
{
|
|
// 5分钟检测一次版本
|
|
pollingTime: 300000,
|
|
localPackageVersion: version,
|
|
originVersionFileUrl: `${location.origin}${VITE_PUBLIC_PATH}version.json`
|
|
},
|
|
// options
|
|
{
|
|
title,
|
|
description: "检测到新版本",
|
|
buttonText: "立即更新"
|
|
}
|
|
);
|
|
}
|
|
},
|
|
mounted() {
|
|
ElNotification({
|
|
title: "优质服务",
|
|
duration: 0,
|
|
dangerouslyUseHTMLString: true,
|
|
message: `<a target='_blank' style='font-size: 16px' class='hover:text-[red]' href='https://www.bilibili.com/video/BV15r421W7U9/?vd_source=5a992808de6229d78e7810536c5f9ab3'>视频介绍</a>`
|
|
});
|
|
}
|
|
});
|
|
</script>
|