vue 1.0
Unlike official vue-router which is organized around URLs, Voie is organized around states. Voie-based apps are basically finite-state machines.
State is simply a named logical "place" within your application.
Each state can optionally have:
- URL pattern
- Vue component
- enter hook to populate state with data
- leave hook to cleanup things
States are organized into hierarchies: child states will inherit parameters and data from parent state. Also, if child state has a component, then it will be rendered at the location specified by parent (or nearest ancestor) state denoted by
<v-view>
directive.- 1. Vue.js for beginners @juliobitencourt
- 2. JavaScript everywhere.
- 3. Which path to choose?
- 4. Julio Bitencourt Web Developer since 2000 @juliobitencourt
- 5. Why Vue.js? You know. One more JavaScript Framework.
- 6. Reactive Components for Modern Web Interfaces • Reactivity • Components • Modularity and more
- 7. $ npm install vue $ bower install vue or just CDN <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.js"></script> <div id="app"> </div> new Vue({ el: '#app', });
- 8. Databinding forget $('#mydiv p').text('foo')…
- 9. <div id="app"> <h1>{{message}}</h1> </div> new Vue({ el: '#app', data: { message: 'Hello World' } }); Binding
- 10. <div id="app"> <h1>{{message}}</h1> <input type="text" v-model="message"> </div> new Vue({ el: '#app', data: { message: 'Hello World' } }); Two-way binding
- 11. <div id="app"> <ul> <li v-for="todo in todos"> {{ todo.text }} </li> </ul> </div> new Vue({ el: '#app', data: { todos: [ { text: 'Learn JavaScript' }, { text: 'Learn Vue.js' }, { text: 'Build Something Awesome' } ] } }) Lists
- 12. <span>This will never change: {{* msg }}</span> Interpolations One-time interpolation <span>{{{ raw_html }}}</span> Raw HTML <div id="item-{{ id }}"></div> HTML Attributes JavaScript Expressions {{ number + 1 }} {{ ok ? 'YES' : 'NO' }} {{ message.split('').reverse().join('') }}
- 13. Directives v- syntax
- 14. Special attributes with the v- syntax. A directive’s job is to reactively apply special behavior to the DOM when the value of its expression changes. You could pass an expression or a filter
- 15. Directives <p v-show="greeting">Hello!</p> <a v-bind:href="url"></a> <!-- full syntax --> <button v-bind:disabled="someDynamicCondition">Button</button> <!-- shorthand --> <button :disabled="someDynamicCondition">Button</button>
- 16. DOM events <!-- full syntax --> <a v-on:click="doSomething"></a> <!-- shorthand --> <a @click="doSomething"></a> <form action="done.html" v-on:submit.prevent="myMethod"> <button type="submit">Click here!</button> </form> <!-- shorthand --> <form action="done.html" @submit.prevent="myMethod"> new Vue({ el: '#app', methods: { myMethod: function() { console.log("Hi there!"); } } });
- 17. Conditional Rendering <p v-if=“votes > 1000”>Popular!</p> <a v-else=“doSomething”>Please vote</a> <p v-show=“votes > 1000”>Popular!</p> <a v-else=“doSomething”>Please vote</a>
- 18. Components Just don’t repeat yourself
- 19. Create reusable components <!-- Your App --> <div id="app"> <counter header="Up"></counter> <counter header="Down"></counter> </div> <!-- The template --> <template id="counter-template"> <h1>{{ header }} {{ count }}</h1> <button @click="count += 1">Click me!</button> </template> Vue.component('counter', { template: '#counter-template', data: function() { return { count: 0 } } }); new Vue({ el: '#app', });
- 20. Computed Properties
- 21. Encapsulate complex logic <!-- The template --> <template id="counter-template"> <h1>{{ header }} {{ count }} {{ status }}</h1> <button @click="count += 1">Click me!</button> </template> Vue.component('counter', { template: '#counter-template', data: function() { return { count: 0 } }, computed: { status: function() { return this.count > 10 ? 'Good!' : 'Normal'; } } }); new Vue({ el: '#app', });
- 22. Where to go now?
- 23. Beyond the basics • Routing - vue-router • Ajax - vue-resource • Modules handler (browserify, webpack, duo.js) Check out the docs
The year of 2015 has been a pretty crazy ride for Vue.js. The project has grown way beyond my expectations, so I’d like to take a look back and put things in perspective.
General
READ MOREGeneral
- NPM downloads: 382,184 ytd, ~52k/month current
- GitHub Stars: 11,357 current
Unfortunately Bower and CDNs do not offer download statistics - there should be at least equal if not more usage from these sources, since a considerable portion of Vue.js users use it for non-SPA purposes and pull it directly from a CDN.
The GitHub star count saw a whopping 7.6k+ growth since February. In comparison, the project collected a total of ~3.6k stars in its first year (Feb 2014 - Feb 2015).
Repo Activity
- Releases: 54 ytd (from 0.11.5 to 1.0.12, including alpha/beta/rc releases)
- Commits: 1,023 ytd
- Issues Closed: 1,014 ytd
- Pull Requests Merged: 69 ytd from 43 contributors
Vuejs.org
- Page views: 3,761,728 ytd
- Unique visitors: 363,365 ytd
- 30 Day Active Users: 76,090 current
Recently there has been a lot of discussion around the tooling hurdle when you start a React project. Luckily for Vue.js, all you need to do to start with a quick prototype is including it from a CDN via a
In real world applications we inevitably need a certain amount of tooling to give us modularization, transpilers, pre-processors, hot-reload, linting and testing. These tools are necessary for the long-term maintainability and productivity of large projects, but the initial setup can be a big pain. This is why we are announcing vue-cli, a simple CLI tool to help you quickly scaffold Vue.js projects with opinionated, battery-included build setups.
READ MORE
<script>
tag, so we’ve got that part covered. However, that’s not how you’d build a real world application. In real world applications we inevitably need a certain amount of tooling to give us modularization, transpilers, pre-processors, hot-reload, linting and testing. These tools are necessary for the long-term maintainability and productivity of large projects, but the initial setup can be a big pain. This is why we are announcing vue-cli, a simple CLI tool to help you quickly scaffold Vue.js projects with opinionated, battery-included build setups.
“When you have different goals – it’s impossible to say ‘we have the best practices for doing everything’. Because the web is just so versatile.”
Vue.js is a lightweight front-end JavaScript framework that makes it simple to begin prototyping and building web interfaces. Vue.js provides a flexible API for MVVM data bindings, and can serve as an alternative to other front-end frameworks like Angular and React.
READ MORE
Vue.js is a lightweight front-end JavaScript framework that makes it simple to begin prototyping and building web interfaces. Vue.js provides a flexible API for MVVM data bindings, and can serve as an alternative to other front-end frameworks like Angular and React.
Vue MDL is a set of reusable Material Design Lite(mdl) components. Its purpose is to make it easy for everyone to use mdl by doing all the data binding and giving you the control over classes with props
Vue MDL is only available through
npm
. Install it:npm install --save vue-mdl
If you use a module bundler likewebpack orBrowserify, you can require it
var vmdl = require('vue-mdl');
and use it. Otherwise you can include it in your html:
<script src="//rawgit.com/posva/vue-mdl/master/dist/vue-mdl.js"></script>
Add
.min
to get the minified version:
<script src="//rawgit.com/posva/vue-mdl/master/dist/vue-mdl.min.js"></script>
You'll also need to include Material Design Lite. As it's not bundled with vue-mdl itself.