Contoh kode yang digunakan dapat dilihat dan diunduh di https://github.com/purwandi/vue-webpack-mozilla. Ditulis oleh Purwandi, Lead Developer di Froyo.
3. Web App
1. Declarative & Reactivity Rendering
2. Component System Oriented Architecture
3. Client Side Routing
4. State Management
5. Build System
6. Client-Server Data Persistence
7. var vm = new Vue({
el: '#demo',
data: {
msg: 'Hello Vue.js!'
}
})
<div id="demo">
<h1>{{msg}}</h1>
</div>
JavaScriptHTML
Binding
8. var vm = new Vue({
el: '#demo',
data: {
msg: 'Hello Vue.js!'
}
})
<div id="demo">
<h1>{{msg}}</h1>
<input type=”text” v-model=”msg”/>
</div>
JavaScriptHTML
Two Binding
9. var vm = new Vue({
el: '#demo',
data: {
msg: 'Hello Vue.js!'
}
})
<div id="demo">
<h1>{{msg}}</h1>
</div>
JavaScript
Dynamic Bindings
Vue instance
State
DOM Mounting
point
Template
15. Using the component
<my-component msg="Hello!">
</my-component>
my-component’s template will be
inserted into the container element
<p>Hello!</p>
`msg` will be passed in as data
state.
<p>{{msg}}</p>
18. Setup
# install vue-cli
$ npm install --global vue-cli
# create a new project using the "webpack" template
$ vue init webpack my-project
# install dependencies and go!
$ cd my-project
$ npm install
$ npm run dev