小編給大家分享一下vue.js中怎么獲取url的值,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
vue.js中獲取url值的方法:1、在【main.js】中寫入【path: '/goodsinfo/:goodsId'】;2、在當(dāng)前文件中設(shè)置代碼為【
const router = new VueRouter({ routes: [ { path: '/goodsinfo/:goodsId', component: goodsinfo }, ] })二:在當(dāng)前文件中設(shè)置
![]()
{{subitem.artTitle}}
{{subitem.sell_price}}元
庫存 {{subitem.stock_quantity}} 市場(chǎng)價(jià):
{{subitem.market_price}}三:在跳轉(zhuǎn)后的文件中獲取url中的值
// 獲得商品評(píng)論數(shù)據(jù) getCommentByPage() { const url = `site/comment/getbypage/goods/${ this.$route.params.goodsId }?pageIndex=${this.pageIndex}&pageSize=${this.pageSize}`; this.$axios.get(url).then( res => { this.comment = res.data; }, err => { console.log(err); } ); },以上是“vue.js中怎么獲取url的值”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)站題目:vue.js中怎么獲取url的值-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://weahome.cn/article/dcspdc.html