当前列表

  点击编辑,行变为编辑框。

  

<Row style="color:#999;margin-bottom:11px">
<Row style="margin-bottom:10px" v-for='(item,index) in jiujie' :key=item.name> <Row v-if='item.vis'>
<Col span="8">
{{item.name}}
</Col>
<Col span="2">
{{item.value}}
</Col>
<Col span="8" offset="6" style="vertical-align: middle">
<Button size='small' type="primary" @click='sdel(index)'>删除</Button>
&nbsp;
<Button size='small' @click="edits(item)">编辑</Button>
</Col>
</Row> <Row v-if='!item.vis'>
</form>
<Col span="8">
<Input style="width:75%" v-model='jiujie[index].name' />
<div class='sdiv' :id="forId(index)">请输入变量名</div>
</Col>
<Col span="2">
<Select v-model="valueSelect">
<Option value="普通变量">普通变量
</Option>
</Select>
</Col>
<Col span="6">
<Input style="width:75%" v-model='jiujie[index].value' />
</Col>
<Col span="8" style="vertical-align: middle">
<Button size='small' type="primary" @click='save(item,index)'>保存</Button>
&nbsp;
<Button size='small' @click="changevis(item,index)">取消</Button>
</Col>
</Row> </Row> <Row style="margin-top:15px">
<Col span="4" offset="8" style="color:#2db7f5 ;font-size:14px;">
<div style="cursor: pointer;" @click='addenvir'>
<Icon type="ios-add" />添加环境变量</div>
</Col>
</Row> </Row>

通过在循环的数组中对象中添加新的元素控制显示隐藏,

通过es6 map方法

this.envirconfig.map((item, index) => {

                            this.jiujie.push(Object.assign({}, item, {
vis: true,
})) });

验证的话是动态加入id,验证之后通过控制id添加样式

 forId: function (index) {
return "a" + index;
},
document.getElementById(id).style.display = 'block';

在vue中场景,循环行,点击当前行编辑数据的更多相关文章

  1. vue 如何在循环中 "监听" 的绑定v-model数据

    vue 如何在循环中 "监听" 的绑定v-model数据 阅读目录 vue 如何在循环中 "监听" 的绑定v-model数据 1. 普通属性的值进行监听 2. ...

  2. 在Vue中使用了Swiper ,动态从后台获取数据的之后,swiper滑动失效??

    在Vue中使用了Swiper ,动态从后台获取数据的之后,swiper滑动失效?? 是因为swiper提前初始化了,那时候数据还没有完全出来.这里有两种解决办法 1. 使用vue提供的$nextTic ...

  3. Vue--axios:vue中的ajax异步请求(发送和请求数据)、vue-resource异步请求和跨域

    跨域原理: 一.使用axios发送get请求 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 & ...

  4. vue中如何使用mockjs摸拟接口的各种数据

    mockjs的作用 生成模拟数据 模拟 Ajax 请求,返回模拟数据 基于 HTML 模板生成模拟数据(后续更新) 帮助编写单元测试(后续更新) Vue 中使用 mock 有两种使用方式,一种是仅编写 ...

  5. vue中解决拖动和点击事件的冲突

    BUG说明: 鼠标上下方向拖拽,如果松开时鼠标位于悬浮按钮上会默认执行click事件,经验证,click事件与mouse事件的执行顺序为onmousedown =>onmouseup => ...

  6. 理解vue中v-for循环中得key原理及一些错误

    作用:给节点做一个标识,相当于人类的身份证号,虚拟DOM中的标识 下列是key值的一些使用场景和带来的问题:   js:    const vm = new Vue({             el: ...

  7. vue中遇到的一个点击展开或收起并且改变背景颜色的问题。

    <template> <div class="expense-center"> <div class="fl expense-left&qu ...

  8. vue中使用element写点击input内部标签(使用模态框传值)

    首先附上源码地址 https://files.cnblogs.com/files/maruihua/vue-tagsinput-master.zip 这个是我修改后的代码.取消了部分功能,添加的一些功 ...

  9. VUE中登录密码显示与隐藏的最简设计——基于iview

    目录 VUE中登录密码显示与隐藏的最简设计--基于iview 1.背景 2.实现最终效果 2.1 隐藏密码 2.2 显示密码 3.实现思路 3.1 v-if判断当前密码显示状态 3.2 密码隐藏状态 ...

随机推荐

  1. C# mouse keyboard monitor

    /*********************************************************************************** * C# mouse keyb ...

  2. SPOJ:The Next Palindrome(贪心&思维)

    A positive integer is called a palindrome if its representation in the decimal system is the same wh ...

  3. 【POJ 1734】 Sightseeing Trip

    [题目链接] 点击打开链接 [算法] floyd求最小环 输出路径的方法如下,对于i到j的最短路,我们记pre[i][j]表示j的上一步 在进行松弛操作的时候更新pre即可 [代码] #include ...

  4. 855E

    数位DP 昨天的B题,excited 又学习了一下数位dp... 数位dp要考虑几个比较重要的东西:1.前导0,2.天际线,3.记忆化的条件,4.细节 经常数位dp会问我们l->r区间中满足某某 ...

  5. Java Socket实战之一:单线程通信

    转自:http://developer.51cto.com/art/201202/317543.htm 现在做Java直接使用Socket的情况是越来越少,因为有很多的选择可选,比如说可以用sprin ...

  6. javascript 中==与===

    1.==相等运算符 1.1如果操作数具有相同的类型,则判断其等同性,如果两个数的值相等,则返回true(相等),否则返回 false (不相等) 1.2如果两个操作数类型不同,则按如下规则: null ...

  7. SpringMVC分页查询无法直接将对象转换成json的解决办法(报org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type:错)

    在用ajax获得分页数据时,无法将获取的值赋值给input标签,在修改用户信息时不显示用户已经注册的信息,百度可知 springmvc处理分页数据返回的对象时,无法直接将对象转换成json,会报org ...

  8. D. Artsem and Saunders 数学题

    http://codeforces.com/contest/765/problem/D 这题的化简,不能乱带入,因为复合函数的带入,往往要严格根据他们的定义域的 题目要求出下面两个函数 g[h(x)] ...

  9. Windowsforms 中对文件操作

    文件及文件夹操作: 引用命名空间:using system .IO; 1.File类: 创建:File.Create(路径);——返回FileStream FileStream fs = File.C ...

  10. JS 事件添加onclick写法注意。

    自定义函数添加onclick事件写法注意. 错误写法:element.onclick = addclass(className); 正确写法:element.onclick = function(){ ...