怎么获得location 里面的数据呢?
发布于 5 年前 作者 mjin 2647 次浏览 来自 官方Issues

onShow() {

var that = this

const chooseLocation = requirePlugin(‘chooseLocation’);

const location = chooseLocation.getLocation(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null

console.log(location.name);  //这样就出错

}

怎么获得location 里面的数据呢?

2 回复

chooseLocation.getLocation(location=>

   {

     console.log(location)

   })

chooseLocation.getLocation()这个方法要改,location需要通过回调方法传值

chooseLocation.getLocation()里面写回调

回到顶部