GithubHelp home page GithubHelp logo

如果不同的菜单,需要渲染同一个组件只是参数不一致,该如何处理,路由设置怎么做比较好?name与组件不一致时也无法缓存 about vue-element-plus-admin HOT 5 CLOSED

kailong321200875 avatar kailong321200875 commented on July 17, 2024
如果不同的菜单,需要渲染同一个组件只是参数不一致,该如何处理,路由设置怎么做比较好?name与组件不一致时也无法缓存

from vue-element-plus-admin.

Comments (5)

kailong321200875 avatar kailong321200875 commented on July 17, 2024

你可以在包裹一层,路由菜单还是分离,比如叫做 router1 和 router2,router1 和router2 都有引入比如componentA这个组件,这样子,就可以去设置 router1 和 router2 是不是要缓存了。

from vue-element-plus-admin.

megamew avatar megamew commented on July 17, 2024

export const asyncRouterMap: AppRouteRecordRaw[] = [
{
path: '/product',
component: Layout,
redirect: '/product/xx',
name: 'Level',
meta: {
title: t('router.level'),
icon: 'carbon:skill-level-advanced'
},
children: [
{
path: 'y',
name: 'Menu3',
component: () => import('@/views/Level/Menu12.vue'),
meta: {
title: t('router.menu2')
}
},
{
path: 'z',
name: 'Menu4',
component: () => import('@/views/Level/Menu12.vue'),
meta: {
title: 'ddd'
}
}
]
}
]
是这个意思吗?demo能不能加一个例子,有点懵逼。谢谢。

from vue-element-plus-admin.

megamew avatar megamew commented on July 17, 2024

宏观金融
股指
原油
黑色板块
铁矿石
螺纹钢
..............
农产品
豆粕
.........

大概结构就是这样,菜单数量比较多,页面只是传的参数不一样

from vue-element-plus-admin.

kailong321200875 avatar kailong321200875 commented on July 17, 2024

@megamew 目前好像只能这样

from vue-element-plus-admin.

wiexin avatar wiexin commented on July 17, 2024

如果两个都要缓存 那不就不满足框架缓存的条件了吗

路由设置 name,且不能重复
路由对应的组件加上 name,与路由设置的 name 保持一致

from vue-element-plus-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.