• 0
  • 0

uniapp ipad下弹窗showActionSheet 会在左上角显示

2019-08-01 210 0 admin 所属分类:Hbuilder

点击按钮弹出菜单选项

在Ipad下回错位

var menuList = ['查看列表', '查看详情'];
uni.showActionSheet({
    itemList: menuList,
    itemColor: '#0081FF',
    success: function(res) {
        if (menuList[res.tapIndex] == '查看列表') {
            that.order_assign(order.assign_order);
            // fun.goto('/pages/orders/assignOrder?id=' + id+'&assign_order='+order.assign_order);
        } else if (menuList[res.tapIndex] == '查看订单详情') {
            that.order_detail(id);
        }
    }
});

兼容代码如下

this.assign_order = order.assign_order;
this.detail_order_id = id;
if (fun.is_ipad()) {
    this.assign_molal = 'show';
} else {
    var menuList = ['查看列表', '查看详情'];
    uni.showActionSheet({
        itemList: menuList,
        itemColor: '#0081FF',
        success: function(res) {
            if (menuList[res.tapIndex] == '查看列表') {
                that.order_assign(order.assign_order);
                // fun.goto('/pages/orders/assignOrder?id=' + id+'&assign_order='+order.assign_order);
            } else if (menuList[res.tapIndex] == '查看订单详情') {
                that.order_detail(id);
            }
        }
    });
}

页面代码

<view class="cu-modal" :class="assign_molal" @tap="hideAssignModal">
    <view class="cu-dialog">
        <view class="padding-lr bg-white">
            <view class="solid-bottom padding" @tap="order_assign(assign_order)">
                <text class="text-blue">查看列表</text>
            </view>
            <view class="padding" @tap="order_detail(detail_order_id)">
                <text class="text-blue">查看详情</text>
            </view>
        </view>
    </view>
</view>

点击列表项和背景关闭弹窗

hideAssignModal() {
    this.assign_molal = '';
}



返回顶部