| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 801 人关注过本帖
标题:微信小程序渲染异常求助
只看楼主 加入收藏
Libra天秤
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2022-5-9
收藏
 问题点数:0 回复次数:0 
微信小程序渲染异常求助
程序代码:
js:data: {
        showdata:{},
        

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that=this
        
      that.setData({
        good_id:options.good_id
      })
      console.log(options.good_id)
      
      
      
      wx.showLoading({
        title: '加载中',
      })
      wx.request({
          url: getApp().globalData.server +'/index.php/Home/Goods/get_one_lol_goods', //仅为示例,并非真实的接口地址
          data: {
            good_id:options.good_id       
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded' // 默认值
          },
          method:'POST',
          success (res) {
            console.log(res.data)
           
           if(res.data.error_code!=0){
            wx.showModal({
              title: '哎呀!',
              content: '出错了呢'+res.data.msg,
              showCancel:false,
              success (res) {}
            })
          }
          else if(res.data.error_code==0){
              that.setData({
                 showdata:res.data.data
              })
              
              console.log(that.data.showdata)  
                                                          
        }
              },
              fail:function (res) {
                wx.showModal({
                  title: '哎呀!',
                  content: '网络不在状态呢',
                  success :function (res) {
                    if(res.confirm){
                      console.log('用户点击确定')
                    }else if(res.cancel){
                      console.log('用户点击取消')
                    }
                  }
                    })
                  },
          complete:function (res) {
              wx.hideLoading()
          }
        })
        setTimeout(function(e){
          wx.hideLoading()
      },2000)



    },

程序代码:
<block wx:for="{{showdata}}" wx:for-item="itemName" wx:for-index="id" wx:key="{{index}}"> 
    <view class="box">
        <view class="firstblock">
            <image class="touxiang" src="{{itemName.image_url}}" mode="widthFix"></image>
            <view class="person">
                <view class="name">
                    <text class="showname">{{itemName.seller_name}}</text>
                </view>
                <view class="name">
                    <text class="showname2">{{itemName.good_name}}</text>
                </view>
                
            </view>
        </view>
    <view class="secondblock">
        <text class="content"> {{itemName.content}}
</text>
    </view>
    <view class="thirdblock">     
        <view  class='del' bindtap='buy'  >购买</view>
    </view>
</view>
</block>


本来渲染一条的情况,变成了渲染20条,而且实际内容为空白,求助各位编程高手解答
搜索更多相关主题的帖子: view text data class res 
2022-05-09 22:06
快速回复:微信小程序渲染异常求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025014 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved