<template>
<div>
<div class="content clearfix" v-on:click="goorderingDetail(v)" v-for="(v,index) in anylist" :key="index">
<div class="clearfix">
<div class="fl dingnumber">订单号&nbsp;&nbsp;<span>{{v.orderNum}}</span></div>
<div class="fr state">{{v.state}}</div>
</div>
<div class="clearfix receive">
<div class="fl">收</div>
<div class="fr add reAdd">{{v.receiveAdd}}</div>
</div>
<div class="clearfix send">
<div class="fl">发</div>
<div class="fr add sAdd">{{v.sendAdd}}</div>
</div>
<div class="date fl">2018年9月28日&nbsp;&nbsp;&nbsp;&nbsp;12:00</div>
<div class="fr sure" v-on:click.stop="gosureReceive(v)">确认取件</div>
</div>
</div>
</template> <script>
import $ from 'jquery'
export default {
name: 'ordering',
data () {
return {
anylist: []
}
},
mounted () {
this.ready()
},
methods: {
ready: function () {
$.ajax({
type: 'GET',
url: './../../../static/ing.json',
data: {},
dataType: 'json'
}).then(res => {
// console.log(res)
// console.log(res.data)
this.anylist = res.data
})
.catch(error => {
console.log(error)
})
},
goorderingDetail: function (v) {
// console.log(v.receiveAdd)
// console.log(v.sendAdd)
/* 获取当前点击内容的收件发件地址 */
var IreAdd = v.receiveAdd
var IseAdd = v.sendAdd
var IOrderNum = v.orderNum
sessionStorage.setItem('IReAdd', JSON.stringify(IreAdd))
sessionStorage.setItem('ISeAdd', JSON.stringify(IseAdd))
sessionStorage.setItem('IOrderNum', JSON.stringify(IOrderNum))
this.$router.push({path: '/orderingDetail'})
},
gosureReceive: function (v) {
// console.log(v.receiveAdd)
// console.log(v.sendAdd)
/* 获取当前点击内容的收件发件地址 */
var IreAdd = v.receiveAdd
var IseAdd = v.sendAdd
sessionStorage.setItem('IReAdd', JSON.stringify(IreAdd))
sessionStorage.setItem('ISeAdd', JSON.stringify(IseAdd))
this.$router.push({path: '/sureReceive'})
}
}
}
</script> <style scoped>
.content{
width: 96%;
margin: auto;
padding: 0.3rem;
background: #ffffff;
box-shadow: 5px 5px 5px #eae8e8;
margin-top: 0.5rem;
}
.dingnumber{
font-size: 0.8rem;
line-height: 1.7rem;
}
.state{
font-size: 1rem;
letter-spacing: 1px;
color: #ff7c1d;
margin-right: 0.5rem;
font-weight: bold;
}
.receive,.send{
font-size: 0.9rem;
font-weight: bold;
color: #ff7c1d;
margin-top: 1rem;
}
.add{
width: 85%;
vertical-align: bottom;
word-break:keep-all;/* 不换行 */
white-space:nowrap;/* 不换行 */
overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
}
.date{
text-align: left;
font-size: 0.8rem;
padding: 0.2rem;
margin-top: 2rem;
}
.sure{
padding: 0.5rem 1rem 0.5rem 1rem;
border: 1.5px solid #ff7c1d;
letter-spacing: 1px;
border-radius: 0.3rem;
margin-top: 0.9rem;
margin-right: 0.3rem;
font-weight: bold;
color: #ff7c1d;
font-size: 0.9rem;
z-index: 1000;
}
</style>

上面代码中,第3行和第17行:

第3行和第17行函数都包含在v-for循环中,参数中传入的参数v都可以获取到数据集合

第50和第62行在函数中传入v即可获取到对应的值(但是需要在定义函数和使用函数时都传入参数v才能用)

vue中v-for的用法以及参数的作用的更多相关文章

  1. 详解Vue中watch的高级用法

    我们通过实例代码给大家分享了Vue中watch的高级用法,对此知识点有需要的朋友可以跟着学习下. 假设有如下代码: <div> <p>FullName: {{fullName} ...

  2. vue 中 命名视图的用法

    今天主要记录  vue中命名视图的用法 先奉上官网网址:https://router.vuejs.org/zh/guide/essentials/named-views.html 一般情况下,一个页面 ...

  3. vue中watch的详细用法

    在vue中,使用watch来响应数据的变化.watch的用法大致有三种.下面代码是watch的一种简单的用法: <input type="text" v-model=&quo ...

  4. vue中watch的详细用法(转载)

    在vue中,使用watch来响应数据的变化.watch的用法大致有三种.下面代码是watch的一种简单的用法: <input type="text" v-model=&quo ...

  5. vue中router-link的详细用法

    官网文档地址:https://router.vuejs.org/zh/api/#to 今天项目突然有需求,让vue中的一个页面跳转到另一个页面 // 字符串 <router-link to=&q ...

  6. 【Vue中的坑】路由相同参数不同无法触发路由

    场景: vue实现导航栏,二级导航栏跳转到相同页面,通过参数来实现到该页面后,根据参数来滚动到对应到位置 网上的解决方法: 通常情况下我们喜欢设置keepAlive 包裹 router-view &l ...

  7. vue中this.$set的用法

    之前了解这个方法的时候,感觉这一辈子也用不到这个方法,因为当时没有应用场景,但是还真有用的时候,我相信你们也有用到时候. 从三个方面给大家说一下这个this.$set: 1.this.$set实现什么 ...

  8. vue中$ref的基本用法

    1.使用在一般的标签上 <div id="app"> <input ref="count" type="text" v-m ...

  9. vue中watch函数的用法

    vue中watch函数: 不仅可以判断路由变化(上篇博客有介绍),还可以判断数据的变化 (1):首先写watch函数 (2):在data里定义值 (3):在methods里写方法 (4):使用值

  10. Vue中echarts的基本用法

    前言:同大多数的前端框架一样,先读官网的使用方法.学会基本使用后,在实例中找到自己想要demo.拿过来改一改,一个echarts图表就形成,毕竟人家做就是为了方便使用. 我是在vue中下面直接使用的e ...

随机推荐

  1. HIVE JOIN_1

    HIVE JOIN 概述 Hive join的实现包含了: Common (Reduce-side) Join Broadcast (Map-side) Join Bucket Map Join So ...

  2. 解决plsql遇到乱码的问题

    遇到问题: PLSQL中汉字显示乱码,并且SQL语句中如果有汉字,则执行时报错.其实并不是SQL语句写的有问题,而是系统不能识别汉字. 解决方法. 首先执行语句 select * from V$NLS ...

  3. Vue或React多页应用脚手架

    https://github.com/zhujiasheng/vue-multipage https://github.com/MeCKodo/vue-multipage

  4. selenium无法定位元素问题

    在用自动化测试工具selenium完成下载任务时,经常会遇到定位不到元素的情况,总结如下: 1.frame/iframe原因定位不到元素: 这个是最常见的原因,首先要理解下frame的实质,frame ...

  5. React开发实时聊天招聘工具 -第六章 登陆注册(2)

    1.bodyParser和cookieParser:   const bodyParser = require('body-parser') const cookieParser = require( ...

  6. CSUOJ 1525 Algebraic Teamwork

    Problem A Algebraic Teamwork The great pioneers of group theory and linear algebra want to cooperate ...

  7. 与TCP/IP协议的初次见面(一)

    与TCP/IP协议的初次见面(一) 前言 今下午刚才女朋友那边回来,唉,算是情人节去找她吧,穷屌丝住不起好酒店,住的打折酒店,只是女朋友来姨妈了,万幸啊,牙还疼得不行,这几天光照应她了,没空写博客了. ...

  8. 转:关于ios 推送功能的终极解决

    刚刚做了一个使用推送功能的应用 遇到了一些问题整的很郁闷 搞了两天总算是弄明白了 特此分享给大家 本帖 主要是针对产品发布版本的一些问题 综合了网上一些资料根据自己实践写的 不过测试也可以看看 首先要 ...

  9. IsoAlgo3d - IDF/PCF pipeline 3d viewer

    IsoAlgo3d - IDF/PCF pipeline 3d viewer eryar@163.com Key Words. IDF, PCF, IsoAlgo, 3D 当前国际主流管道设计软件都可 ...

  10. QVBoxLayout移除控件之后没有消失

    想在QWidget里面动态的添加和删除控件,给QWidget设置了一个布局管理器QVBoxLayout,要删除控件可以 使用QVBoxLayout::removeWidget(QWidget *w)方 ...