使用Want Weapp进行跳转

因为这里使用的是第三方库,所以你要引入哈。
在app.json中引入哈。

 "usingComponents": {
        "van-cell": "@vant/weapp/cell/index",
        "van-cell-group": "@vant/weapp/cell-group/index"
    },

虽然官网值这样说的,但是这样是要不得的,这是一个坑

引入
在app.json或index.json中引入组件,详细介绍见快速上手

"usingComponents": {
  "van-cell": "path/to/@vant/weapp/dist/cell/index",
  "van-cell-group": "path/to/@vant/weapp/dist/cell-group/index"
}
这样要不得哈  要将 path/to/去除   还要将 /dist去除

这里循环的时候,不能直接在vant-cell中循环,因为这是自定义的。
所以外面在加一层view标签哈
border="{{borderfalse}}" 值为false不要下边框
custom-class="iconfont {{item.iocn}}" 自定义class。用来显示阿里字体图标库

wxml

 <view wx:for="{{gotoList}}">
        <van-cell custom-class="iconfont {{item.iocn}}" is-link border="{{borderfalse}}" title="{{item.cont}}"
            link-type="navigateTo" url="/pages/othertest/othertest" />
    </view>
     js

 borderfalse: false, //不要边框

    // list中的跳转
    gotoList: [
      {
        url: "/pages/othertest/othertest",
        cont: "个人主页",
        iocn: "icon-system"
      },
      {
        url: "/pages/othertest/othertest",
        cont: "牛人问答",
        iocn: "icon-service"
      },
    ]

猜你喜欢

转载自www.cnblogs.com/ishoulgodo/p/12499819.html