2022-04-01This dependency was not found:


2022-04-01
详细报错代码:

This dependency was not found:

* @/components/subsidy in ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.2.4@babel-loader/lib!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.8@vue-loader/lib??vue-loader-options!./src/views/subsidy_audit/subsidy_audit.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save @/components/subsidy

前言:vue项目,写了个组件,引入到父级,报错。
报错意思也很简单,就是说识别不了我这个组件subsidy。
排错过程:
引入方式:import Subsidy from '@/components/subsidy';
在components加入了组件名:
components: {
Subsidy,
},
思来想去,发现是我定义的组件写法问题,它应该是识别不了在subsidy文件夹里的subsidy.vue文件,
如果路径是@/components/subsidy这样的,那么它应该需要一个index.js来当作入口文件,然后我把我的组件导入index.js,然后接着导出就行了。
index.js代码:
import Subsidy from './subsidy.vue'
export default Subsidy
嗯,问题解决!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM