与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. 节点(node)操作

    一.节点的属性 节点值页面中的所有内容,包括标签.属性.文本 nodeType,节点类型:如果是标签,则是1:如果是属性.则是2:如果是文本,则是3 nodeName,节点名字:如果是标签,则是大写的 ...

  2. 使用Ajax和一般处理程序实现文件上传与下载

    1.使用HTML的input标签 <input type="file" multiple="multiple" id="file_load&qu ...

  3. CF1174C Ehab and a Special Coloring Problem(数论)

    做法 与\(x\)互质的数填不同的数,把有向关系表示出来,发现边数是不能承受的 反过来想,成倍数关系填相同的数,把这些数想象成一条链,而这条链开始的数一定是质数,\(\sum\limits_{prim ...

  4. Spring Cloud Gateway(三):网关处理器

    1.Spring Cloud Gateway 源码解析概述 API网关作为后端服务的统一入口,可提供请求路由.协议转换.安全认证.服务鉴权.流量控制.日志监控等服务.那么当请求到达网关时,网关都做了哪 ...

  5. SQL - where条件里的!=会过滤值为null的数据

    !=会过滤值为null的数据 在测试数据时忽然发现,使用如下的SQL是无法查询到对应column为null的数据的: select * from test where name != 'Lewis'; ...

  6. mac 不限速下载大文件

    打开终端后,需要在终端处键入一下代码: 「注意:此处代码不完整, 完整版请 关注微信公众号:「100秒分享」,回复编号「334」获取」 cd ~/Downloads && git cl ...

  7. element-ui框架的el-dialog弹出框被遮罩层挡住了

    解决办法 在el-dialog标签里添加 :modal-append-to-body='false'

  8. SurfaceView双缓冲技术引入

    package com.loaderman.customviewdemo; import android.content.Context; import android.graphics.Canvas ...

  9. vue+php接口

    php: <?php header('Access-Control-Allow-Origin:*'); $date = $_POST['data'];$cars=array("Volv ...

  10. PHP连接MySQL数据库的三种方式(mysql、mysqli、pdo)--续

    2.PHP与Mysqli扩展,面向过程.对象 <?php $mysql_conf = array( 'host' => '127.0.0.1:3306', 'db' => 'test ...