Skip to content

Commit

Permalink
feature:路由缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-xin committed Mar 17, 2021
1 parent 98261e3 commit 9e7ec0c
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 364 deletions.
6 changes: 3 additions & 3 deletions src/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 84,11 @@ a {

.move-enter-active,
.move-leave-active {
transition: opacity .5s;
transition: opacity .1s ease;
}

.move-enter,
.move-leave {
.move-enter-from,
.move-leave-to {
opacity: 0;
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Tags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 80,7 @@ export default {
this.$store.commit("delTagsItem", { index: 0 });
}
this.$store.commit("setTagsItem", {
name: route.name,
title: route.meta.title,
path: route.fullPath
});
Expand Down
20 changes: 10 additions & 10 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 12,7 @@ const routes = [
children: [
{
path: "/dashboard",
name: "Dashboard",
name: "dashboard",
meta: {
title: '系统首页'
},
Expand All @@ -21,7 21,7 @@ const routes = [
"../views/Dashboard.vue")
}, {
path: "/table",
name: "BaseTable",
name: "basetable",
meta: {
title: '表格'
},
Expand All @@ -30,7 30,7 @@ const routes = [
"../views/BaseTable.vue")
}, {
path: "/charts",
name: "BaseCharts",
name: "basecharts",
meta: {
title: '图表'
},
Expand All @@ -39,7 39,7 @@ const routes = [
"../views/BaseCharts.vue")
}, {
path: "/form",
name: "BaseForm",
name: "baseform",
meta: {
title: '表单'
},
Expand All @@ -48,7 48,7 @@ const routes = [
"../views/BaseForm.vue")
}, {
path: "/tabs",
name: "Tabs",
name: "tabs",
meta: {
title: 'tab标签'
},
Expand All @@ -57,7 57,7 @@ const routes = [
"../views/Tabs.vue")
}, {
path: "/donate",
name: "Donate",
name: "donate",
meta: {
title: '鼓励作者'
},
Expand All @@ -66,7 66,7 @@ const routes = [
"../views/Donate.vue")
}, {
path: "/permission",
name: "Permission",
name: "permission",
meta: {
title: '权限管理',
permission: true
Expand All @@ -76,7 76,7 @@ const routes = [
"../views/Permission.vue")
}, {
path: "/i18n",
name: "I18n",
name: "i18n",
meta: {
title: '国际化语言'
},
Expand All @@ -85,7 85,7 @@ const routes = [
"../views/I18n.vue")
}, {
path: "/upload",
name: "Upload",
name: "upload",
meta: {
title: '上传插件'
},
Expand All @@ -94,7 94,7 @@ const routes = [
"../views/Upload.vue")
}, {
path: "/icon",
name: "Icon",
name: "icon",
meta: {
title: '自定义图标'
},
Expand Down
77 changes: 20 additions & 57 deletions src/views/BaseTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 14,13 @@
icon="el-icon-delete"
class="handle-del mr10"
@click="delAllSelection"
>批量删除</el-button
>
<el-select
v-model="query.address"
placeholder="地址"
class="handle-select mr10"
>
<el-option
key="1"
label="广东省"
value="广东省"
></el-option>
<el-option
key="2"
label="湖南省"
value="湖南省"
></el-option>
>批量删除</el-button>
<el-select v-model="query.address" placeholder="地址" class="handle-select mr10">
<el-option key="1" label="广东省" value="广东省"></el-option>
<el-option key="2" label="湖南省" value="湖南省"></el-option>
</el-select>
<el-input
v-model="query.name"
placeholder="用户名"
class="handle-input mr10"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleSearch"
>搜索</el-button
>
<el-input v-model="query.name" placeholder="用户名" class="handle-input mr10"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
</div>
<el-table
:data="tableData"
Expand All @@ -52,22 30,11 @@
header-cell-class-name="table-header"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
></el-table-column>
<el-table-column
prop="id"
label="ID"
width="55"
align="center"
></el-table-column>
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column prop="id" label="ID" width="55" align="center"></el-table-column>
<el-table-column prop="name" label="用户名"></el-table-column>
<el-table-column label="账户余额">
<template #default="scope"
>¥{{ scope.row.money }}</template
>
<template #default="scope">¥{{ scope.row.money }}</template>
</el-table-column>
<el-table-column label="头像(查看大图)" align="center">
<template #default="scope">
Expand All @@ -89,8 56,7 @@
? 'danger'
: ''
"
>{{ scope.row.state }}</el-tag
>
>{{ scope.row.state }}</el-tag>
</template>
</el-table-column>

Expand All @@ -101,15 67,13 @@
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.$index, scope.row)"
>编辑</el-button
>
>编辑</el-button>
<el-button
type="text"
icon="el-icon-delete"
class="red"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button
>
>删除</el-button>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -138,9 102,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="editVisible = false">取 消</el-button>
<el-button type="primary" @click="saveEdit"
>确 定</el-button
>
<el-button type="primary" @click="saveEdit">确 定</el-button>
</span>
</template>
</el-dialog>
Expand All @@ -150,13 112,14 @@
<script>
import { fetchData } from "../api/index";
export default {
name: "basetable",
data() {
return {
query: {
address: "",
name: "",
pageIndex: 1,
pageSize: 10,
pageSize: 10
},
tableData: [],
multipleSelection: [],
Expand All @@ -165,7 128,7 @@ export default {
pageTotal: 0,
form: {},
idx: -1,
id: -1,
id: -1
};
},
created() {
Expand All @@ -174,7 137,7 @@ export default {
methods: {
// 获取 easy-mock 的模拟数据
getData() {
fetchData(this.query).then((res) => {
fetchData(this.query).then(res => {
console.log(res);
this.tableData = res.list;
this.pageTotal = res.pageTotal || 50;
Expand All @@ -189,7 152,7 @@ export default {
handleDelete(index) {
// 二次确认删除
this.$confirm("确定要删除吗?", "提示", {
type: "warning",
type: "warning"
})
.then(() => {
this.$message.success("删除成功");
Expand Down Expand Up @@ -227,8 190,8 @@ export default {
handlePageChange(val) {
this.$set(this.query, "pageIndex", val);
this.getData();
},
},
}
}
};
</script>

Expand Down
Loading

0 comments on commit 9e7ec0c

Please sign in to comment.