收藏
回答

navigator 组件,url 属性,值不能含有 url 字符

<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"
      },
]


回答关注问题邀请回答
收藏
登录 后发表内容