先展示效果:注意URL中值是有变化的

一:在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
}
]
})

Vue中如何将数据传递到下一个页面(超级简单哒)的更多相关文章

  1. React中父子组件数据传递

    Vue.js中父子组件数据传递:Props Down ,  Events Up Angular中父子组件数据传递:Props Down,  Events  Up React中父子组件数据传递:Prop ...

  2. vue中如何实现数据的双向绑定

    vue中如何实现数据的双向绑定 实现视图变化数据跟着变:分两步,上面get中的为第二步(即再次读取的时候会调用get方法得到之前设置的值,以此来实现动态改变) 由于直接写obj.name = this ...

  3. 在Vue中由后台数据循环生成多选框CheckBox时的注意事项

    多选框是一种非常常见的功能,有时候我们会根据后台返回的数据进行多选框渲染,之前做项目时遇到循环生成多选框时,v-model绑定的值会随着选中与取消改变,但页面却不会变化 的情况,后来测试了一下,发现多 ...

  4. spring 默认情况下事务是惟一的 同一个方法里面第一个sql开启后 在执行完 将事务传递给下一个sql

    spring 默认情况下事务是惟一的 同一个方法里面第一个sql开启后 在执行完 将事务传递给下一个sql

  5. request设置属性 一般当做下一个页面的结果集

    request设置属性 一般当做下一个页面的结果集

  6. vue再次入手(数据传递①)

    准备 之前使用vue.js完成一个项目之后,对其还是充满着无限兴趣,于是不妨利用碎片时间再次研究一下这个“令人着迷”的js框架. 1.新建一个基于vue的项目,具体方法不再赘述,请看这里:http:/ ...

  7. vue再次入手(数据传递②)

    接上篇~ 5.最后一种,互通:无所谓父组件或者是子组件,而是随时随地都能调用到数据的一种方法.便是利用vuex来管理数据,官网描述: Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它 ...

  8. Java WEB中的HttpServletResponse数据传递

    1.什么是HttpServletResponse 2.使用HttpServletResponse向浏览器发送数据及相关实例. 实例1:实现文件下载功能 实例2:实现验证码注册 实例3:实现页面3秒后跳 ...

  9. Vue组件注册与数据传递

    父子组件创建流程 1.构建父子组件 1.1 全局注册 (1)构建注册子组件 //构建子组件child var child = Vue.extend({ template: '<div>这是 ...

随机推荐

  1. matlab给图片插入说明文字

    text(cluster().center(),cluster().center(),num2str(),'color','k') 格式是text(x,y,'说明文字') x,y代表位置

  2. 使用 HTML5 的 IndexedDB API

    1. [代码]判断是否支持 IndexedDB     var indexedDB = window.indexedDB || window.webkitIndexedDB || window.moz ...

  3. openfire调试环境

    导入工程: File->New->project: 选择“Java project from existing ant buildfile” 再从菜单windows->show vi ...

  4. mvc 让伪静态变得简单

    IIS 部署后访问*.* config 配置: <modules runAllManagedModulesForAllRequests="true">      < ...

  5. 【Lintcode】038.Search a 2D Matrix II

    题目: Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence ...

  6. CentOS7的网络配置

    1.DNS配置 新安装的虚拟机,ping 内网IP可以,但是ping 外网域名却失败,告知“Name or service not known”. 原来是因为需要在/etc/sysconfig/net ...

  7. codevs2189数字三角形w——最优性转化

    题目:http://codevs.cn/problem/2189/ 通过增加一维,将最优性转化为可行性. 代码如下: #include<iostream> #include<cstd ...

  8. BZOJ2467五角形生成树——数学

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2467 可以得出只需在每个五角形中去掉任意一条边,在某个五角形中去掉包括内边的两条边即可. 代码 ...

  9. 如何让Surface RT支持网站的flash

    Go to the desktop version of IE10, hit the click ALT button on your keyboard, click on and then Comp ...

  10. WaitHandle.WaitAll 方法在WPF工程中的应用

    因为WaiAll需要多线程支持, 而WPF是STA模式, 可以通过以下方式实现WaitAll ManualResetEvent[] events:  foreach (ManualResetEvent ...