Git Product home page Git Product logo

Comments (8)

weiq avatar weiq commented on August 15, 2024

嗯好的,我会增加一个子路由的用法例子.

from dva-boot-admin.

weiq avatar weiq commented on August 15, 2024

多级路由写法,示例在左侧菜单 > 页面 > 多级路由。

from dva-boot-admin.

Montage-LSM avatar Montage-LSM commented on August 15, 2024

[原来如此,是在父节点里面单独存放了一下Switch,怪不得我之前一直不出来呢。我根据你这个稍微改进了一下。这样里面路由的内容就是独立的了。修改对比

代码:
`
const { crud, loading, dispatch,routerData,location } = this.props;
//重点是这个location,根据location.name 获取到当前路由的值。
//然后根据子节点的进行判断。

const {childRoutes} = routerData;
// console.log("now.routers",location.pathname,childRoutes);
let isJumpChild=false;
childRoutes.map(item=>{
  if (location.pathname==item.key){
    isJumpChild=true;
    console.log("当前路由与子路由相匹配");
    return;
  }
})

if(isJumpChild){
return ({childRoutes});
}
else{
return (..父节点之前的那个Layout标签相关。)
}

`

from dva-boot-admin.

chenwangji avatar chenwangji commented on August 15, 2024

项目预览里的二级路由跳转都会重定向到404,但是我看代码里已经注册了,是不是这样写还有点问题

from dva-boot-admin.

weiq avatar weiq commented on August 15, 2024

@chenwangji https://lanif-ui.github.io/dva-boot-admin/#/dva-boot-admin/level-route/sub-route 请看一下这个示例,我本地和线上都是好使的

from dva-boot-admin.

chenwangji avatar chenwangji commented on August 15, 2024

额 我看的就是你线上的,然后我本地跑也是那样,看代码应该不是要跳到 404 页面呀
11111211
222222

from dva-boot-admin.

weiq avatar weiq commented on August 15, 2024

@chenwangji 哦是标签模式么,你看一下提交历示,这个问题前一阵修复了

from dva-boot-admin.

weiq avatar weiq commented on August 15, 2024

9b00dc0
9accaa5

333

from dva-boot-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.