IDE:HBuilderX

Vue最简单例子

html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
<head>
<link rel="stylesheet" href="index.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>

<div id="app">
{{ message }}
</div>

<script src="index.js"></script>
</body>
</html>

css

1
2
3
4
html, body {
margin: 5px;
padding: 0;
}

js

1
2
3
4
5
6
var app = new Vue({ 
el: '#app',
data: {
message: 'Hello Vue!'
}
});