<html>
<head>
<script type = "text/javascript" src = "vue.min.js"></script>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>My first Vue app</title>
<script src="https://unpkg.com/vue"></script>
</head>
<body>
<div id="app">
{{ message }}
</div>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Vue.js example with CDN'
}
})
</script>
</body>
</html>
CDN的Vue.js示例
<!DOCTYPE html>
<html>
<head>
<title>My first Vue app</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
{{ message }}
</div>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Vue.js second example with CDN'
}
})
</script>
</body>
</html>
Vue.js CDN的第二个示例
npm install vue
npm install --global vue-cli
+ vue-cli@2.9.6
added 238 packages from 205 contributors in 346.282s
vue init webpack my_project
现在, 创建项目。 使用以下命令转到项目目录:
cd my_project
使用以下命令启动服务器:
npm run dev