联调index.js页面
来源:21-3 客服问题联调

慕码人1499
2024-06-27
onLoad(() => {
uni.getLocation({
success(res) {
// console.log(‘res’, res);
longitude.value = res.longitude;
latitude.value = res.latitude;
console.log(‘res-onload’, res);
},
fail(err) {
console.log(‘err’, err);
}
});
api.getStadiumList().then((res) => {
if (res.code === 0) {
console.log('res', res);
markers.value = res.data.map((i) => {
return {
...i,
width: 40,
height: 40,
iconPath: '/static/icon.png',
latitude: +i.latitude,
longitude: +i.longitude
};
});
} else {
uni.showToast({
title: 'res.message',
icon: 'none'
});
}
});
});
index.vue中onload时,uni.getLocation在控制台打印出数据
但是api.getStadiumList().在控制台就没有输出
api.getStadiumList().中title: ‘res.message’,这个引号是我自己加的,如果不加引号报错如下:“errno”:1001,“errMsg”:"showToast:fail parameter error: parameter.title should be String,我该怎么调试
1回答
-
coder_monkey
2024-06-27
这个问题前面已经回答过你了:
看 api 下面是否有对应的方法
看 network 面板请求和返回值是否正常
如果对我的回答感到困惑,可以按照以下流程进行自查:
是否了解 api 是什么?api 的类型和作用是什么?api. 和 uni. 的区别是什么?
是否了解 getStadiumList 是什么?getStadiumList 的类型和作用是什么?
是否了解小程序开发者中调试工具的使用?是否了解 network 面板的使用?
是否是从课程第1个章节循序渐进并着手项目实战的?
最后,以上问题可以在如下章节找到答案:
第5章 【基础】微信小程序中的事件系统及交互反馈 - 极致的小程序交互体验
第7章 【中级】微信小程序网络请求的封装 - 现代应用必不可少的重要环节
第13章 【基础】Uni 的多个复杂案例实现 - 加深对 Vue3 和小程序知识点的掌握
00