Vue.js
You’ve probably heard some buzz lately around Vue.js as one of the frameworks to check out in 2017. Vue.js has actually been around since 2014, but seems to be growing in popularity since Vue 2.0 was released last year. The Vue GitHub page has an impressive number of stars and describes Vue.js overall as:
A progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Features
At its core, Vue.js is classified as a reactive, component-oriented view layer that is easy to integrate with other libraries and existing projects that can also scale in combination with supporting libraries to power sophisticated Single Page Applications. For instance there’s an official router, state management system (Flux/Redux type library), AJAX helpers, pre-built UI components, form validation and numerous other helper libraries you can take advantage of, making it “incrementally adoptable” overall. Another core feature to note is the reactive two-way data binding system which ensures your data and the DOM are always in sync.
What makes this framework an interesting choice to look at for mobile in particular is the minimal size (17kb for the core runtime and only 26kb for the runtime+vue-router+vuex), as well as the fact that the rendering layer was rewritten using a lightweight Virtual DOM implementation in Vue 2.0, greatly increasing performance. There are some interesting points and metrics regarding performance in comparison to some other popular frameworks in this post by the author, Evan You you may want to check out as well.
You can start learning Vue.js by using their guides here and JSFiddle sample app. There’s also a vue-cli available to help you scaffold your projects quickly. If you’d like to read more about how Vue.js compares with other frameworks in general, check out this guide posted on that topic specifically.
Mobile UI Frameworks + Vue.js
Framework7
Framework7 is an open-source UI framework for building hybrid apps that provides a heap of UI components, view navigation and other useful widgets to help you build mobile apps quickly. It also has support for both iOS and Android Material design. Take a moment to check out this overview post I wrote over on the PhoneGap blog to get a quick rundown of what it has to offer. I also recommend trying out their Kitchen Sink demo to see all of the components that come out of the box.
Vue Support
Recently Framework7 released a Framework-Vue plugin with support for pretty much all of the components and elements Framework7 supports, as well as integration of the Framework7 Router to render pages in the “Vue” way. This makes it super easy to take advantage of the best of both of these frameworks when building your mobile apps. If you were already using Framework7, you may also want to know there are some extra benefits to using this Framework7-Vue plugin in terms of more structured content, automatic data-binding and simplified layout differences for iOS and Material themes.
Along with their new support for Vue is a set of accompanying guides and sample templates you can use to get started developing quickly. The templates include a static version, a Webpack version and a Browserify version (the second two also with support for hot reload). Timo Ernst is a frequent Framework7 blogger that also posted a sample template and associated video on getting started with Framework7, Vue.js and Webpack that you should also check out.
Live Sample
Below is a live version of the Framework7+Vue Static Template to try out:
PhoneGap+Framework7+Vue Template
In an effort to make things easier to try out this new support immediately with PhoneGap, I decided to take the Framework7+Vue static template from above and add some necessary parts to it (cordova.js, deviceready
handling etc) so you can use it directly with the PhoneGap/Cordova CLI. The resulting template is here in my GitHub repo. All you need to do is specify my URL as the template to use when creating your project from (as shown below) and you’re good to go.
$ phonegap create myVueApp --template http://ift.tt/2jeMEik $ cd myVueApp $ phonegap serve
phonegap
command for cordova
above. Further instructions are located in the project README.Onsen UI
Onsen UI is another UI framework available for building hybrid apps. It’s built on top of Web Components and it’s flexible in that it allows you to use it with various JS frameworks including Angular 1 & 2, React, Vue, Meteor, or independent of a framework. It also has support for iOS and Android Material design with automatic styling based on the platform. Check out their kitchen sink apps for Angular 2 and React to get a better idea of what they have to offer.
Vue Support
Onsen UI currently has support for Vue in a preview version of a binding library you can try out that contains a set of components extended to work with Vue, however it’s currently dependent on Vue 1.x. Support for Vue 2 is in progress however and expected to be coming in the very near future. If you’re interested in trying out their current support, take a look at this blog post containing some important details.
Useful Resources
- Editorial: 2016 Year in Re-Vue
- 3 JavaScript Libraries to Keep an Eye on in 2017
- 5 Best JavaScript Frameworks to Learn in 2017
- PhoneGap with Vue, Browserify + vueify, hot reload, linting and unit testing.
- Vue.js plugin for Cordova
- Onsen UI with Vue 2 will soon be possible!
- Preview! Vue.js support for Onsen UI
- Vue 2.0 is here
- Awesome Vue – a collection of Vue libraries and resources
- Getting up and Running with the Vue.js 2.0 Framework
- Practical Examples for Learning Vue.js
by Holly Schinsky via Devgirl's Weblog
No comments:
Post a Comment