2017-02-02 11 views
1

VueコンポーネントでLaravel 5.4をテストしています。しかし、問題はビューコンポーネントがビューページに表示されないことです。ここでは、ブレードchat.blade.phpVueコンポーネントがデータをロードしていません

<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> 

がここにある私のアプリです

ChatMessage.vue

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

<script> 

</script> 
<style> 
</style> 

は、ここに私のVueファイルです。 js

require('./bootstrap'); 

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

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

読み込み中にエラーが発生しないapp.jsこれはビューページにあることを確認したためです。 誰も私にここに何が間違っていると提案することができますか?

答えて

1

他のプロパティを持っていけないようごChatMessage.vueで、あなただけの、次のように、空のオブジェクトをエクスポートする必要がありそうです:

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

<script> 
export default { 
} 
</script> 
<style> 
</style> 
+0

@Holaあなたは、質問から溶液を除去することができます私はあなたが質問にこれを加えたのを見ます、誰かがこの質問を後で見るなら混乱します。 – Saurabh

+0

そうです、私はすでにそれをチェックしたと思いました! 私は編集しました。 – Hola

関連する問題