实战:从零开始制作一个跑步微信小程序

="stopRun">暂停跑步</button> <text>\\n里程数:{{meters}}km</text> <text>\\n\\n时间:{{time}}</text></view><view class="mainView"> <map class="mapView" style="width: 100%; height: 375px;" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" covers="{{covers}}" > </map></view>

JavaScript文件逻辑代码:

var countTooGetLocation = 0;var total_micro_second = 0;var starRun = 0;var totalSecond  = 0;var oriMeters = 0.0;/* 毫秒级倒计时 */function count_down(that) {    if (starRun == 0) {      return;    }    if (countTooGetLocation >= 100) {      var time = date_format(total_micro_second);      that.updateTime(time);    }      if (countTooGetLocation >= 5000) { //1000为1s        that.getLocation();        countTooGetLocation = 0;      }    setTimeout      setTimeout(function(){        countTooGetLocation += 10;    total_micro_second += 10;        count_down(that);    }    ,10    )}// 时间格式化输出,如03:25:19 86。每10ms都会调用一次function date_format(micro_second) {      // 秒数      var second = Math.floor(micro_second / 1000);      // 小时位      var hr = Math.floor(second /