Vue 属性绑定
快速上手本来没有了解CDN模式,但巩固有些东西的时候还是绕不过~
- v-bind 绑定超链接
test.js实例化vue对象
// 实例化vue对象
new Vue({
el: '#vue_det',
data: {
site: "菜鸟教程",
url: "http://www.runoob.com",
alexa: "10000",
websiteTag:"<a href='http://www.runoob.com'>菜鸟教程</a>"
},
methods: {
details: function() {
return this.site + " - 学的不仅是技术,更是梦想!";
}
}
})
- 绑定 value值
- 绑定标签
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>element-starter</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="vue_det">
<input type="text" v-bind:value="site"/>
<a v-bind:href="url">http://www.runoob.com</a>
<br />
<input type="text" value="菜鸟教程"/>
<a v-bind:href="url">http://www.runoob.com</a>
<br />
<p v-html="websiteTag"></p>
</div>
<script src="test.js"></script>
<!--
<div id="app"></div>
-->
</body>
</html>