# shop **Repository Path**: cgctm6/shop ## Basic Information - **Project Name**: shop - **Description**: 电商管理平台开发 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-03 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shop ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). npm install --save @cloudbase/vue-provider import Cloudbase from "@cloudbase/vue-provider"; Vue.use(Cloudbase); 登录功能 const auth = this.$cloudbase.auth() this.$cloudbase.auth().signInAnonymously() .then(res => {console.log(res);}) .catch(err => {console.error(err);}); 数据库功能 const db = this.$cloudbase.database(); db.collection("数据库名称").add().then().catch(); 云函数功能 this.$cloudbase.callFunction({ name: "云函数名称", data:{} }).then().catch(); 存储数据时要引入nodejs方面的sdk npm install --save @cloudbase/node-sdk const tcb = require('@cloudbase/node-sdk') const app = tcb.init({ env: '环境 ID' }) const db = app.database(); db.collection('todos').add({}).then().catch(); 云存储文件 注意:上传文件或视频应该时file类型的数据,而不是base64 await this.$cloudbase.uploadFile({ cloudPath: "", filePath: "" }); let auth = this.$cloudbase.auth(); await auth.signInAnonymously(); let loginState = await auth.getLoginState(); if (loginState.isAnonymousAuth) { const db = this.$cloudbase.database(); let data = await db.collection("cgc").add({ username: "成哥", age: 28 }); console.log(data); let loginres = await this.$cloudbase.callFunction({ name: "login" }); console.log(loginres); }