简易动画效果
微信小程序的路由跳转
// 点击歌曲跳转songDetail toSongDetail(event){ let song = event.currentTarget.dataset.song let musicId = event.currentTarget.dataset.id console.log(musicId); // 路由跳转传参: query wx.navigateTo({ url: '/pages/songDetail/songDetail?musicId=' + musicId, }) },
onLoad: function (options) { /* options 用来接收路由跳转的参数,默认值是空对象 JSON.parse 将对象json对象编译成js对象 注意!!原生小程序url有长度限制,如果传参内容过长会自动截取掉 let song = JSON.parse(options) */ // 获取音乐id let ids = options.musicId // /song/detail this.getSongDetail(ids) },
JSON.stringify() 和JSON.parse() 互相转化