我无法在Vue组件中显示数据.我正在使用Vueify,我正在尝试从listings.vue组件中加载一系列列表,并且我一直在收到错误.另外,我不明白如何通过该computed方法提取数据.任何帮助,将不胜感激.
这是我在控制台中遇到的错误:
[Vue warn]: The "data" option should be a function that returns a per-instance value in component definitions.
[Vue warn]: $mount() should be called only once.
Run Code Online (Sandbox Code Playgroud)
这是我的app.vue
// app.vue
<style>
.red {
color: #f00;
}
</style>
<template>
<div class="container">
<div class="listings" v-component="listings" v-repeat="listing"></div>
</div>
</template>
<script>
module.exports = {
replace: true,
el: '#app',
components: {
'listings': require('./components/listings.vue')
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的listing.vue组件
<style>
.red {
color: #f00;
}
</style>
<template>
<div class="listing">{{title}} <br> {{description}}</div>
</template>
<script> …Run Code Online (Sandbox Code Playgroud) 我有一个接受POST调用的Hapi路由,但request返回null有效负载的值.
server.route({
method: ['POST', 'PUT'],
path: '/create_note',
handler: function (request, reply) {
console.log(request.payload); // returns `null`
return reply(request.payload);
}
});
Run Code Online (Sandbox Code Playgroud)
我正在使用Postman发送POST呼叫http://localhost:8000/create_note?name=test.
在处理函数中,console.log(request.payload)返回null.
难道我做错了什么?