插值表达式中写方法

<script src="vue.js" charset="utf-8"></script>
<div id="div1">
  姓名:{{name}}<br>
  年龄:{{age}}<br>
  出生:{{calcBirth()}}
</div>
let vm=new Vue({
el: '#div1',
	data: {
	  name: 'blue',
	  age: 18
	},
	methods: {
	  calcBirth(){
		return new Date().getFullYear()-this.age;
	  }
	}
});

属性绑定

<strong v-bind:title="age+'岁'">{{name}}</strong>

let vm=new Vue({
	el: '#div1',
	data: {
	  name: 'blue',
	  age: 18
	}
});

图片

<img :src="url" alt="">
let vm=new Vue({
el: '#div1',
	data: {
	  name: 'blue',
	  age: 18,
	  url: 'https://cn.bing.com/sa/simg/hpc26.png'
	}
});

:class

<strong :class="class_arr">{{name}}</strong>
let vm=new Vue({
    el: '#div1',
    data: {
      name: 'blue',
      age: 18,
      class_str: 'aa bb cc active',
      class_arr: ['aaa', 'bbb', 'ccc', 'active2']
    }
});

这里可以是数组,也可以是带空格的字符串

:style

<strong :style="style_json">{{name}}</strong>
let vm=new Vue({
    el: '#div1',
    data: {
      name: 'blue',
      age: 18,
      style_str: 'width: 200px; background: yellow; display: block;',
      style_json: {width: '200px', background: 'green', display: 'block'}
    }
});

这里可以是字符串,也可以是对象

v-html (绑定html内容,一般用于富文本编辑器的内容展示)