我在源代码树上创建了一个名为RegisterPayMonthlyDialog.vue
的自定义组件。问题在于,当将其导入视图Monthly.vue
时,npm无法找到该模块。
错误
ERROR Failed to compile with 1 errors 11:06:29 PM
This dependency was not found:
* @/components/dialogs/RegisterPayMonthlyDialog in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./nod
e_modules/babel-loader/lib!./node_modules/vuetify-loader/lib/loader.js??ref--18-0!./node_modules/cache-load
er/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Monthly.vue?vue&type
=script&lang=js&
To install it, you can run: npm install --save @/components/dialogs/RegisterPayMonthlyDialog
源树
Monthly.vue
<template>
<v-container class="pa-5">
<h3>Mensalidades</h3>
</v-container>
</template>
<script>
import RegisterPayMonthlyDialog from "@/components/dialogs/RegisterPayMonthlyDialog"; // can't find it
export default {
name: "Monthly",
components: {
RegisterPayMonthlyDialog
},
data() {
return {
showPayMonthyDialog: false
};
}
};
</script>
RegisterPayMonthlyDialog.vue
<template>
<div class="text-center">
<v-dialog v-model="show" width="500">
<v-card>
<v-card-title primary-title class="title">Pagamento de mensalidade</v-card-title>
</v-card>
</v-dialog>
</div>
</template>s
<script>
export default {
name: "RegisterPayMonthlyDialog",
data() {
return {};
},
props: {
show: Boolean
}
};
</script>
答案 0 :(得分:1)
您输入错误。参见下面的代码
您正在导入名为RegisterPayMonthlyDialog
的文件,但是您的文件名为RegisterPayMonhtlyDialog
,
要解决此问题,请将文件名更改为RegisterPayMonthlyDialog.vue
并这样导入
import RegisterPayMonthlyDialog from "@/components/dialogs/RegisterPayMonthlyDialog"