国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 熱點(diǎn) > 微信 > 正文

微信小程序技巧之show內(nèi)容展示,上傳文件編碼問題

2024-07-22 01:16:39
字體:
供稿:網(wǎng)友

show內(nèi)容展示

嘗試用微信小程序的template組件實(shí)現(xiàn)。同時(shí),嘗試頁面間轉(zhuǎn)跳時(shí)傳參,在目標(biāo)頁面引入模板文件實(shí)現(xiàn) 寫的更少,做的更多 篇幅有限詳細(xì)代碼此處省略

  <view class="show-warp">    <block wx:for="{{discuss}}" wx:key="index">      <template is="discuss" data="{{item}}"></template>      <template is="discuss-reply" data="{{item}}"></template>      <template is="discuss-more" data="{{item}}"></template>    </block>  </view>
  Page({    data: {      discuss: [],      petAge: 0,      reply: false,      height: 20    },    onLoad: function(){      util.dataList.call(this, {        cb: util.petAge      });    }    });  /*   * 部分公共邏輯頁代碼   */  function list(option) {    var opt = {      url: option.url || 'https://api.zg5v.com/index.php/index/show/showindex',      data: option.data || {        uid: 148,        num: option.pageNum || 0      },      update: option.update || false,      cb: option.cb || false,      func: option.func || false    };    // 數(shù)據(jù)列表    var showList = [];    var objDa = [];    this.data.replyListArr = [];    // 保存/修改 this指向    var self = this;    ajax({      url: opt.url,      data: opt.data,      cb: function(res) {        showList = res.data.data;        // 統(tǒng)一格式        if (!Array.isArray(showList) &&          typeof showList === 'object') {          // 計(jì)算評(píng)論發(fā)布時(shí)間          showList.pl.forEach(function(e, i) {            e.cp_chongbirth = e.cp_addtime * 1000;            e.replyTime = opt.cb(e.cp_chongbirth, true);          }, showList.pl);          objDa.push(showList);        } else {          objDa = showList;        }        // 更新評(píng)論列表        if (opt.update) {          let da = res.data.data.pl,            plDa = self.data.discuss,            i = 0,            j = 0,            len = da.length,            jLen = plDa.length;          for (; j < jLen; j++) {            for (; i < len; i++) {              if (plDa[j].pl.length > 0) {                plDa[j].pl.push(da[i]);              }            }          }          objDa = plDa;          opt.update = !opt.update;        }        if (res.data.status === 1) {          for (var i = 0, len = objDa.length; i < len; i++) {            if (opt.cb && typeof opt.cb === 'function') {              // 計(jì)算寵物年齡              objDa[i].petAge = opt.cb(objDa[i].cp_chongbir ||                objDa[i].cp_chongbirth);            }          }          self.setData({            discuss: objDa          });        } else if (res.data.status === 2 || res.data.status === 0) {          self.onLoad();        }        objDa = [];      }    });  }

上傳文件編碼問題(*)

header 里的數(shù)據(jù)在真機(jī)預(yù)覽的時(shí)候是無效的。那就嘗試改變編碼進(jìn)行傳輸,在uploadFile 的參數(shù)中加入

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 安乡县| 千阳县| 营山县| 收藏| 景泰县| 新密市| 莲花县| 西藏| 锡林郭勒盟| 鹤庆县| 永仁县| 定陶县| 夏津县| 博野县| 磴口县| 响水县| 凌源市| 介休市| 富锦市| 津市市| 永年县| 宾川县| 永康市| 台州市| 安阳县| 汤原县| 宜黄县| 雷波县| 清水县| 洛隆县| 堆龙德庆县| 信丰县| 阿图什市| 泰宁县| 通渭县| 中超| 肇庆市| 平凉市| 东阿县| 泸定县| 怀柔区|