I'm using vue and laravel to create a chat app this is ChatMessage.vue code:
<template lang="html">
<div class="container">
<p>Message text is here</p>
<small>Author name</small>
</div>
</template>
<script>
export default {
}
</script>
<style lang="css">
</style>
and this is my app.js code:
require('./bootstrap');
window.Vue = require('vue');
Vue.component('example', require('./components/Example.vue'));
Vue.component('chat-message', require('./components/ChatMessage.vue'));
const app = new Vue({
el: '#app'
});
my chat.blade.php view code:
<!DOCTYPE html>
<html>
<head>
<title>Chatroom</title>
<link rel="stylesheet" type="text/css" href="css/app.css">
</head>
<body>
<div id="app">
<h1>
Chat
</h1>
<chat-message></chat-message>
{{-- <chat-log></chat-log>
<chat-composer></chat-composer> --}}
</div>
<script type="text/javascript" src="js/app.js"></script>
</body>
</html>
I get this error:"[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option."
#app
. Are you sure bothrequire
's are working? – Eric Guan