1.列表页Shop.vue添加@click事件带参
文章图片
{{shopList.name}}
【vue详情页获取列表页内容(多个对象获取,无接口)】¥{{shopList.money}}
2.在列表页方法里面query传递参数
methods: {
jumpPage(id,img,name,money,content){
this.$router.push({
path:'/shoplists',//这是要跳转过去的详情页
query: {
id:id,
img:img,
name:name,
money:money,
content:content
}
})
}
}
}
3.详情页Shoplists.vue获取数据
data () {
return {
id:'',
img:'',
name:'',
money:'',
content:''
}
}
created () {
this._getlistshop()
//console.log(this)
console.log(this.$route.query)
},
methods: {
_getlistshop() {this.name=this.$route.query.name
this.money=this.$route.query.money
this.img=this.$route.query.img
this.content=this.$route.query.content},
},
4.详情页渲染
文章图片
{{name}}
...{{money}}...
推荐阅读
- JavaScript|vue 基于axios封装request接口请求——request.js文件
- 前端|web前端dya07--ES6高级语法的转化&render&vue与webpack&export
- 前端开发|Vue2.x API 学习
- vue|Vue面试常用详细总结
- vue|电商后台管理系统(vue+python|node.js)
- 腾讯TEG实习|腾讯实习——Vue解决跨域请求
- Vue|vue-router 详解
- vue|vue3替代vuex的框架piniajs实例教程
- Vue|Vue3.0的插槽是如何实现的()
- 前端|面试官(谈谈Vue和React的区别())