perf: Pack on demand

This commit is contained in:
xiaoxian521
2021-04-21 23:20:14 +08:00
parent 62ad9e6f40
commit 679cfae7fb
18 changed files with 677 additions and 226 deletions

View File

@@ -5,11 +5,12 @@
<span
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
class="no-redirect"
>{{ $t(item.meta.title) }}</span
>
<a v-else @click.prevent="handleLink(item)">{{
>{{ $t(item.meta.title) }}</span>
<a v-else @click.prevent="handleLink(item)">
{{
$t(item.meta.title)
}}</a>
}}
</a>
</el-breadcrumb-item>
</transition-group>
</el-breadcrumb>
@@ -36,20 +37,18 @@ export default defineComponent({
};
const getBreadcrumb = (): void => {
let matched = route.matched.filter(
(item) => item.meta && item.meta.title
);
let matched = route.matched.filter(item => item.meta && item.meta.title);
const first = matched[0];
if (!isDashboard(first)) {
matched = [
({
path: "/welcome",
meta: { title: "home" },
} as unknown) as RouteLocationMatched,
meta: { title: "message.hshome" }
} as unknown) as RouteLocationMatched
].concat(matched);
}
levelList.value = matched.filter(
(item) => item.meta && item.meta.title && item.meta.breadcrumb !== false
item => item.meta && item.meta.title && item.meta.breadcrumb !== false
);
};
@@ -61,9 +60,9 @@ export default defineComponent({
);
// const pathCompile = (path: string): string | Object => {
// const { params } = route;
// var toPath = pathToRegexp.compile(path);
// return toPath(params);
// const { params } = route;
// var toPath = pathToRegexp.compile(path);
// return toPath(params);
// };
const handleLink = (item: RouteLocationMatched): any => {
@@ -76,7 +75,7 @@ export default defineComponent({
};
return { levelList, handleLink };
},
}
});
</script>

View File

@@ -23,7 +23,10 @@
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item icon="el-icon-switch-button" @click="logout">{{ $t("LoginOut") }}</el-dropdown-item>
<el-dropdown-item
icon="el-icon-switch-button"
@click="logout"
>{{ $t("message.hsLoginOut") }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>

View File

@@ -1,7 +1,7 @@
<template>
<div class="screen-full" @click="toggle">
<i
:title="isFullscreen ? $t('exitfullscreen') : $t('fullscreen')"
:title="isFullscreen ? $t('message.hsexitfullscreen') : $t('message.hsfullscreen')"
:class="
isFullscreen
? 'iconfont team-iconexit-fullscreen'

View File

@@ -13,7 +13,11 @@
<!-- 右侧功能按钮 -->
<ul class="right-func">
<li>
<i :title="$t('refreshRoute')" class="el-icon-refresh-right rotate" @click="onFresh"></i>
<i
:title="$t('message.hsrefreshRoute')"
class="el-icon-refresh-right rotate"
@click="onFresh"
></i>
</li>
<li>
<el-dropdown trigger="click" placement="bottom-end">

View File

@@ -14,7 +14,7 @@ let dynamic: InterDynamic = reactive({
{
path: "/welcome",
meta: {
title: "home",
title: "message.hshome",
icon: "el-icon-s-home",
showLink: true,
savedPosition: false,

View File

@@ -7,7 +7,7 @@ interface RouteModel {
export const homeRoute: RouteModel = {
path: "/welcome",
meta: {
title: "home",
title: "message.hshome",
icon: "el-icon-s-home",
showLink: true,
savedPosition: false,

View File

@@ -1,24 +0,0 @@
{
"home": "首页",
"LoginOut": "退出系统",
"fullscreen": "全屏",
"exitfullscreen": "退出全屏",
"usermanagement": "用户管理",
"baseinfo": "基础信息",
"editor": "编辑器",
"error": "错误页面",
"404": "404",
"401": "401",
"components": "组件",
"video": "视频组件",
"map": "地图组件",
"draggable": "拖拽组件",
"split-pane": "切割面板",
"button": "按钮组件",
"cropping": "图片裁剪",
"countTo": "数字动画",
"selector": "选择器组件",
"flowChart": "流程图",
"seamless": "无缝滚动",
"refreshRoute": "刷新路由"
}

View File

@@ -1,24 +0,0 @@
{
"home": "Home",
"LoginOut": "Login Out",
"fullscreen": "Fullscreen",
"exitfullscreen": "Exit Fullscreen",
"usermanagement": "User Manage",
"baseinfo": "Base Info",
"editor": "Editor",
"error": "Error Page",
"404": "404",
"401": "401",
"components": "Components",
"video": "Video Components",
"map": "Map Components",
"draggable": "Draggable Components",
"split-pane": "Split Pane",
"button": "Button Components",
"cropping": "Picture Cropping",
"countTo": "Digital Animation",
"selector": "Selector Components",
"flowChart": "flow Chart",
"seamless": "Seamless Scroll",
"refreshRoute": "refreshRoute"
}

View File

@@ -1,70 +1,58 @@
import { createApp } from "vue"
import App from "./App.vue"
import router from "./router"
import store from "./store"
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
// 内置ElementPlus
import ElementPlus from "element-plus"
import "element-plus/lib/theme-chalk/index.css"
// 内置vxe-table
import "font-awesome/css/font-awesome.css"
import VXETable from "vxe-table"
import "vxe-table/lib/style.css"
// 内置国际化语言包
import { createI18n } from "vue-i18n"
import ch from "./locales/ch.json"
import en from "./locales/en.json"
const i18n = createI18n({
locale: 'ch', //默认使用中文
messages: {
ch,
en
}
})
import { useElementPlus } from "../src/plugins/element-plus";
import { useTable } from "../src/plugins/vxe-table";
import { usI18n } from "../src/plugins/i18n";
// 导入公共样式
import "./style/index.scss"
import "./style/index.scss";
// 导入字体图标
import "./assets/iconfont/iconfont.js"
import "./assets/iconfont/iconfont.css"
import "./assets/iconfont/iconfont.js";
import "./assets/iconfont/iconfont.css";
import { setConfig, getConfig } from "./config"
import axios from "axios"
import { setConfig, getConfig } from "./config";
import axios from "axios";
const app = createApp(App)
app.config.globalProperties.$config = getConfig()
const app = createApp(App);
app.config.globalProperties.$config = getConfig();
// 获取项目动态全局配置
export const getServerConfig = async (): Promise<any> => {
return axios({
baseURL: "",
method: "get",
url: process.env.NODE_ENV === 'production' ? "/manages/serverConfig.json" : "/serverConfig.json"
}).then(({ data: config }) => {
let $config = app.config.globalProperties.$config
// 自动注入项目配置
if (app && $config && typeof config === "object") {
$config = Object.assign($config, config)
app.config.globalProperties.$config = $config
// 设置全局配置
setConfig($config)
}
// 设置全局baseURL
app.config.globalProperties.$baseUrl = $config.baseURL
return $config
}).catch(() => { throw "请在public文件夹下添加serverConfig.json配置文件" })
}
url:
process.env.NODE_ENV === "production"
? "/manages/serverConfig.json"
: "/serverConfig.json",
})
.then(({ data: config }) => {
let $config = app.config.globalProperties.$config;
// 自动注入项目配置
if (app && $config && typeof config === "object") {
$config = Object.assign($config, config);
app.config.globalProperties.$config = $config;
// 设置全局配置
setConfig($config);
}
// 设置全局baseURL
app.config.globalProperties.$baseUrl = $config.baseURL;
return $config;
})
.catch(() => {
throw "请在public文件夹下添加serverConfig.json配置文件";
});
};
getServerConfig().then(() => {
app
.use(store)
.use(router)
.use(i18n)
.use(ElementPlus)
.use(VXETable)
.mount('#app')
})
.use(store)
.use(useElementPlus)
.use(useTable)
.use(usI18n)
.mount("#app");
});

View File

@@ -0,0 +1,62 @@
import { App } from "vue";
import {
ElAffix,
ElSkeleton,
ElBreadcrumb,
ElBreadcrumbItem,
ElScrollbar,
ElSubmenu,
ElButton,
ElCol,
ElRow,
ElSpace,
ElDivider,
ElCard,
ElDropdown,
ElDialog,
ElMenu,
ElMenuItem,
ElDropdownItem,
ElDropdownMenu,
ElIcon,
ElInput,
ElForm,
ElFormItem,
ElLoading,
} from "element-plus";
const components = [
ElAffix,
ElSkeleton,
ElBreadcrumb,
ElBreadcrumbItem,
ElScrollbar,
ElSubmenu,
ElButton,
ElCol,
ElRow,
ElSpace,
ElDivider,
ElCard,
ElDropdown,
ElDialog,
ElMenu,
ElMenuItem,
ElDropdownItem,
ElDropdownMenu,
ElIcon,
ElInput,
ElForm,
ElFormItem,
];
const plugins = [ElLoading];
export function useElementPlus(app: App) {
components.forEach((component) => {
app.component(component.name, component);
});
plugins.forEach((plugin) => {
app.use(plugin);
});
}

View File

@@ -0,0 +1,94 @@
// 菜单国际化配置
// vxe-table组件国际化
import zhVxeTable from "vxe-table/lib/locale/lang/zh-CN";
import enVxeTable from "vxe-table/lib/locale/lang/en-US";
export const menusConfig = {
zh: {
message: {
hshome: "首页",
hsuserManagement: "用户管理",
hsBaseinfo: "基础信息",
hseditor: "编辑器",
hserror: "错误页面",
hsfourZeroFour: "404",
hsfourZeroOne: "401",
hscomponents: "组件",
hsvideo: "视频组件",
hsmap: "地图组件",
hsdraggable: "拖拽组件",
hssplitPane: "切割面板",
hsbutton: "按钮组件",
hscropping: "图片裁剪",
hscountTo: "数字动画",
hsselector: "选择器组件",
hsflowChart: "流程图",
hsseamless: "无缝滚动",
},
},
en: {
message: {
hshome: "Home",
hsuserManagement: "User Manage",
hsBaseinfo: "Base Info",
hseditor: "Editor",
hserror: "Error Page",
hsfourZeroFour: "404",
hsfourZeroOne: "401",
hscomponents: "Components",
hsvideo: "Video Components",
hsmap: "Map Components",
hsdraggable: "Draggable Components",
hssplitPane: "Split Pane",
hsbutton: "Button Components",
hscropping: "Picture Cropping",
hscountTo: "Digital Animation",
hsselector: "Selector Components",
hsflowChart: "Flow Chart",
hsseamless: "Seamless Scroll",
},
},
};
// 按钮配置
export const buttonConfig = {
zh: {
message: {
hsLoginOut: "退出系统",
hsfullscreen: "全屏",
hsexitfullscreen: "退出全屏",
hsrefreshRoute: "刷新路由",
hslogin: "登陆",
hsregister: "注册",
hsadd: "新增",
hsmark: "标记/取消",
hssave: "保存",
},
},
en: {
message: {
hsLoginOut: "loginOut",
hsfullscreen: "fullScreen",
hsexitfullscreen: "exitFullscreen",
hsrefreshRoute: "refreshRoute",
hslogin: "login",
hsregister: "register",
hsadd: "Add",
hsmark: "Mark/Cancel",
hssave: "Save",
},
},
};
const localesList = [menusConfig, buttonConfig];
export const localesConfigs = {
zh: {
message: Object.assign({}, ...localesList.map((v) => v.zh.message)),
...zhVxeTable,
},
en: {
message: Object.assign({}, ...localesList.map((v) => v.en.message)),
...enVxeTable,
},
};

14
src/plugins/i18n/index.ts Normal file
View File

@@ -0,0 +1,14 @@
// 多组件库的国际化和本地项目国际化兼容
import { App } from "vue";
import { createI18n } from "vue-i18n";
import { localesConfigs } from "./config";
export const i18n = createI18n({
locale: "zh", // set locale
fallbackLocale: "zh", // set fallback locale
messages: localesConfigs,
});
export function usI18n(app: App) {
app.use(i18n);
}

View File

@@ -0,0 +1,108 @@
import { App } from "vue";
import { i18n } from "../i18n/index";
import "font-awesome/css/font-awesome.css";
import "xe-utils";
import {
// 核心
VXETable,
// 表格功能
Header,
Footer,
Icon,
Filter,
Edit,
Menu,
Export,
Keyboard,
Validator,
// 可选组件
Column,
Colgroup,
Grid,
Tooltip,
Toolbar,
Pager,
Form,
FormItem,
FormGather,
Checkbox,
CheckboxGroup,
Radio,
RadioGroup,
RadioButton,
Switch,
Input,
Select,
Optgroup,
Option,
Textarea,
Button,
Modal,
List,
Pulldown,
// 表格
Table,
} from "vxe-table";
// 全局默认参数
VXETable.setup({
version: 0,
zIndex: 100,
table: {
autoResize: true,
},
// 对组件内置的提示语进行国际化翻译
i18n: (key, args) => i18n.global.t(key, args),
// 可选,对参数中的列头、校验提示..等进行自动翻译(只对支持国际化的有效)
translate(key, args) {
// 例如,只翻译 "app." 开头的键值
if (key && key.indexOf("message.") > -1) {
return i18n.global.t(key, args);
}
return key;
},
});
export function useTable(app: App) {
app
.use(Header)
.use(Footer)
.use(Icon)
.use(Filter)
.use(Edit)
.use(Menu)
.use(Export)
.use(Keyboard)
.use(Validator)
// 可选组件
.use(Column)
.use(Colgroup)
.use(Grid)
.use(Tooltip)
.use(Toolbar)
.use(Pager)
.use(Form)
.use(FormItem)
.use(FormGather)
.use(Checkbox)
.use(CheckboxGroup)
.use(Radio)
.use(RadioGroup)
.use(RadioButton)
.use(Switch)
.use(Input)
.use(Select)
.use(Optgroup)
.use(Option)
.use(Textarea)
.use(Button)
.use(Modal)
.use(List)
.use(Pulldown)
// 安装表格
.use(Table);
}

View File

@@ -1,9 +1,4 @@
import {
createRouter,
createWebHistory,
createWebHashHistory,
RouteRecordRaw,
} from "vue-router";
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import Layout from "../layout/index.vue";
@@ -22,7 +17,7 @@ const routes: Array<RouteRecordRaw> = [
component: () =>
import(/* webpackChunkName: "home" */ "../views/welcome.vue"),
meta: {
title: "home",
title: "message.hshome",
showLink: true,
savedPosition: false,
},
@@ -47,7 +42,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/video/index.vue"
),
meta: {
title: "video",
title: "message.hsvideo",
showLink: false,
savedPosition: true,
},
@@ -59,7 +54,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/map/index.vue"
),
meta: {
title: "map",
title: "message.hsmap",
showLink: false,
savedPosition: true,
},
@@ -71,7 +66,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/draggable/index.vue"
),
meta: {
title: "draggable",
title: "message.hsdraggable",
showLink: false,
savedPosition: true,
},
@@ -83,7 +78,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/split-pane/index.vue"
),
meta: {
title: "split-pane",
title: "message.hssplitPane",
showLink: false,
savedPosition: true,
},
@@ -95,7 +90,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/button/index.vue"
),
meta: {
title: "button",
title: "message.hsbutton",
showLink: false,
savedPosition: true,
},
@@ -107,7 +102,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/cropping/index.vue"
),
meta: {
title: "cropping",
title: "message.hscropping",
showLink: false,
savedPosition: true,
},
@@ -119,7 +114,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/count-to/index.vue"
),
meta: {
title: "countTo",
title: "message.hscountTo",
showLink: false,
savedPosition: true,
},
@@ -131,7 +126,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/selector/index.vue"
),
meta: {
title: "selector",
title: "message.hsselector",
showLink: false,
savedPosition: true,
},
@@ -143,7 +138,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "components" */ "../views/components/seamless-scroll/index.vue"
),
meta: {
title: "seamless",
title: "message.hsseamless",
showLink: false,
savedPosition: true,
},
@@ -152,7 +147,7 @@ const routes: Array<RouteRecordRaw> = [
// path: '/components/flowChart',
// component: () => import(/* webpackChunkName: "components" */ '../views/components/flow-chart/index.vue'),
// meta: {
// title: 'flowChart',
// title: 'message.hsflowChart',
// showLink: false,
// savedPosition: true
// }
@@ -160,7 +155,7 @@ const routes: Array<RouteRecordRaw> = [
],
meta: {
icon: "el-icon-menu",
title: "components",
title: "message.hscomponents",
showLink: true,
savedPosition: true,
},
@@ -178,7 +173,7 @@ const routes: Array<RouteRecordRaw> = [
/* webpackChunkName: "user" */ "../views/flow-chart/index.vue"
),
meta: {
title: "flowChart",
title: "message.hsflowChart",
showLink: false,
savedPosition: true,
},
@@ -186,7 +181,7 @@ const routes: Array<RouteRecordRaw> = [
],
meta: {
icon: "el-icon-set-up",
title: "flowChart",
title: "message.hsflowChart",
showLink: true,
savedPosition: true,
},
@@ -203,7 +198,7 @@ const routes: Array<RouteRecordRaw> = [
import(/* webpackChunkName: "user" */ "../views/editor/index.vue"),
meta: {
// icon: 'el-icon-edit-outline',
title: "editor",
title: "message.hseditor",
showLink: false,
savedPosition: true,
},
@@ -211,7 +206,7 @@ const routes: Array<RouteRecordRaw> = [
],
meta: {
icon: "el-icon-edit-outline",
title: "editor",
title: "message.hseditor",
showLink: true,
savedPosition: true,
},
@@ -228,7 +223,7 @@ const routes: Array<RouteRecordRaw> = [
import(/* webpackChunkName: "user" */ "../views/user.vue"),
meta: {
// icon: 'el-icon-user',
title: "baseinfo",
title: "message.hsBaseinfo",
showLink: false,
savedPosition: true,
},
@@ -236,7 +231,7 @@ const routes: Array<RouteRecordRaw> = [
],
meta: {
icon: "el-icon-user",
title: "usermanagement",
title: "message.hsuserManagement",
showLink: true,
savedPosition: true,
},
@@ -252,7 +247,7 @@ const routes: Array<RouteRecordRaw> = [
component: () =>
import(/* webpackChunkName: "error" */ "../views/error/401.vue"),
meta: {
title: "401",
title: "message.hsfourZeroOne",
showLink: false,
savedPosition: true,
},
@@ -262,7 +257,7 @@ const routes: Array<RouteRecordRaw> = [
component: () =>
import(/* webpackChunkName: "error" */ "../views/error/404.vue"),
meta: {
title: "404",
title: "message.hsfourZeroFour",
showLink: false,
savedPosition: true,
},
@@ -270,7 +265,7 @@ const routes: Array<RouteRecordRaw> = [
],
meta: {
icon: "el-icon-position",
title: "error",
title: "message.hserror",
showLink: true,
savedPosition: true,
},
@@ -281,7 +276,7 @@ const routes: Array<RouteRecordRaw> = [
component: () =>
import(/* webpackChunkName: "login" */ "../views/login.vue"),
meta: {
title: "登陆",
title: "message.hslogin",
showLink: false,
},
},
@@ -291,7 +286,7 @@ const routes: Array<RouteRecordRaw> = [
component: () =>
import(/* webpackChunkName: "register" */ "../views/register.vue"),
meta: {
title: "注册",
title: "message.hsregister",
showLink: false,
},
},
@@ -302,7 +297,7 @@ const routes: Array<RouteRecordRaw> = [
redirect: "/error/404",
meta: {
icon: "el-icon-s-home",
title: "首页",
title: "message.hshome",
showLink: false,
savedPosition: false,
},
@@ -344,7 +339,7 @@ const whiteList = ["/login", "/register"];
router.beforeEach((to, _from, next) => {
NProgress.start();
// @ts-ignore
document.title = to.meta.title; // 动态title
// document.title = $t(to.meta.title); // 动态title
whiteList.indexOf(to.path) !== -1 || storageSession.getItem("info")
? next()
: next("/login"); // 全部重定向到登录页

View File

@@ -18,65 +18,65 @@ export default {
exportConfig: {},
pagerConfig: {
perfect: true,
pageSize: 15,
pageSize: 15
},
editConfig: {
trigger: "click",
mode: "row",
showStatus: true,
showStatus: true
},
toolbarConfig: {
buttons: [
{
code: "insert_actived",
name: "新增",
name: "message.hsadd",
status: "perfect",
icon: "fa fa-plus",
icon: "fa fa-plus"
},
{
code: "mark_cancel",
name: "标记/取消",
name: "message.hsmark",
status: "perfect",
icon: "fa fa-trash-o",
icon: "fa fa-trash-o"
},
{
code: "save",
name: "保存",
name: "message.hssave",
status: "perfect",
icon: "fa fa-save",
},
icon: "fa fa-save"
}
],
perfect: true,
refresh: {
icon: "fa fa-refresh",
iconLoading: "fa fa-spinner fa-spin",
iconLoading: "fa fa-spinner fa-spin"
},
import: {
icon: "fa fa-upload",
icon: "fa fa-upload"
},
export: {
icon: "fa fa-download",
icon: "fa fa-download"
},
print: {
icon: "fa fa-print",
icon: "fa fa-print"
},
zoom: {
iconIn: "fa fa-arrows-alt",
iconOut: "fa fa-expand"
},
// zoom: {
// iconIn: "fa fa-arrows-alt",
// iconOut: "fa fa-expand",
// },
custom: {
icon: "fa fa-cog",
},
icon: "fa fa-cog"
}
},
proxyConfig: {
props: {
result: "result",
total: "page.total",
total: "page.total"
},
ajax: {
// 接收 Promise
query: ({ page }) => {
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {
const list = [
{
@@ -86,7 +86,7 @@ export default {
role: "Develop",
sex: "Man",
age: 28,
address: "Shenzhen",
address: "Shenzhen"
},
{
id: 10002,
@@ -95,7 +95,7 @@ export default {
role: "Test",
sex: "Women",
age: 22,
address: "Guangzhou",
address: "Guangzhou"
},
{
id: 10003,
@@ -104,7 +104,7 @@ export default {
role: "PM",
sex: "Man",
age: 32,
address: "Shanghai",
address: "Shanghai"
},
{
id: 10004,
@@ -113,7 +113,7 @@ export default {
role: "Designer",
sex: "Women ",
age: 23,
address: "Shenzhen",
address: "Shenzhen"
},
{
id: 10005,
@@ -122,7 +122,7 @@ export default {
role: "Develop",
sex: "Women ",
age: 30,
address: "Shanghai",
address: "Shanghai"
},
{
id: 10006,
@@ -131,7 +131,7 @@ export default {
role: "Designer",
sex: "Women ",
age: 21,
address: "Shenzhen",
address: "Shenzhen"
},
{
id: 10007,
@@ -140,7 +140,7 @@ export default {
role: "Test",
sex: "Man ",
age: 29,
address: "vxe-table 从入门到放弃",
address: "vxe-table 从入门到放弃"
},
{
id: 10008,
@@ -149,7 +149,7 @@ export default {
role: "Develop",
sex: "Man ",
age: 35,
address: "Shenzhen",
address: "Shenzhen"
},
{
id: 10009,
@@ -158,7 +158,7 @@ export default {
role: "Develop",
sex: "Man ",
age: 35,
address: "Shenzhen",
address: "Shenzhen"
},
{
id: 100010,
@@ -167,7 +167,7 @@ export default {
role: "Develop",
sex: "Man ",
age: 35,
address: "Guangzhou",
address: "Guangzhou"
},
{
id: 100011,
@@ -176,7 +176,7 @@ export default {
role: "Test",
sex: "Women ",
age: 26,
address: "vxe-table 从入门到放弃",
address: "vxe-table 从入门到放弃"
},
{
id: 100012,
@@ -185,7 +185,7 @@ export default {
role: "Develop",
sex: "Man ",
age: 34,
address: "Guangzhou",
address: "Guangzhou"
},
{
id: 100013,
@@ -194,24 +194,24 @@ export default {
role: "Test",
sex: "Women ",
age: 22,
address: "Shenzhen",
},
address: "Shenzhen"
}
];
resolve({
page: {
total: list.length,
total: list.length
},
result: list.slice(
(page.currentPage - 1) * page.pageSize,
page.currentPage * page.pageSize
),
)
});
}, 100);
});
},
// body 对象: { removeRecords }
delete: () => {
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {
resolve({});
}, 100);
@@ -219,13 +219,13 @@ export default {
},
// body 对象: { insertRecords, updateRecords, removeRecords, pendingRecords }
save: () => {
return new Promise((resolve) => {
return new Promise(resolve => {
setTimeout(() => {
resolve({});
}, 100);
});
},
},
}
}
},
columns: [
{ type: "checkbox", width: 50 },
@@ -237,15 +237,15 @@ export default {
field: "address",
title: "Address",
showOverflow: true,
editRender: { name: "input" },
},
],
editRender: { name: "input" }
}
]
} as VxeGridProps);
return {
gridOptions,
gridOptions
};
},
}
};
</script>