Figure: get the value
One: write in main.js
const router = new VueRouter({ routes: [ { path: '/goodsinfo/:goodsId', component: goodsinfo }, ] })
Two: set in the current file
<template> <div>
<router-link :to="'/goodsinfo/'+ subitem.artID" class=""> <div class="img-box"> <img v-lazy =subitem.img_url> </div> <div class="info"> <h3>{{subitem.artTitle}}</h3> <p class="price"> <b>{{subitem.sell_price}}</b>元</p> <p> <strong>库存 {{subitem.stock_quantity}}</strong> <span> Market Price: <s>{{subitem.market_price}}</s> </span> </p> </div> </router-link>
</div>
</template>
Three: Get the value in the url in the file after the jump
// Get product comment data 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); } ); },
Isn't it super easy and super exciting?