vue的安装
官方网站:vue官网,进入官网
点击起步,初学可以采用直接引入的方式安装vue.js ,下载开发版本的vue.js
hello vue
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="../js/vue.js"></script>
</head>
<body>
<div id="test">
<h1>{{message}}</h1>
</div>
<script>
const vue = new Vue({
el:"#test",
data:{
message:"hello vue!"
}
});
</script>
</body>
</html>
将vue.js放到工程中,引入vue.js
变量的声明let(变量),const(常量)
el是element的缩写,表示将vue和对应元素绑定,可以直接通过元素id绑定。
data是vue中的数据,可以直接本地赋值,也可以通过网络请求。
绑定的dom元素可以采用{{名称}}的方式引用data中的数据,如{{message}}。运行后会将message的值解析写到h1中
语法简单方便~~~爽的不要不要的!