web使用微信云数据库
<script>
export default {
name: 'index',
data() {
return {
access_token: 0
};
},
computed: {},
components: {},
created() {
this.getData();
},
mounted() {},
methods: {
async request() {
const res = await uni.request({
url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=你的APPID&secret=你的APPID密钥'
});
return res[1].data.access_token;
},
async getData() {
const token=await this.request()
this.request();
const res = await uni.request({
url: 'https://api.weixin.qq.com/tcb/databasequery?access_token='+token,
method:"POST",
data: {
env: '环境',
query: 'db.collection(\'Bill\').get()'
}
});
console.log(123);
console.log(res[1].data.data);
}
}
};
</script>
<style lang="scss" scoped></style>
注:以上内容仅用于日常学习

浙公网安备 33010602011771号