Created
April 24, 2017 16:46
-
-
Save ihuangmx/a47dbd62ee474c231c88e68674245e18 to your computer and use it in GitHub Desktop.
Vue 数据绑定实例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<input type="text" id="input"> | |
<script> | |
let data = { | |
message: "你好,Vue" | |
}; | |
document.querySelector('#input').value = data.message; | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script src="https://cdn.bootcss.com/vue/2.2.6/vue.js"></script> | |
</head> | |
<body> | |
<div id="root"> | |
<input type="text" id="input" v-model="message"> | |
<p>{{ message }}</p> | |
</div> | |
<script> | |
let data = { | |
message: "你好,Vue" | |
}; | |
var vm = new Vue({ | |
el: '#root', | |
data:data | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment