vue传值到另一个页面(vue+element-ui 点击表格的查看详情按钮传值到个人页)

本文目录
vue+element-ui 点击表格的查看详情按钮传值到个人页
将code参数传给code字段。赋给this.query
调用api里面的fetchList方法查询。这里根据code查student_id。在fetchlist括号里把this.query带入。console.log打印出this.query的值。
获取后台传过来的数据,把第一个字段的id传给定义的变量id。
然后用this.$router.push传值,使用query方法,把变量id传给字段id。
接受页面用this.$route.query的方法接受值id,把获取的值传给student_id。
vue脚手架如何实现将数据传给下一个html
跟脚手架没有关系。你可以用bus或者vuex传递数据。
在goodslist.vue文件夹绑定
《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》市场价: 《s》{{subitem.market_price}}《/s》
《/span》
《/p》
《/div》
《/router-link》
在下一个页面 goodsinfo.vue写入
getGoodsInfoData() {
const url = `site/goods/getgoodsinfo/${this.$route.params.goodsId}` this.$axios.get(url).then(res =》 { this.goods = res.data.message
}, err =》 {
console.log(err)
})
},
在main.js中 即可
const router = new VueRouter({
routes: [{
path: ’/’,
redirect: ’/goodslist’
},
{
path: ’/goodslist’,
component: goodslist
},
{
path: ’/goodsinfo/:goodsId’,
component: goodsinfo
},
{
path: ’/shopcart’,
component: shopcart
}
]
})
希望我的回答对你有帮助

更多文章:
全球新冠肺炎疫情背景下航运发展(盐田港复苏日志:半年历劫从“低谷”到“爆仓” 疫情之后巨轮如何越洋航行)
2026年9月7日 17:10
matlab求解带字母参数方程组(我想matlab求一个关于x,y的方程组 ab c d f e h m n 都是参数)
2026年9月7日 16:30
oracle中的循环语句(下面哪个不是oracle程序设计中的循环语句 a for)
2026年9月7日 15:30
电脑里2个系统怎么删除一个(电脑开机显示有两个系统,如何删除一个)
2026年9月7日 12:20
scrollthrough意思(“scroll”是什么意思)
2026年9月7日 08:00
怎么激活keygen(注册机如何激活cad2008一个简单激活cad2008的方法)
2026年9月7日 06:30
vba编写excel插件(excel vba中能否动态创建控件)
2026年9月7日 04:40




