收藏
回答

Swiper超出内容不显示? 但是在开发者工具是是可以显示出来的 高度是自适应的

XML代码:

<!-- 未支付 -->

<swiper current="{{currentTab}}" duration="300" style="height:{{height}};">

<swiper-item catchtouchmove="stopTouchMove">

<view wx:for="{{noPay}}" wx:key="key">

<view class="sub_order_header no_pay">

<text class="z fs32 fw">未支付</text>

<text id="textCounter">{{item.deliveryAddressCity}}-{{item.shippingAddressCity}}</text>

<text class="y">{{item.createTime}}</text>

</view>

<view class="sub_order_content">

<view class="sub_order_img_detail z">

<text class="order_img_name">订单编号:{{item.orderNo}}</text>

<text class="order_img_name">货物:{{item.goodsName}}</text>

<text class="order_img_name">承运商:{{item.carriers.companyname}}</text>

<view class="cost">

<text class="m30">共计:¥{{item.actualPrice}}</text>

<view class="pay_btn" bindtap="payBtn" data-key="{{index}}">立即支付</view>

</view>

</view>

</view>

</view>

</swiper-item>

</swiper>

js:

//获取应用实例

var app = getApp();

Page({

data: {

yesPay:[], //已支付

noPay:[], //未支付

delivery:[], //派送中

arrive:[], //已到达

image:'cloud://kytx-6.6b79-kytx-6-1259665066/image/checkLogistics1_22.png',

/* tab切换  */

currentTab: 0,

//轮播的高度设置

height:''

},

onLoad: function (options) {

var that = this

//未支付

wx.request({

url: app.globalData.host + '/wx/getOrderByuserId',

method: 'post',

data: { userId: app.globalData.userData.id, status: 2 },

header: {

'content-type': 'application/x-www-form-urlencoded'

},

success: function (res) {

var height = res.data.length * 340;

var hei = height + "rpx"

that.setData({

noPay: res.data,

height: hei

})

}

})

},

onShow:function(){

},

/**

 * 点击tab切换

 */

swichNav: function (e) {

var that = this;

if (this.data.currentTab === e.target.dataset.current) {

return false;

} else if (e.target.dataset.current == 0) {  //未支付

that.setData({

currentTab: e.target.dataset.current

})

//未支付

wx.request({

url: app.globalData.host + '/wx/getOrderByuserId',

method: 'post',

data: { userId: app.globalData.userData.id, status: 2 },

header: {

'content-type': 'application/x-www-form-urlencoded'

},

success: function (res) {

var height = res.data.length * 340;

var hei = height + "rpx"

that.setData({

noPay: res.data,

height: hei

})

}

})

} else if (e.target.dataset.current == 1) {   //已支付

that.setData({

currentTab: e.target.dataset.current

})

//已支付

wx.request({

url: app.globalData.host + '/wx/getOrderByuserId',

method: 'post',

data: { userId: app.globalData.userData.id, status: 3},

header: {

'content-type': 'application/x-www-form-urlencoded'

},

success: function (res) {

var height = res.data.length * 340;

var hei = height + "rpx"

that.setData({

yesPay: res.data,

height:hei

})

}

})

} else if (e.target.dataset.current == 2) {  //派送中

that.setData({

currentTab: e.target.dataset.current

})

//派送中

wx.request({

url: app.globalData.host + '/wx/getOrderByuserId',

method: 'post',

data: { userId: app.globalData.userData.id, status: 4},

header: {

'content-type': 'application/x-www-form-urlencoded'

},

success: function (res) {

var height = res.data.length * 340;

var hei = height + "rpx"

that.setData({

delivery: res.data,

height:hei

})

}

})

} else if (e.target.dataset.current == 3) {  //已签收

that.setData({

currentTab: e.target.dataset.current

})

//已签收

wx.request({

url: app.globalData.host + '/wx/getOrderByuserId',

method: 'post',

data: { userId: app.globalData.userData.id, status: 5},

header: {

'content-type': 'application/x-www-form-urlencoded'

},

success: function (res) {

var height = res.data.length * 340;

var hei = height + "rpx"

that.setData({

arrive: res.data,

height:hei

})

}

})

}

},

payBtn: function (e) {

var that = this

var index = e.currentTarget.dataset.key

var data = {

body: that.data.noPay[index].goodsName,  //货物名称

total_fee: that.data.noPay[index].actualPrice, //实际运费

payOrderId: that.data.noPay[index].id, //订单id

orderNo: that.data.noPay[index].orderNo, //订单编号

companyname: that.data.noPay[index].carriers.companyname, //承运商

orderTime: that.data.noPay[index].createTime, //下单时间

openid: app.globalData.openid

}

var datas = JSON.stringify(data);

wx.navigateTo({

url: '../w_payment/w_payment?datas=' + datas,

})

},

searchOrder:function(e){

var that = this

var index = e.currentTarget.dataset.key //获取当前选择的索引

that.setData({

index:index

})

wx.navigateTo({

url: '../orderDetail/orderDetail',

})

},

stopTouchMove:function(){

return false;

}

})


最后一次编辑于  09-04  (未经腾讯允许,不得转载)
回答关注问题邀请回答
收藏

1 个回答

问题标签