< block wx:for = "{{menus}}" wx:key = "identifier" > < navigator url = "{{item.url}}" open-type = "navigate" class = "weui-cell weui-cell_access" hover-class = "weui-cell_active" > < view class = "weui-cell__bd" >{{item.name}}</ view > < view class = "weui-cell__ft weui-cell__ft_in-access" ></ view > </ navigator > </ block > |
menus 是个数组,内容如下
[ { "name" : "统计" , "identifier" : "statistics" , "url" : "/pages/statistics/index" }, { "name" : "关于我" , "identifier" : "about" , "url" : "/pages/about/index"
] |
把 url 换成 path 就好了,这里解析的时候可能有 bug
即
[ { "name" : "统计" , "identifier" : "statistics" , "path" : "/pages/statistics/index" }, { "name" : "关于我" , "identifier" : "about" , "path" : "/pages/about/index" }, ] |