我一直在谷歌上搜索已经有一段时间了解为什么..我的模态组件在我的vieworder.vue组件中无法识别。
我收到了:
ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?
type=script&index=0!./src/components/ViewOrder.vue
Module not found: Error: Can't resolve './components/Modal.vue' in
'C:\xxxxxx\xxxxxxxxx\src\components'
ViewOrder.vue - 使用模态:
<template>
<div class="col-sm-10 col-sm-offset-1" v-if="order">
<modal v-if="showModal" @close="showModal = false">
</modal>
</div>
</template>
<script>
import * as types from '../store/mutationtypes'
import { mapGetters, mapActions } from 'vuex'
import Modal from './components/Modal.vue'
export default {
name: 'ViewOrder',
components: {
'modal': Modal
}
....
Modal.vue
<template>
....
</template>
<script>
export default {
name: "modal"
}
</script>
Main.js - 参考:
....
import Modal from './components/Modal.vue'
import ViewOrder from './components/ViewOrder.vue'
....
答案 0 :(得分:4)
import Modal from './components/Modal.vue'
应为import Modal from './Modal.vue'
您在components
ViewOrder.vue
文件夹中