与mustache相区别,他是对内容(content内部)进行修改的。v-bind的语法糖写法是   :

v-bind 动态绑定class属性:v-bind:class="对象名"。/v-bind:class=‘['数组']’

v-bind:class=“{键1:‘值1’,键2:‘值2’}”        Vue在解析的时候,key可以不用加单引号当做字符串进行处理,value加上单引号,当成变量值进行处理;

<body>
<div id="app">
<ul>
<li v-for="(item,index) in items" :style="aaa">{{index}}-{{item}}</li>
<li v-for="(item,index) in items" :style="[background,background1]">{{index}}-{{item}}</li>
</ul>
</div>
<script>
const vm=new Vue({
el:'#app',
data:{
id:1, name:'Vue',
avatar:"http://pic44.nipic.com/20140723/18505720_094503373000_2.jpg",
count:[1,2,3,4,5],
items:["海王","火影忍者","海贼王","进击的巨人"],
active:'active',
aaa:{
color: 'chocolate' ,
fontSize:"100px" },
background:{
color:"blue"
},
background1:{
fontSize: "100px"
}
},
method:{ }
})
</script> //计算属性
<body>
<div id="app">
<p>{{fullname}}</p>
<p>{{fullname1()}}</p>
</div>
<script>
const vm=new Vue({
el:'#app',
data: {
data1:"我是",
date2:"曹润芝"
},
methods:{
fullname1(){
return this.data1+this.date2;
}
},
computed:{
fullname:function () {
return this.data1+this.date2;
}
}
})
</script>
<body>
<div id="app">
<p>总价格:{{totalprice}}</p>
</div>
<script>
const vm=new Vue({
el:'#app',
data: {
books:[{id:110, name:"编程应用0", price:119},
{id:111, name:"编程应用1", price:119},
{id:112, name:"编程应用2", price:119},
{id:113, name:"编程应用3", price:119},
{id:114, name:"编程应用4", price:119},
]
},
computed:{
totalprice:function () {
let result=0;
for (let i=0;i<this.books.length;i++){
result+=this.books[i].price;
}
return result;
}
}
})
</script>
</body>
												

v-bind 绑定属性的更多相关文章

  1. 背水一战 Windows 10 (22) - 绑定: 通过 Binding 绑定对象, 通过 x:Bind 绑定对象, 通过 Binding 绑定集合, 通过 x:Bind 绑定集合

    [源码下载] 背水一战 Windows 10 (22) - 绑定: 通过 Binding 绑定对象, 通过 x:Bind 绑定对象, 通过 Binding 绑定集合, 通过 x:Bind 绑定集合 作 ...

  2. 背水一战 Windows 10 (21) - 绑定: x:Bind 绑定, x:Bind 绑定之 x:Phase, 使用绑定过程中的一些技巧

    [源码下载] 背水一战 Windows 10 (21) - 绑定: x:Bind 绑定, x:Bind 绑定之 x:Phase, 使用绑定过程中的一些技巧 作者:webabcd 介绍背水一战 Wind ...

  3. 绑定: x:Bind 绑定, x:Bind 绑定之 x:Phase, 使用绑定过程中的一些技巧

    背水一战 Windows 10 之 绑定 x:Bind 绑定 x:Bind 绑定之 x:Phase 使用绑定过程中的一些技巧 示例1.演示 x:Bind 绑定的相关知识点Bind/BindDemo.x ...

  4. 绑定: 通过 Binding 绑定对象, 通过 x:Bind 绑定对象, 通过 Binding 绑定集合, 通过 x:Bind 绑定集合

    背水一战 Windows 10 之 绑定 通过 Binding 绑定对象 通过 x:Bind 绑定对象 通过 Binding 绑定集合 通过 x:Bind 绑定集合 示例1.演示如何通过 Bindin ...

  5. 第11课 std::bind和std::function(2)_std::bind绑定器

    1. 温故知新:std::bind1st和std::bind2nd (1)bind1st.bind2nd首先它们都是函数模板,用于将参数绑定到可调用对象(如函数.仿函数等)的第1个或第2个参数上. ( ...

  6. [十六]SpringBoot 之 读取环境变量和绑定属性对象

    1.读取环境变量 凡是被spring管理的类,实现接口EnvironmentAware 重写方法 setEnvironment 可以在工程启动时,获取到系统环境变量和application配置文件中的 ...

  7. WPF Bind 绑定

    原文:WPF Bind 绑定 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/koloumi/article/details/74332515 用过W ...

  8. jquery中bind()绑定多个事件

    bind()绑定事件 $(selector).bind(event,data,function): 参数event为事件名称(如"click,mouseover....."),da ...

  9. Compounding绑定属性

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  10. class中限定绑定属性__slots__方法

    使用__slots__但是,如果我们想要限制class的属性怎么办?比如,只允许对Student实例添加name和age属性.为了达到限制的目的,Python允许在定义class的时候,定义一个特殊的 ...

随机推荐

  1. learning svn add file execuable

    svn propset svn:executable on  <file> 为了给svn仓库里的问件添加可执行权限.

  2. linux系列(一):ls命令

    ls命令是linux下最常用的命令.ls命令就是list的缩写,默认下ls用来打印出当前目录的清单,如果ls指定其他目录,那么就会显示指定目录里的文件及文件夹清单. 通过ls 命令不仅可以查看linu ...

  3. maven下载与安装

    1.下载地址:http://maven.apache.org/download.cgi(Windows平台下载*.zip压缩包,Linux平台下载*.gz压缩包) 2.解压到E:\JAVA\Maven ...

  4. spark常见错误【持续更新】

    错误1.错误: 找不到或无法加载主类 idea.scala代码 idea 导入的scala工程,编写代码后报该错误. 原因:\src\main\scala 包路径下没有将scala这个包设置成Sour ...

  5. 好用的zookeeper客服端----Curator初探

    maven配置: <dependency> <groupId>org.apache.curator</groupId> <artifactId>cura ...

  6. docker 静默安装mysql

    debconf-set-selections命令 1.功能作用 在debconf database中插入默认值 2.位置 /usr/bin/debconf-set-selections 3.格式用法 ...

  7. onPageScroll的使用

    1. 2.

  8. Microsoft Visual C++ 2017 Redistributable

    版本:14.10.25008https://download.microsoft.com/download/4/5/4/454AC59C-DC3F-4AD3-950F-6DCBDF672071/vc_ ...

  9. apache配置https重定向

    apache配置https重定向 一.总结 一句话总结: 网上找不到答案的原因是因为没有精准的描述问题,没有把问题描述清楚:尽量把关键词描述清楚 1.apache将80端口重定向443的具体步骤(在 ...

  10. Mybatis xml mapper 特殊写法总结

    项目告一段落,业务代码也写得差不多了,框架仍然用的是 ssm ,为了省去单表数据库操作的代码编写,继续用 mybatis generator 生成单表对应的实体类.dao层映射关联及配置文件,私下还尝 ...