Skip to content

使用ant-design-vue2.0.0beta.9 的导航菜单,递归组件实现循环路由,子组件样式出错,样式丢失 #2878

@Gitpingping

Description

@Gitpingping
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.0-beta.5

Environment

vite 1.0.0-rc.1 vue3.0.0-rc.1

Reproduction link

https://2x.antdv.com/components/menu-cn/

Steps to reproduce

这个地方遇到两个问题:
1.我想把a-sub-menu和a-menu-item单独放到一个组件里面,当没有子路由时显示单个菜单,当有子路由时可点击下拉显示子路由,但是将这两个标签单独拿到一个.vue 文件之后,样式丢失,无法正常显示,不能在外层包裹div或fragment,否则产生错误
2.以上问题通过动态组件得以解决,但是在run build打包之后上传至nginx则又出现上述问题
以上问题产生的原因是控制台的样式是undefined-submenu-title和undefined-item

What is expected?

在将a-sub-menu和a-menu-item单独拿出封装的时候也能正常显示样式

What is actually happening?

实际是,哪怕我把a-menu-item单独放到一个组件里面,然后引入到标签下也会失去样式


不知道其他组件是否会出现这种情况呢,另:ant-design-vue是我从https://github.com/vueComponent/ant-design-vue.git#feat-vue3安装的,官网教程显示的是ant-design-vue2.0.0beta.9,使用了typescript,用的defineComponent方式,但没有用tsx因为有很多问题,HTML任然写在template里面

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions