直接引用的网址方式:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/vue@3.4.20/dist/vue.global.js"></script>
<title>firstVue</title>
</head>
<body>
<div id="app">
<h1>{{message}}</h1>
</div>
<script>
const a=Vue.createApp({
data(){
return{
message:"I like Vue"
}
}
}).mount("#app");
</script>
</body>
</html>
本地引用方式:把文件下载下来,放到项目文件里面(没有网络的时候也可以使用)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="vue.js"></script>
<title>firstVue</title>
</head>
<body>
<div id="app">
<h1>{{message}}</h1>
</div>
<script>
const a=Vue.createApp({
data(){
return{
message:"I like Vue"
}
}
}).mount("#app");
</script>
</body>
</html>
此时的vue.js文件和html文件是在同一个目录下的