Guoguo-notes
主页
常用笔记
vue笔记及周边生态
  • 团队协作及规范
  • 项目框架及架构
  • 飞码篇
  • Java
  • React笔记
GitHub
主页
常用笔记
vue笔记及周边生态
  • 团队协作及规范
  • 项目框架及架构
  • 飞码篇
  • Java
  • React笔记
GitHub
  • 常用笔记

    • 1. CSS笔记.md
    • 2. Echarts.md
    • 3. Git 代码管理.md
    • 4. Html 笔记.md
    • 5. TypeScript.md
    • 6. axios 请求拦截.md
    • 7. js常规.md
    • 8. npm.md
    • 9. sh 笔记.md
    • 10. valibot校验学习.md
    • 11. 云开发教程.md
    • 12. 公共API接口.md
    • 13. 小程序笔记.md
    • 14. 插件库.md
    • 15. 服务器.md
    • 16. 服务器部署教学.md
    • 17. 浏览器px to rem适配.md
    • 18. 登录逻辑.md
    • 19. 网站配色.md
    • 20. 跨域代理.md

1.买一个环境,可以得到一个环境ID

2.在app.vue 里面写

onShow: function() {
    wx.cloud.init({
        env: "guoguo-school-9gyphpbe161a19f9"
    })
    console.log('App Show')
},

3. 在页面中调用

guoguoBox 是 自己的数据库表名

const db = wx.cloud.database();
db.collection('guoguoBox').where({
    sex: this.sextext
}).get({
    success: (res => {
        this.dataLength = res.data.length
        this.getbox2 = res.data
    })
})

完整代码

<template>
  <view class="container">
    <button @click="init(0)">status=0</button>
    <button @click="init(1)">status=1</button>
    <button @click="init(2)">status=2</button>
  </view>
</template>

<script>
  export default {
    methods: {
      init(e) {
        const db = wx.cloud.database();
        db.collection('life-numbers').where({
          status:e
        }).get({
          success: (res => {
            console.log(res);
          })
        })
      }
    }
  }
</script>

为什么不在main里面注册

小程序路径转电脑端=> 临时路径

https://docs.cloudbase.net/storage/get-temp-url
Edit this page
Last Updated:
Contributors: 袁果锅
Prev
10. valibot校验学习.md
Next
12. 公共API接口.md