vue循环中的v-show
v-show如果使用循环对象的属性来时控制, 这个属性必须是加载时就存在的
<div class="list-group col-sm-12" v-for="(issue,index) in issue_list">
<a @click="switch_comments(issue, index)" style="background-color:#5cb85c;font-weight:bold;" href="#" class="list-group-item">
<span class="glyphicon glyphicon-star"></span> {{index+1}}. {{issue.issue_desc}}
<button @click="removeIssue(index)" type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button></a>
<!--这里的show_comments属性必须是加载的时候就有的,后面加入的会切换无效-->
<div v-show="issue.show_comments">
<a href="#" class="list-group-item" v-for="(comment,cindex) in issue.comments">{{cindex+1}}. {{comment.content}}
<button @click="removeComment(index,cindex)" type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>
</a>
<div class="input-group">
<input @keyup.enter="saveComment(index,cindex)" type="text" class="form-control" placeholder="new comment" v-model="comment">
<div @click="saveComment(index,cindex)" class="input-group-addon btn">Comment</div>
</div>
</div>
</div>
vue循环中的v-show的更多相关文章
- vue 如何在循环中 "监听" 的绑定v-model数据
vue 如何在循环中 "监听" 的绑定v-model数据 阅读目录 vue 如何在循环中 "监听" 的绑定v-model数据 1. 普通属性的值进行监听 2. ...
- for循环中i--的妙用 及 两变量互换数值的问题
int[] array = new int[4]; for(int i = 0; i < array.length; i++){ array[i] = (int)(Math.random() * ...
- Python 之 for循环中的lambda
第一种 f = [lambda x: x*i for i in range(4)] (如果将x换成i,调用时候就不用传参数,结果都为3) 对于上面的表达式,调用结果: >>> f ...
- 在jquery中each循环中,要用return false代替break,return true代替continue。
在jquery中each循环中,要用return false代替break,return true代替continue. $.each(data, function (n, value) { if(v ...
- JavaScript形而上的For循环中的Break
break相当于循环中的GOTO,需避免使用. 下面是一个break使用例子. 找出第一个months小于7的项目. const cats = [ { name: 'Mojo', months: 84 ...
- Java循环中try...finally...遇到continue
一段很简单的代码,先自己在大脑中给出结果: for (int i = 0; i < 5; i++) { System.out.println("enter: i=" + i) ...
- 浅谈循环中setTimeout执行顺序问题
浅谈循环中setTimeout执行顺序问题 (下面有见解一二) 期望:开始输出一个0,然后每隔一秒依次输出1,2,3,4. for (var i = 0; i < 5; i++) { setTi ...
- django for 循环中,获取序号
模板的for循环中,如何获取序号? 想过用enumerate,但是在模板中会报错 Could not parse the remainder xxx: 后来搜到 forloop.counter,完美解 ...
- JS如何获取PHP循环中的ID
JS如何获取PHP循环中的ID kaalrz 二路公交车 结帖率:83.33% 首先抱歉,因为昨天那帖图片几次都不能用,修改到不能再次修改,今天早上回帖又提示没有这个帖,只好重发一次. 如 ...
随机推荐
- Codeforces Round #131 Div1 B
Problem 给出Ai(i∈[0,9]).表示每一个数字至少须要出现多少次.问有多少个数满足下面三个条件:1. 数至多有N位:2. 数不含有前导0:3. 每一个数 i 出现的次数不少于Ai(mod ...
- gzip格式解压缩
gzip格式解压缩 有时候网络请求中会出现gzip格式的数据,而我们无法通过常规办法进行解析: 这时候可以使用下面的这个工具来解决这个问题: https://github.com/mattt/Godz ...
- UITableView加载网络数据的优化
UITableView加载网络数据的优化 效果 源码 https://github.com/YouXianMing/Animations // // TableViewLoadDataControll ...
- FrameLayout和handle实现霓虹灯效果
这个程序的主要思想就是在一个FrameLayout中定义多个TextView,分别设置不同的背景色.因为帧布局的特性,所以这些控件都是叠加起来的.然后,通过定时器循环给handler发送消息,改变控件 ...
- Asp.Net 管道事件注册/HttpApplication事件注册
一.HttpApplication简介 在HttpRuntime创建了HttpContext对象之后,HttpRuntime将随后创建一个用于处理请求的对象,这个对象的类型为HttpApplicati ...
- SVG 文字居中整理
一.基于SVG文档的文字居中 text-anchor: middle; //水平方向居中 dominant-baseline: middle; //垂直居中 1.使用内联样式配置居中 <svg ...
- 用make编译openCV报错:ts_gtest.cpp:(.text._ZN7testing8internal2RED2Ev+0xf): undefined reference to 'regfreeA'
解决方案: the cause is the google tests is looking for the generic regex.h but cmake used the regex.h fr ...
- 直方图与bin
1.bin的含义 直方图中bin的含义:计算颜色直方图需要将颜色空间划分为若干小的颜色区间,即直方图的bin,通过计算颜色在每个小区间内德像素得到颜色直方图,bin越多,直方图对颜色的分辨率越强,但增 ...
- Excel 2016 Power View选项卡不显示的问题
https://zhuanlan.zhihu.com/p/43543442 PowerView是Excel中的Power系列插件之一,可以基于excel制作交互式仪表板. 初学者在使用Power Vi ...
- [转]用 jQuery 实现页面滚动(Scroll)效果的完美方法
转自: http://zww.me/archives/25144 很多博主都写过/转载过用 jQuery 实现页面滚动(Scroll)效果的方法,但目前搜来的方法大都在 Opera 下有个小 Bug: ...