问题描述:
在微信小程序中自定义组件时,编译报Component is not found in path '...'
VM4941:1 jsEnginScriptErrorComponent is not found in path "components/watermark/watermark" (using by "pages/login/login")Error: Component is not found in path "components/watermark/watermark" (using by "pages/login/login") at e (http://127.0.0.1:48631/appservice/__dev__/WAService.js:13:26480) at e (http://127.0.0.1:48631/appservice/__dev__/WAService.js:13:26632) at W (http://127.0.0.1:48631/appservice/__dev__/WAService.js:14:749) at Object.t.addView (http://127.0.0.1:48631/appservice/__dev__/WAService.js:14:1759) at Function.value (http://127.0.0.1:48631/appservice/__dev__/WAService.js:15:25997) at j (http://127.0.0.1:48631/appservice/__dev__/WAService.js:15:4246) at U (http://127.0.0.1:48631/appservice/__dev__/WAService.js:15:6628) at G (http://127.0.0.1:48631/appservice/__dev__/WAService.js:15:6894) at Function.<anonymous> (http://127.0.0.1:48631/appservice/__dev__/WAService.js:15:9282) at http://127.0.0.1:48631/appservice/__dev__/WAService.js:15:14950解决方法:
确认自定义的组件的js文件是否存在Component构造器
Component({});确保要引入的页面的json文件中的usingComponents的path是正确的:
文件路径:
这里的路路径有两种写法:
{ "usingComponents": { "watermark" : "/components/watermark/watermark" }}{ "usingComponents": { "watermark": "../../components/watermark/watermark" }}














