vue的初体验
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="appid">
{{message}}
<h1>{{hi}}</h1>
</div>
</body>
<script src="../vue.js"></script>
<script>
// let 变量,const 常量
const app = new Vue({
el: '#appid',//用于挂载要管理的元素
data: {//定义数据
message: '你好呀,vue',
hi: '你好呀,vue'
}
});
app.message = "hhhhh";
</script>
</html>
vue的template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">{{message}}</div>
<script src="../vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
message: "sb"
}
})
</script>
</body>
</html>