1

I'm testing Laravel 5.4 with Vue Components. But the Problem is Vue Components not displaying in View page.

Here is my Vue File :

ChatMessage.vue

<template>
    <div>
        <p>Message text is here</p>
        <small>Author Name</small>
    </div>
</template>

<script>

</script>
<style>
</style>

Here is the blade chat.blade.php

<html>
    <head>
        <title>Chat Rool</title>
        <link rel="stylesheet" href="css/app.css">
    </head>
    <body>
        <div id="app">
            <h1>Chat Room</h1>          
            <chat-message></chat-message>
        </div>
        <script src="js/app.js" charset="utf-8"></script>
    </body>
</html>

Here is my app.js

require('./bootstrap');

Vue.component('chat-message', require('./components/ChatMessage.vue'));

const app = new Vue({
    el: '#app'
});

There is no error of loading app.js Because I have checked it's there in view page. Can anyone suggest Me what's the wrong here?

1 Answer 1

1

It seems in your ChatMessage.vue, you just need to export an empty object, as dont have any other properties, like following:

<template>
    <div>
        <p>Message text is here</p>
        <small>Author Name</small>
    </div>
</template>

<script>
export default {
}
</script>
<style>
</style>
Sign up to request clarification or add additional context in comments.

3 Comments

@Hola You can remove the solution from the question, I see you have added this in the question, it will confuse if someone else later looks at this question.
Right you are, I thought I have checked with that already! I have edited..Thanks for the solution though
@Saurabh Maybe you can help me. Look at this : stackoverflow.com/questions/49664451/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.