zoukankan      html  css  js  c++  java
  • 微信小程序 带参调用后台接口 循环渲染页面 wx.request wx:for

    test.js 文件里的onLoad

    function getarticles(p,order,mythis) {
      wx.request({
        url: 'https://ganggouo.cn/index.php/Home/getarticles',    //后台接口地址
        method: 'post',  //post请求
        data: {
          p: p,
          order: order,
        },
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: function (res) {
          mythis.setData({
            Articlelist: res.data
          });
        },
        fail: function (res) {
          console.log(res);
        }
      });
    };

    test.html 页面渲染

    <view class='projectlist' >
      <view class='project'  wx:for="{{arrayProject}}"  wx:for-item="itemProjec" wx:key="id" data-datas="{{itemProjec}}" bindtap='projectDetail'>
          <view class='projectText'> {{itemProjec.gongchengmingcheng}} </view>
          <view class='projectleibie label'> {{arrayCategory[itemProjec.leixing].name}} </view>
          <view class='projectjiesuan label'> {{arraySchedule[itemProjec.jieduan].name}} </view>
          <view class='projectTime'> {{itemProjec.faburiqi}} </view>
      </view>
    </view>
  • 相关阅读:
    Docker下安装redis
    Goodnotes5
    Notability
    浏览器好用的技术
    苹果平板上好用的软件推荐
    苹果平板爱思助手检验安兔兔
    积分超过排名的第一天
    卸载Windows控制面板的程序和功能中找不到的一些软件的方法
    怎样在GitHub上新建一个文件夹
    Vim的常用操作
  • 原文地址:https://www.cnblogs.com/l199616j/p/10061550.html
Copyright © 2011-2022 走看看