简体   繁体   中英

Error: Cannot find module './MessageFeed.vue'

Here's The Screenshot Of The Error:- 在此处输入图像描述

These Are The Files That I am Working On:- 在此处输入图像描述

Here's The Conversation.vue:-

<template>
<div class="conversation">
    <h1>{{contact ? contact.name : 'Select a Contact'}}</h1>
    <MessageFeed :contact="contact" :message="messages"/>
    <MessageComposer @send="sendMessage"/>




</div>
</template>

<script>
    import MessageFeed from './MessageFeed.vue';
    import MessageComposer from './MessageComposer.vue';

    export default {
        props: {
        contact: {
        type: Object,
        default: null
},
        messages: {
            type: Array,
            default: []
}
},
    methods: {
        sendMessage(text){
            console.log(text);
}

}

}

</script>

Here's The MessageFeed.vue:-

<template>
    <div class="feed">
    <ul v-if="contact">
         <li v-for="message in messages" :class="`message${message.to == contact.id ? ' sent' : 'recieved'}`" :key="message.id">
        <div class="text">
        {{message.text}}
        </div>
</li>
         </ul>  

    </div>

</template>

<script>
    export default {
        props: {
        contact: {
            type: Object, 
            required: true
},
        message: {
           type: Array,
           required: true
}
}

}



</script>

I don't know anything about javaScript or the vue i was just following a tutorial and i stump upon this error couldn't find any solution I didn't even knew what codes to put up here but i hope this must be enough

-ThankYou

Try to rewrite scripts at Conversation.vue like there

    <script>
        import MessageFeed from './MessageFeed.vue';
        import MessageComposer from './MessageComposer.vue';

        export default {
            components: {
    MessageFeed,MessageComposer
  },
            props: {
            contact: {
            type: Object,
            default: null
    },
            messages: {
                type: Array,
                default: []
    }
    },
        methods: {
            sendMessage(text){
                console.log(text);
    }

    }

    }

    </script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM