小程序列表导航

这里写图片描述

wxml

<view class='myItemBox'>
    <view class='myItemList' wx:for="{{itemList}}" wx:key="{{index}}" data-url="{{item.url}}" bindtap='navBtn'>
        <image src='{{item.icon}}'></image>
        <view class='myItemName'>{{item.name}}</view>
    </view>
</view>

wxss

.myItemBox {
    margin-top: 15rpx;
    background: #fff;
}

.myItemList {
    position: relative;
    height: 100rpx;
    line-height: 100rpx;
    margin-left: 30rpx;
    border-bottom: 2rpx solid #eee;
}

.myItemList:after {
    position: absolute;
    content: "";
    display: block;
    width: 16rpx;
    height: 16rpx;
    top: 50%;
    margin-top: -8rpx;
    right: 30rpx;
    border-top: 2rpx solid #ddd;
    border-right: 2rpx solid #ddd;
    transform: rotate(45deg);
}

.myItemName {
    margin-left: 60rpx;
}

.myItemList image {
    width: 40rpx;
    height: 100rpx;
    padding: 30rpx 0;
    box-sizing: border-box;
    float: left;
}

js

Page({
    data: {
        itemList: [{ 'name': '全部订单', 'icon': '../../../images/order.png', 'url': '' },
            { 'name': '收获地址', 'icon': '../../../images/address.png', 'url': 'address' },
            { 'name': '我的优惠券', 'icon': '../../../images/myCoupon.png', 'url': 'coupon' },
            { 'name': '联系我们', 'icon': '../../../images/contact.png', 'url': '' },
            { 'name': '店铺管理', 'icon': '../../../images/store.png', 'url': '' },
            { 'name': '我的访客', 'icon': '../../../images/fangke.png', 'url': '' },
            { 'name': '员工管理', 'icon': '../../../images/yuangong.png', 'url': '' },
            { 'name': '销售财务统计', 'icon': '../../../images/tongji.png', 'url': '' },
            { 'name': '优惠券设置', 'icon': '../../../images/couponSet.png', 'url': '' },
        ]
    },
    navBtn:function(e){
        console.log(e.currentTarget.dataset.url)
    },
    onLoad: function (options) { },
    onReady: function () { },
    onShow: function () { },
    onHide: function () { },
    onUnload: function () { },
    onPullDownRefresh: function () { },
    onReachBottom: function () { },
    onShareAppMessage: function () { }
})
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值