如题,用uniapp开发微信小程序的时候,引用自定义组件的时候,如果把组件配置对象单独拿出来的话,组件渲染就失败了。
export default {
components:{
"foot-bar":footBar
},
...
}
以上是标准的组件引用方式,可以正常使用,但是我把{ "foot-bar":footBar }对象部分单独拿出来就会出错,如:
const componentObj={
"foot-bar":footBar
}
export default {
components:componentObj,
...
}
请问是什么原因?
撸码客 (作者)
多谢
2020-09-15 16:36
遇见最好
这个自动导入的组件配置,我在使用 list-indexed 时,出现引入错误。
list-indexed 的组件中,存在list-indexed-item
使用 list-indexed-item 根据自动导入配置则将 list-indexed-item 的引入路径识别为 @dcloude/ui/components/list-indexed-item/list-indexed-item.vue 但是实际上,list-indexed-item.vue 这个组件是在 components/list-indexed/ 的目录下
2020-09-18 13:37
遇见最好
目前的方式在 easycom 中进行 list-indexed-item 的单独配置,并在 对应的自动匹配规则前面即可。
2020-09-18 13:39