Merge branch 'main' of github.com:pure-admin/vue-pure-admin into gitee

This commit is contained in:
xiaoxian521
2023-06-04 12:44:01 +08:00
14 changed files with 6370 additions and 2590 deletions

View File

@@ -7,10 +7,12 @@
<script lang="ts">
import { defineComponent } from "vue";
import { checkVersion } from "version-rocket";
import { ElConfigProvider } from "element-plus";
import zhCn from "element-plus/lib/locale/lang/zh-cn";
import en from "element-plus/lib/locale/lang/en";
import { ReDialog } from "@/components/ReDialog";
import zhCn from "element-plus/lib/locale/lang/zh-cn";
export default defineComponent({
name: "app",
components: {
@@ -21,6 +23,29 @@ export default defineComponent({
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: "立即更新"
}
);
}
}
});
</script>

View File

@@ -6,11 +6,18 @@ import type { PaginationProps, LoadingConfig, Align } from "@pureadmin/table";
export function useColumns() {
const dataList = ref([]);
const loading = ref(true);
const select = ref("no");
const hideVal = ref("nohide");
const tableSize = ref("default");
const paginationSmall = ref(false);
const paginationAlign = ref("right");
const columns: TableColumnList = [
{
type: "selection",
align: "left",
reserveSelection: true,
hide: () => (select.value === "no" ? true : false)
},
{
label: "日期",
prop: "date",
@@ -83,7 +90,9 @@ export function useColumns() {
Array.from({ length: 6 }).forEach(() => {
newList.push(clone(tableData, true));
});
dataList.value = newList.flat(Infinity);
newList.flat(Infinity).forEach((item, index) => {
dataList.value.push({ id: index, ...item });
});
pagination.total = dataList.value.length;
loading.value = false;
});
@@ -93,6 +102,7 @@ export function useColumns() {
loading,
columns,
dataList,
select,
hideVal,
tableSize,
pagination,

View File

@@ -5,6 +5,7 @@ const {
loading,
columns,
dataList,
select,
hideVal,
tableSize,
pagination,
@@ -20,6 +21,12 @@ const {
<template>
<div>
<el-space class="float-right mb-4">
<p class="text-sm">多选</p>
<el-radio-group v-model="select" size="small">
<el-radio-button label="yes"></el-radio-button>
<el-radio-button label="no"></el-radio-button>
</el-radio-group>
<el-divider direction="vertical" />
<p class="text-sm">动态列</p>
<el-radio-group v-model="hideVal" size="small">
<el-radio-button label="nohide">不隐藏</el-radio-button>