页面缓存

This commit is contained in:
ronger 2022-10-09 09:42:21 +08:00
parent cdd6d13da0
commit 2cf1c65af6
19 changed files with 37 additions and 19 deletions

View File

@ -4,7 +4,7 @@
<header-view/> <header-view/>
</el-header> </el-header>
<el-main> <el-main>
<nuxt :nuxt-child-key="$route.name"/> <nuxt :nuxt-child-key="$route.name" keep-alive :keep-alive-props="{max: 16}"/>
</el-main> </el-main>
<el-footer height="5rem"> <el-footer height="5rem">
<footer-view/> <footer-view/>

View File

@ -110,7 +110,8 @@ export default {
components: { components: {
EditTags EditTags
}, },
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchArticles', params) .dispatch('admin/fetchArticles', params)

View File

@ -76,7 +76,8 @@ import Records from "../../components/common/bank/account/records";
export default { export default {
name: "bank-accounts", name: "bank-accounts",
components: {Records}, components: {Records},
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('bank-account/fetchList', params) .dispatch('bank-account/fetchList', params)

View File

@ -87,7 +87,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "banks", name: "banks",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('bank/fetchList', params) .dispatch('bank/fetchList', params)

View File

@ -97,7 +97,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "comments", name: "comments",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchComments', params) .dispatch('admin/fetchComments', params)

View File

@ -81,7 +81,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "currency-rules", name: "currency-rules",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('currency-rule/fetchList', params) .dispatch('currency-rule/fetchList', params)

View File

@ -251,7 +251,8 @@ export default {
components: { components: {
EditTags EditTags
}, },
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('dashboard/fetchDashboard', params) .dispatch('dashboard/fetchDashboard', params)

View File

@ -80,7 +80,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "products", name: "products",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchProducts', params) .dispatch('admin/fetchProducts', params)

View File

@ -91,7 +91,8 @@
export default { export default {
name: "roles", name: "roles",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchRoles', params) .dispatch('admin/fetchRoles', params)

View File

@ -48,7 +48,8 @@
export default { export default {
name: "tags", name: "tags",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('tag/fetchList', params) .dispatch('tag/fetchList', params)

View File

@ -77,7 +77,8 @@ export default {
} }
return params.topic_uri return params.topic_uri
}, },
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store.dispatch('topic/fetchDetail', params) store.dispatch('topic/fetchDetail', params)
.catch(err => error({statusCode: 404})), .catch(err => error({statusCode: 404})),

View File

@ -39,7 +39,8 @@
export default { export default {
name: "topics", name: "topics",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('topic/fetchList', params) .dispatch('topic/fetchList', params)

View File

@ -119,7 +119,8 @@ import {mapState} from 'vuex';
export default { export default {
name: "users", name: "users",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('admin/fetchUsers', params) .dispatch('admin/fetchUsers', params)

View File

@ -16,7 +16,8 @@
components: { components: {
DraftList DraftList
}, },
fetch({store, error}) { fetch() {
let {store, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('draft/fetchList') .dispatch('draft/fetchList')

View File

@ -11,7 +11,8 @@ import {mapState} from 'vuex';
export default { export default {
name: 'Index', name: 'Index',
fetch({store, query}) { fetch() {
let {store, query, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store.dispatch('article/fetchList', {page: query.page || 1}), store.dispatch('article/fetchList', {page: query.page || 1}),
store.dispatch('article/fetchAnnouncementList', {page: query.page || 1}) store.dispatch('article/fetchAnnouncementList', {page: query.page || 1})

View File

@ -17,7 +17,8 @@
components: { components: {
NotificationList NotificationList
}, },
fetch({store, query, error}) { fetch() {
let {store, query, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('notification/fetchList', {page: query.page || 1}) .dispatch('notification/fetchList', {page: query.page || 1})

View File

@ -54,7 +54,8 @@ import gzh from "assets/rymcugzh.jpg";
Vue.prototype.$echarts = echarts; Vue.prototype.$echarts = echarts;
export default { export default {
name: "openData", name: "openData",
fetch({store, params, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('open-data/fetchLastThirtyDays', params) .dispatch('open-data/fetchLastThirtyDays', params)

View File

@ -16,7 +16,8 @@ import PortfolioList from "~/components/common/portfolio/list";
export default { export default {
name: "Portfolios", name: "Portfolios",
components: {PortfolioList}, components: {PortfolioList},
fetch({store, query, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('portfolio/fetchList', {page: query.page || 1}) .dispatch('portfolio/fetchList', {page: query.page || 1})

View File

@ -13,7 +13,8 @@ import ProductList from "~/components/common/product/list";
export default { export default {
name: "products", name: "products",
components: {ProductList}, components: {ProductList},
fetch({store, query, error}) { fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('product/fetchList', {page: query.page || 1}) .dispatch('product/fetchList', {page: query.page || 1})