<template>
<view class="content">
<button style="background: red;margin: 20px;" size="mini" type="default" @click="callCloud">调用云函数</button>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
scr: ''
}
},
onLoad() {
},
methods: {
collectionDataBase() {
const db = uniCloud.database();
const contoion = db.collection('mydbs');
return contoion;
},
// 查询所有数据
selectAllData() {
let collection = this.collectionDataBase();
return new Promise((resolve, reject) => {
collection.get().then(res => {
resolve(res.result);
}).catch(err => {
reject(err);
})
})
},
// 筛选数据
selectScreenData(parameter) {
let collection = this.collectionDataBase();
return new Promise((resolve, reject) => {
collection.where(parameter).get().then(res => {
resolve(res.result);
}).catch(err => {
reject(err);
})
})
},
云数据的操作
最新推荐文章于 2023-03-07 17:07:42 发布