0
我想实现我最近的项目VUE JS,因为我是新来的吧我可能会做一些错误,我不能写catch.I'm跟着我做的步骤我的组件工作。如果你发现任何错误。你可以帮我解决这个问题。Vue公司的js没有出现在刀片
这是我的刀片视图:
<div class="panel-body">
<chat inline-template>
You are logged in!
<hr>
<h2>Write something to all users</h2>
<input type="text" class="form-control" placeholder="something" required="required" v-model="newMsg" @keyup.enter="press">
<hr>
<h3>Messages</h3>
<ul v-for="post in posts">
<b>@{{ post.username }} says:</b> @{{ post.message }}</li>
</ul>
</chat>
</div>
app.js
require('./bootstrap');
window.Vue = require('vue');
Vue.component('example', require('./components/Example.vue'));
Vue.component('chat', require('./components/chat.vue'));
const app = new Vue({
el: '#app'
});
这是我的chat.vue
<script>
module.exports = {
data() {
return {
posts: [],
newMsg: '',
}
},
ready() {
Echo.channel('public-test-channel')
.listen('ChatMessageWasReceived', (data) => {
// Push ata to posts list.
this.posts.push({
message: data.chatMessage.message,
username: data.user.name
});
});
},
methods: {
press() {
// Send message to backend.
this.$http.post('/message/', {message: this.newMsg})
.then((response) => {
// Clear input field.
this.newMsg = '';
});
}
}
};
</script>
当我加载我认为,我没有看到它。意味着空白页。有什么可能的错误?在此先感谢
你的元素与id应用程序在哪里?有没有任何控制台错误?什么是http响应代码? –