其他分享
首页 > 其他分享> > ant-design-vue时间线使用踩坑

ant-design-vue时间线使用踩坑

作者:互联网

       今天在使用ant-design-vue Timeline组件时,直接使用官网例子发现并不生效,观察浏览器报错

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

        这个错误很常见,组件未注册,之后开始网上搜索相关资料,发现如果直接将报错信息复制进行搜索是没有结果的,相关的解决方案试了很多,都未能找到解决办法。忽然想起来一句话:“编程中遇到的问题,大部分人之前都遇到过,如果没找到解决方案,一定是方法错了”

        所以就来到了ant-design-vue的github上寻找issues果然让我找到了,原文地址是

https://github.com/vueComponent/ant-design-vue/issues/364icon-default.png?t=L892https://github.com/vueComponent/ant-design-vue/issues/364        解决办法是:

import { Timeline } from 'ant-design-vue'

components: {
    [Timeline.Item.name]: Timeline.Item
}

        果然是遇事不决找作者!

标签:vue,Timeline,ant,github,design,issues
来源: https://blog.csdn.net/u014241231/article/details/120655222