Skip to content

Instantly share code, notes, and snippets.

@ihuangmx
Created April 24, 2017 16:46
Show Gist options
  • Save ihuangmx/a47dbd62ee474c231c88e68674245e18 to your computer and use it in GitHub Desktop.
Save ihuangmx/a47dbd62ee474c231c88e68674245e18 to your computer and use it in GitHub Desktop.
Vue 数据绑定实例
<!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>
<!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