1. 用于处理html标签的动态属性,即动态赋值(动态地绑定一个或多个特性,或一个组件 prop 到表达式)
2. 官网API
1 <!DOCTYPE html>
2 <html lang="en">
3
4 <head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <title>Document</title>
9 <!-- Step1.对于vue,可以用cdn -->
10 <script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.min.js"></script>
11 <style>
12 #app div{
13 padding: 2%;
14 margin-bottom: 1%;
15 border-bottom: 1px solid #ddd;
16 background-color: blanchedalmond;
17 }
18 </style>
19 </head>
20
21 <body>
22
23 <div id="app">
24 <img v-bind:src="imgSrc" width="300px">
25 </div>
26
27 <script type="text/javascript">
28 new Vue({
29 el: '#app',
30 data: {
31 imgSrc:'http://www.5h.com/d/file/20171109/1510218995446598.jpg'
32 }
33 })
34 </script>
35 </body>
36
37 </html>
不知道你有没有做过这样的事情: