Creating Vue examples
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!-- View 视图 -->
<div id="app">
<h1>{{greeting}}</h1>
</div>
<script src="./vue.js"></script>
<script>
const model = {
greeting: 'Hello Vuejs'
}
const app = new Vue({
data: model
});
app.$mount('#app')
</script>
</body>
</html>
Create multiple instances Vue
<body>
<div id="app1">
<h1>{{greeting}}</h1>
</div>
<div id="app2">
<h1>{{greeting}}</h1>
</div>
<script src="./vue.js"></script>
<script>
const app1 = new Vue({
el: '#app1',
data: {
greeting: 'Hello Vuejs'
}
});
const app2 = new Vue({
el: '#app2',
data: {
greeting: 'Hello World'
}
});
</script>
</body>