微信小程序,仿建行圆形菜单绑定点击事件,获取不到对应菜单内容
最近学习仿建行圆形菜单,在绑定菜单的点击事件上遇到了问题。本身圆形菜单是通过xw:for获取数组中的内容生成的,然后通过
style="-webkit-transform: rotate({{item.deg}}deg)
对view进行旋转,形成了圆形菜单,但是通过
<viewclass="menu-item"wx:for="{{menuList}}"wx:key="{{item.index}}" animation="{{animationData}}" bindtap='selectMenu'data-index="{{index}}">
绑定点击事件后,不管点击了哪个菜单,后台获取到的总是数组中的最后一个元素内容。
menuList内容如下:
[{0:{deg: 0,menu: "我的账户",src: "../images/account.png",index: 0}},
{1:{deg: 60,menu: "特色服务",src: "../images/account.png",index: 1}},
{2:{deg: 120,menu: "信用卡",src: "../images/account.png",index: 2}},
{3:{deg: 180,menu: "投资理财",src: "../images/account.png",index: 3}},
{4:{deg: 240,menu: "现金贷款",src: "../images/account.png",index: 4}},
{5:{deg: 300,menu: "转账汇款",src: "../images/account.png",index: 5}}
]