feat: 更新删除数据

This commit is contained in:
eric
2022-11-13 18:29:08 +08:00
parent 3ea7b3dfd8
commit 70e6a45d06

View File

@@ -45,6 +45,36 @@ export const getTable: any = ({ env,tableName, okFun }: Typeint) => {
});
};
// 更新数据
export const updateTableid: any = ({ env,tableName,objData, id, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable.doc(id).update({
// data 传入需要局部更新的数据
data: objData,
success: (res: any) => {
okFun(res);
},
})
};
// 删除数据
export const deleteTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable.doc(id).remove({
success: (res: any) => {
okFun(res);
},
})
};
// 获取指定id数据数据