
回复
想用bmob后端云的数据库,怎么将数据传到项目里面??看了开发文档都不会😭😭好像开发环境更新后,bmob里面的方法都不适用了!!!有偿求助啊!!!
import { Bmob } from ‘@bmob/bmob’;
interface UserInfo {
objectid?: string;
username?: string;
userimg?: string;
}
@Entry
@Component
struct Index {
@State message: string = ‘Hello World’;
@State lists: UserInfo[] = [];
getAd() {
const query = Bmob.Query(‘userinfo’)
query.get(‘1eed545821’).then((res: UserInfo) => {
// 打印获取的数据
console.log(‘获取的数据:’, res);
this.lists = [res]
}).catch((error:string) => {
// 打印错误信息
console.error(‘获取数据时出错:’, error);
});
}
aboutToAppear() {
this.getAd();
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}