您的当前位置:首页正文

在鸿蒙中使用selectDistrict调出行政区划页面

2023-01-17 来源:帮我找美食网

一.配置

这个功能,自动签名是不支持的,需要使用AGC里手动配置的签名

1.申请调试证书

2.配置应用证书和指纹

3.在当前工程中entry模块的module.json5文件中,新增metadata,配置name为client_id,value为上一步获取的Client ID

二.实现

配置完成后需要退出登录 重新登录一下避免配置没有生效

       let districtSelectOptions: sceneMap.DistrictSelectOptions= {
              countryCode: "CN"
            };
            // 拉起行政区划选择页
            sceneMap.selectDistrict(getContext(this), districtSelectOptions).then((data) => {
              console.info("SelectDistrict", "Succeeded in selecting district.",data);
            }).catch((err: BusinessError) => {
              console.error("SelectDistrict", `Failed to select district, code: ${err.code}, message: ${err.message}`);
            });
          })

因篇幅问题不能全部显示,请点此查看更多更全内容

热门图文

Top