前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Antd Vue Menu组件报错 'propsData' of undefined 的解决方法

Antd Vue Menu组件报错 'propsData' of undefined 的解决方法

作者头像
德顺
发布2019-12-24 10:20:20
3.5K1
发布2019-12-24 10:20:20
举报
文章被收录于专栏:前端资源前端资源前端资源

使用 Ant Design for Vue 的 Menu 组件,引入并注册了,发现点击的时候,下拉菜单样式无法正常显示,控制台报错 TypeError: Cannot read property 'propsData' of undefined 。

解决方法:

引入 Menu 组件:

import { Menu } from 'ant-design-vue';

注册 Menu 组件:因为下拉菜单是 <a-menu-item> 所以还要注册一下 Menu.Item

Vue.component(Menu.name, Menu);
Vue.component(Menu.Item.name, Menu.Item);

也可以使用 Vue.use(Menu); 全局注册。

下面两种报错,也可以用此方法解决,原理是类似的:

Unknown custom element: <a-menu> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Unknown custom element: <a-menu-item> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

声明:本文由w3h5原创,转载请注明出处

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档