Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在app.tsx设置usingComponents,一直报错Component is not found in path #31

Open
candyAndBella opened this issue Mar 25, 2020 · 1 comment

Comments

@candyAndBella
Copy link

把loading动画的效果,做成了一个公共组件,因为每个页面都会用,所以想要全局引入。
在app.tsx设置usingComponents,一直报错Component is not found in path "component/loadingcom"

代码如下:
usingComponents:{
"loadingcom":"../../component/loadingcom"
}
下面两种都试过了,都不行
"loadingcom":"/component/loadingcom"
"loadingcom":"component/loadingcom"
请教正确的写法是什么?

注:不是小程序原生组件,就是Taro的写法,写了一个显示和隐藏loading图片的组件,在src下面的component文件夹下,和pages文件夹是同级

@candyAndBella
Copy link
Author

已解决。Taro不支持全局引用。
我把loadingcom改成了原生小程序的自定义组件,发现一个问题,一定要在某个页面单独引用一次,全局引用才可以生效。否则会不编译,提示Component is not found in path "component/loadingcom/index"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant