apicloud 常用功能點整理


 

請求提示框


api.showProgress({
    title: '正在登錄...',
    modal: true
});

api.hideProgress();

 

監聽事件


 

api.sendEvent({
    name: 'Listen_addImg',
    extra: {
         type: vm.type,
         img: vm.img
    }
});



api.addEventListener({
              name: 'Listen_addImg'
          }, function(ret, err) {
              vm.addImg(ret.value.type, ret.value.img);
          });

 


openPicker時間格式化

                  api.openPicker({
                      type: 'date',
                      title: '選擇時間'
                  }, function(ret, err) {
                      if (ret) {
                          var month = ret.month  > 9 ? ret.month: '0' + ret.month;
                          var day = ret.day > 9 ? ret.day: '0' + ret.day;
                          if(num == 1){
                            _this.startTime = ret.year +'-'+month +'-'+ day
                          }else {
                            _this.endTime = ret.year +'-'+month +'-'+ day
                          }
                      } else {
                          alert(JSON.stringify(err));
                      }
                  });

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章