<template>
<div id="app">
<!-- 绑定属性 -->
<div v-bind:title="title">你好,世界</div>
<!-- 绑定class -->
<div :class="{'red':flag,'blue':!flag}">你好,世界</div>
<!-- 绑定style -->
<div class="box" :style="{width:boxwidth+'px'}"></div>
<!-- 绑定HTML -->
<div v-html="h"></div>
<!-- 绑定数据2 -->
<div v-text="msg"></div>
<!-- 循环数据,第一个高亮 -->
<ul>
<li v-for="(item,key) in list" :class="{'blue':key%2==0,'red':key%2!=0}">
{{key}}---{{item}}
</li>
</ul> </div>
</template> <script>
export default {
data () {
/*业务逻辑里面定义的数据*/
return {
title:'你好,世界',
h:'<h2>h2</h2>',
msg:'你好vue',
list:[1,2,3],
flag:true,
boxwidth:300
}
}
}
</script> <style>
.red{color:red}
.blue{color:blue}
.box{
height:100px;
width:100px;
background:red
}
</style>

vue2.* 绑定属性 绑定Class 绑定style 03的更多相关文章

  1. WPF绑定时要绑定属性,不要绑定字段

    如题(就是加get;set;),绑定属性不出东西,不知道为什么...

  2. Vue知识整理5:v-bind绑定属性(Class 与 Style 绑定)

    通过v-bind实现Class 与 Style 绑定,方便调整属性的值

  3. React对比Vue(02 绑定属性,图片引入,数组循环等对比)

    import React, { Component } from 'react'; import girl from '../assets/images/1.jpg' //这个是全局的不要this.s ...

  4. Angular4.x 创建组件|绑定数据|绑定属性|数据循环|条件判断|事件|表单处理|双向数据绑定

    Angular4.x 创建组件|绑定数据|绑定属性|数据循环|条件判断|事件|表单处理|双向数据绑定 创建 angular 组件 https://github.com/angular/angular- ...

  5. vue 绑定属性 绑定Class 绑定style

    <template> <div id="app"> <h2>{{msg}}</h2> <br> <div v-bi ...

  6. Vue绑定属性 绑定Class 绑定style

    <template> <div id="app"> <h2>{{msg}}</h2> <br> <div v-bi ...

  7. vue绑定属性、绑定class及绑定style

    1.绑定属性  v-bind 或者 : 例如:<img :src="pic_src" /> <template> <div id="app& ...

  8. Vue2自定义指令改变DOM值后未刷新data中绑定属性的值

    标签(空格分隔): Vue 自定义指令用于过滤输入框,只允许输入数字: Vue.directive('numberOnly', { bind: function (el, binding) { el. ...

  9. 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数据转换

    [源码下载] 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数 ...

随机推荐

  1. 关于键盘KeyDown事件

    if (e.KeyValue==13) //如果键盘的值等于13 这里面的13是enter键 textBox2.Focus(); //焦点就跑到textbox2上面

  2. 笔记本(华硕UL80VT)软件超频setFSB

    Warning !!!If you are a beginner, do not use this software. This software is for power users only. U ...

  3. 基于环境变量为多用户配置不同的JDK(win)

    情景 同一服务器同时部署不同项目需要使用不同的JRE 环境 Windows Server 2008 需求 用户admin 需要使用jdk1.8 用户admin1 需要使用jdk1.7 解决 通过配置用 ...

  4. 【SSH网上商城项目实战24】Struts2中如何处理多个Model请求

       转自: https://blog.csdn.net/eson_15/article/details/51465067 1. 问题的提出 Struts2中如果实现了ModelDriven<m ...

  5. HTTP 错误500.19 - 错误代码 0x80070021

    1.错误描述 HTTP 错误500.19 -Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息 模块 IIS Web Core  通知 Begi ...

  6. 007Spring Security

    01.基于Spring AOP 和 Servlet规范中Filter实现  的安全框架 <dependency> <groupId>org.springframework.se ...

  7. LeetCode赛题390----Elimination Game

    # 390. Elimination Game There is a list of sorted integers from 1 to n. Starting from left to right, ...

  8. 安卓app开发-05-Android xml布局详细介绍

    安卓app开发-05-Android xml布局详细介绍 虽然说有 墨刀,墨客 这些图形化开发工具来做 Android 的界面设计,但是我们还是离不开要去学习做安卓原生app,学习 xml 布局还是必 ...

  9. 安卓app开发-04- app运行的运行和调试

    app 运行的运行和调试 本篇介绍在 Android Studio 开发工具,运行调试设备:真机和虚拟机. 真机调试(USB 连接手机) 尽量使用真机进行调试,无论是调试效果和速度都比模拟器要好.使用 ...

  10. Angular1.x directive(指令里的)的compile,pre-link,post-link,link,transclude

    The nitty-gritty of compile and link functions inside AngularJS directives  The nitty-gritty of comp ...