1.在untils中创建common.js(写工具方便调用,也就是公共js)//封装弹窗 export function showToast(title="",icon="none",mask=true){ let posttion =icon=='none'? 'bottom':'center'; uni.showToast({ title, icon, mask, position }) } 2.在edit中调用此方法在onsumit里面进行判断为空提示警告const onSubmit =async() =>{ if(formDate.value.content===""){ return showToast("鸡汤内容不能为空") //return在返回值后会直接必掉这整个函数 } let res =await db.collection("so
1.在soup-chicken.schema.json中加入(补充上次没创建完的)"from":{ "bsonType": "string", "title": "鸡汤出处", "trim": "both" }, 2.上传此表结构到云数据库(右键单击上传)3.提交测试内容到云数据库 //其中from和content是提交表里面有的字段才行,这里使用了异步同步方法在edit里面创建一个点击事件import { ref } from 'vue'; const db=uniCloud.database() //相当于链接云数据库 const formDate =ref({ soup_type:0, content:"", from:"", }) const
一.创建云数据库的表结构1.新键DBSchema,根据文章模板创建(创建soup-chicken)2.修改soup-chicken.schema.json根据自身需要{ "bsonType": "object", "required": [ "content", "soup_type" ], "permission": { //增删改查的权限 "read": true, "create": true, "update": true, "delete": true }, "properties": { "_id": { "descri
1.在https://unicloud.dcloud.net.cn/上面创建服务空间,然后再hbuilder上的项目里面关联服务空间2.在unicloud文件中,cloudfunction是逻辑云函数,database是数据库
1.给list中的熬制鸡汤创建跳转到edit的navigator2.在soup-item中加入两个跳转,并运用到事件冒泡的方法<view class="head"> <view class="left"> <soup-tab-group></soup-tab-group> </view> <view class="right" @click.stop="goDetail"> <uni-icons type="eye" size="18" color="#999"></uni-icons> <text>详情</text> </view> </view>
ikrins