其中“restaurantId”和“shopId”都是在js中定义的变量,如何形成正确的url地址。求大神指导!
1 使用字符串拼接:
wx.navigateTo({ path: 'restaurantId/shop/shop?shopId=' + shop_id })
2 使用模板字符串:
wx.navigateTo({ path: `restaurantId/shop/shop?shopId=${shop_id}` })
你这样的格式需要用反引号。`xxxxx${aaa}`
url: ‘…/restaurantId/shop/shop?shopId=’ . this.shop_id
url: ‘xxxx?shopId=’ + shop_id