Coder Social home page Coder Social logo

Comments (7)

gclsoft avatar gclsoft commented on May 20, 2024 1

是我menuData的原因

from ant-design-pro-plus.

yunsii avatar yunsii commented on May 20, 2024

抱歉,我研究了一下,源码你也能看见,就是直接渲染的 Tabs 组件切换就行了,暂时不知道是什么原因导致的,好歹知道原因才能操作啊 😂

from ant-design-pro-plus.

gclsoft avatar gclsoft commented on May 20, 2024

@zpr1g 谢谢!您的代码是ts的,我的项目是js的,我引入了master分支的后菜单名都是"未命名",我的菜单是动态配置的. 要怎么解决呢?

from ant-design-pro-plus.

yunsii avatar yunsii commented on May 20, 2024

动态配置是啥意思?我这个菜单逻辑都是 pro 原生的用法啊,你是改过什么东西吧

from ant-design-pro-plus.

gclsoft avatar gclsoft commented on May 20, 2024
/** 根据路由定义中的 name 本地化标题 */
function localeRoutes(routes: Route[], parent: MenuDataItem | null = null): MenuDataItem[] {
  const result: MenuDataItem[] = [];
  console.log("routes");
  console.log(routes)
  routes.forEach(item => {
    const { routes: itemRoutes, ...rest } = item;

    if (!rest.path || rest.redirect) {
      return;
    }

    // 初始化 locale 字段
    let newItem: MenuDataItem = {
      ...rest,
      routes: null,
      locale: item.name,
    };

    const getLocaleId = () => {
      if (!parent && newItem.locale) {
        return `menu.${newItem.locale}`;
      }

      if (parent && parent.locale) {
        return newItem.locale ? `${parent.locale}.${newItem.locale}` : parent.locale;
      }

      return undefined;
    };

    newItem = {
      ...rest,
      locale: getLocaleId(),
        name: getLocaleId() ? formatMessage({ id: getLocaleId()! }) : '未命名',
    };

    if (Array.isArray(itemRoutes) && itemRoutes.length) {
      newItem = {
        ...newItem,
        children: localeRoutes(itemRoutes, newItem),
      };
    }

    result.push(newItem);
  });

  return result;
}
 name: getLocaleId() ? formatMessage({ id: getLocaleId()! }) : '未命名',这一行的getLocaleId是空的, 我改成item.name这个值也是空的, 要怎么获取菜单名呢?

还有点开一个菜单/system/user/list,会同时打开这两个菜单,/system/user和 /system/user/list, 是什么原因导致的? 谢谢 @zpr1g

from ant-design-pro-plus.

yunsii avatar yunsii commented on May 20, 2024

@gclsoft 你好,我最近测试发现在 [email protected] 的时候是不会闪烁的,所以在 antd 仓库提了 issue 找到了原因。如果还用得着的话,你也可以看看。

from ant-design-pro-plus.

gclsoft avatar gclsoft commented on May 20, 2024

谢谢!

from ant-design-pro-plus.

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.