cfan
cfan
  • 发布:2020-05-10 16:04
  • 更新:2020-05-10 18:31
  • 阅读:902

请教大神,数据不显示,页面是空白的,求教

分类:HBuilderX

请教大神,如题
云函数get-hotline如下:
'use strict';
exports.main = async (event, context) => {
//event为客户端上传的参数
const db = uniCloud.database();//链接数据库
const collection = db.collection('hotline');
//返回数据给客户端
return collection.get()
};

前端页面如下:
<template>
<view>
<view v-for="(item,index) in list" :key="index">

        <view>  
            <text>{{item.title}}</text>  
            <text>{{item.content}}</text>  
        </view>  

    </view>  

</view>  

</template>

<script>
export default {

    data() {  
        return {  
        list: {  
        },    
        }  
    },  
    onLoad() {  
        this.getData()  
    },  
    methods: {  
        getData(){  
            uniCloud.callFunction({  
              name: 'get-hotline'  
            }).then(res=>{  
            //  console.log(res);  
            return res.data  
            console.log(res.data)   
            })  
        }  
    }  
}  

</script>

<style>

</style>

2020-05-10 16:04 负责人:无 分享
已邀请:
cfan

cfan (作者)

已经自己解决了

该问题目前已经被锁定, 无法添加新回复