问答详情
源自:2-5 小程序常见问题(二)

面页跳转?

视频中,点了每一条都是跳转到同一个界面了,有什么方法可以跳转到其他页面吗?

提问者:qq_柒年_2 2018-07-30 11:32

个回答

  • qq_恋懿_0
    2018-08-01 00:12:00

    switch(index){

    case 0: wx.navigateTo({url: '/pages/detail/detail?title=' + title})

    break;

    case 1: wx.navigateTo({ url: '/pages/detailA/detailA?title=' + title })

    break;

    default: wx.navigateTo({ url: '/pages/detailB/detailB?title=' + title })

    }


  • qq_恋懿_0
    2018-08-01 00:05:11

    if (index == 0) {

    wx.navigateTo({

    url: '/pages/detail/detail?title=' + title,

    })

    }else if(index==1){

    wx.navigateTo({

    url: '/pages/detailA/detailA?title=' + title,

    })

    } else{

    wx.navigateTo({

    url: '/pages/detailB/detailB?title=' + title,

    })

    }

    然后在app.json中

    "pages":[

    "pages/index/index",

    "pages/jion/jion",

    "pages/detail/detail",

    "pages/detailA/detailA",

    "pages/detailB/detailB",

    "pages/logs/logs"

    ],

    就可以了,我已经试过了!其实用if 太麻烦,可以使用switch case的语句来

  • qq_恋懿_0
    2018-07-31 23:50:58

    可以做if语句判断