小编par*_*gee的帖子

如何使用Vue.js(使用Vueify)通过组件显示数据?

我无法在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)

javascript arrays node.js vue.js

11
推荐指数
1
解决办法
2万
查看次数

为什么Hapi.js POST处理程序返回空的有效负载?

我有一个接受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.

难道我做错了什么?

javascript hapijs

3
推荐指数
1
解决办法
2104
查看次数

标签 统计

javascript ×2

arrays ×1

hapijs ×1

node.js ×1

vue.js ×1