- 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.
In the previous post, we reorganized our code into components. This allows us to reuse code only pieces of our code. However, our
index.html
and app.js
files had a bunch of extra code in them that would require us to sort through the next time we wanted to use the code in another project. There has to be a better way to organize this code, right? Well of course there is, or this would be the lamest blog post ever.
The solution is to move our code into subdirectories, each containing a component. Then we can use Browserify to bring it all together. My preferred method is to use Gulp with Browserify. So I will show you how to set it up.
In the previous post, we created a simple Point of Sale system. However, the code only uses one Vue instance and no compnents.
There is no sense of encapsulation in the code. The main Vue instance is responsible for doing everything. We should move some of these pieces into their own components so that each one can be responsible for itself and use the parent to share state between child components instead. Also, since this is already a working “product,” this should require alot of copy-and-pasting with some extra additions.
READ MORE
There is no sense of encapsulation in the code. The main Vue instance is responsible for doing everything. We should move some of these pieces into their own components so that each one can be responsible for itself and use the parent to share state between child components instead. Also, since this is already a working “product,” this should require alot of copy-and-pasting with some extra additions.
So let’s get started. First, pull down the code from the repo for this series. Then we will check out the beginning code. Lastly, let’s bring in all the dependencies. I have gone ahead and provided a
Once the server is running, view the page in the browser at
READ MORE
package.json
file that has some of the things we need. I recommend running a local server while going through these tutorials. There are a few options. You can run a local python server using python -m SimpleHTTPServer
. My preferred method is to use the http-server npm package. Once the server is running, view the page in the browser at
http://localhost:8000
. This is just the basic UI we will be working with. The items on the right are the items that can be added to a transaction. The transaction information is on the left. It shows the items already added to the transaction, their amounts and totals, and then the subtotal, tax, and total of the whole transaction. Let’s start making this thing function like a real POS system.
If you don’t know what Vue.js is by now, then you have to check it out! In case you haven’t heard of it, here is how Vue.js describes itself on its website:
Vue.js is a library for building modern web interfaces. It provides data-reactive components with a simple and flexible API.
That isn’t very specific. Vue.js is a view library that updates the physical DOM based on state managed in JavaScript. You manipulate the state and the webpage will update to reflect the changes. Pretty cool, huh? It’s similar to React and can be thought of as a stripped down version of AngularJS.
Comparison
Why doesn’t MDG just adopt Vue.js and forget about React vs Blaze?
Wednesday, December 16, 2015
With all of the discussion surrounding what is going to happen to Blaze and how soon React will be the default UI layer of meteor, why is everyone ignoring vue.js176?
Reasons why vue.js should be considered
- Vue is maintained by a core meteor developer.
Evan You created and maintains vue.js, and is a core meteor developer. This gives him insight into what meteor needs, as well as having an independent, agnostic UI layer (which I believe is what meteor needs) - Similarity to Blaze
The syntax for vue.js is extremely similar to blaze. In fact, it seems like a perfect three-way marriage between angular, react and blaze. However, the focus of vue.js is strictly to be a front-end UI built for quick starts and short learning curves. This fits into meteor's wheelhouse perfectly. - Maintaining meteor patterns
One of my biggest issues in using react is that it does a terrible job of maintaining separations of concerns (in a front-end developer experience). While react tries to manage your entire application state through flux/redux, vue.js doesn't care. - Speed/Small learning curve
What many of us may not realize is that one of the main stengths of meteor is that it allows developers with little to no experience learn how to make rich applications through it's speed of getting set up and running. It's why I learned meteor, and why I'm a developer to this day. The front-end UI layer of meteor should be the same and should not require a complete rethink of your application. - It provides possible stability
React is the hotness right now, we can all agree to that. But last year at this time it was angular. Many years ago it was Ember. Essentially, every so many years we see a change it what people prefer. Being that React is going to have to compete with angular 2.0 soon combined with the fickleness of front-end techs, why not just choose a quickly up and coming framework now and make it our own? If not, what happens if the tides turn and angular 2.0 usurps react as the front-end framework du jour?
Mithril isn't only incredibly efficient – it's also got an incredibly small API and is incredibly quick to learn as a result. I find it far more intuitive: its simple API allows you to get simple things done much quicker, but crucially when you have a complicated scenario I find it easier to reason about the problems with Mithril than the other larger frameworks, which tend to need more of a deep understanding of the codebase to solve generic problems. But it' also very young, and doesn't have any big commercial names backing it.
Angular (backed by Google) has the most crowded community and contributer network. Also the earliest version of these new generation frameworks. Now it kinda got old and even own developers making core design changes for Angular v2.
React (backed by Facebook) is getting more famous everyday. It is not a complete solution like Angular and has a total different paradigm. Once you learn Angular v1, adapting to React is not that easy. But many developers did it, just for sake of better performance.
Vue on the other hand is like a better version of Angular v1 and while Angular v2 is still baking Vue is a ready to use framework with most of fixes in Angular v2. It is easier to jump from Angular v1 to Vue and it even has a better performance than React. It's not that much known as others, which means smaller community though.
READ MORE
Angular (backed by Google) has the most crowded community and contributer network. Also the earliest version of these new generation frameworks. Now it kinda got old and even own developers making core design changes for Angular v2.
React (backed by Facebook) is getting more famous everyday. It is not a complete solution like Angular and has a total different paradigm. Once you learn Angular v1, adapting to React is not that easy. But many developers did it, just for sake of better performance.
Vue on the other hand is like a better version of Angular v1 and while Angular v2 is still baking Vue is a ready to use framework with most of fixes in Angular v2. It is easier to jump from Angular v1 to Vue and it even has a better performance than React. It's not that much known as others, which means smaller community though.
Comparison
Choose between ReactJS and VueJS for frontend project using Laravel?
Monday, December 14, 2015
There is a common misconception about Vue: that it's only for simple stuff. No. The underlying development model of data-driven views and interface composed of component trees is almost identical between React and Vue. The main difference is how the API is exposed and how React leans toward a more everything-in-JS approach while Vue embraces HTML/CSS/JS as what they are.
When you go beyond the basics, the concepts involved in how to structure and maintain state in large, complex applications are not tied to a specific view-layer. For example, you can use Redux with either React or Vue. Both would work. If you can build complex stuff with React, you can do that with Vue too. I'd even claim that anything that can be built in React can be built in Vue with similar if not less amount of time and effort.
READ MORE
When you go beyond the basics, the concepts involved in how to structure and maintain state in large, complex applications are not tied to a specific view-layer. For example, you can use Redux with either React or Vue. Both would work. If you can build complex stuff with React, you can do that with Vue too. I'd even claim that anything that can be built in React can be built in Vue with similar if not less amount of time and effort.
Writing Vue.js applications after working with AngularJS will feel familiar. Vue won't pack as many goodies out of the box, but it will still give Angular a run for its money.
First and foremost, what is Vue.js and why should you use it?
Vue is a library for developing interactive web interfaces. Its API is inspired by Angular & Backbone, but you can read more about it in this guide.
What's more interesting is why use it, especially when you are familiar with Angular. First of all, it's very flexible. It allows mixing and matching all the libraries you love. That means you can create your own little front-end stack. Secondly, it's more snappy because it's simpler and doesn't use dirty checking to observe changes. On top of that, learning Vue doesn't take much time. This will make it easy to bring in new team members.
You can read even more about it in Vue's FAQ page, where Vue is compared to Angular, React and more.
READ MORE
First and foremost, what is Vue.js and why should you use it?
Vue is a library for developing interactive web interfaces. Its API is inspired by Angular & Backbone, but you can read more about it in this guide.
What's more interesting is why use it, especially when you are familiar with Angular. First of all, it's very flexible. It allows mixing and matching all the libraries you love. That means you can create your own little front-end stack. Secondly, it's more snappy because it's simpler and doesn't use dirty checking to observe changes. On top of that, learning Vue doesn't take much time. This will make it easy to bring in new team members.
You can read even more about it in Vue's FAQ page, where Vue is compared to Angular, React and more.
1. Frontend
- Vue.js 0.12.15
- vue-router
- vue-resource
- vueify
- envify to accomodate builds in different environments
- Laravel Elixir for Gulp magic
- Bootstrap 3.3.5 styling
- Sass custom styles (mostly Laravel Spark styles)
2. Backend
- Laravel 5.1
- SQlite or any other DB backend you prefer. SQLite is the default to make testing this out easier
- Dingo API component for Laravel
- JWT Authentication middleware
- Sample REST api for Dogs (woof woof) - CRUD style
Do you use Laravel PHP and Vue JS? Do you wish there was a better way to structure your applications you build? This tutorial is just for you! In it, we set up simple two-way communication between the different components of your front-end app.
Would you like to get the results of this tutorial without reading through it? Check out Laravue, the brand new boilerplate repo for starting off!
Yesterday, I set up my test environment and started writing tests for a simple table component I’m building with Vue.js. At first, I wrote it to rely on a provided template, so it wouldn’t be too restricting.
The more I worked on it, however, the more I realized how much it could benefit from automation. I replaced all the hard-coded HTML with looping template code. Now, it can create its own headers based on a provided list of header names and types — color, text, and currency.
READ MORE
The more I worked on it, however, the more I realized how much it could benefit from automation. I replaced all the hard-coded HTML with looping template code. Now, it can create its own headers based on a provided list of header names and types — color, text, and currency.
Vue.js, a JavaScript library for building interactive Web interfaces, has reached a 1.0.0 release status.
Focused on the view layer, open source Vue.js leverages reactive data binding and composable view components. It can be integrated with other libraries and existing projects. A core developer on the Meteor JavaScript framework and the key mover of Vue.js, Evan You has big ambitions for it, as outlined in an email: “I want it to be one of the top choices for building Web apps, because there shouldn't and will not be one framework that rules it all.”
READ MORE
Focused on the view layer, open source Vue.js leverages reactive data binding and composable view components. It can be integrated with other libraries and existing projects. A core developer on the Meteor JavaScript framework and the key mover of Vue.js, Evan You has big ambitions for it, as outlined in an email: “I want it to be one of the top choices for building Web apps, because there shouldn't and will not be one framework that rules it all.”
Vue.js 1.0 was released at the end of October and packs some awesome new features. While most of the library looks and feels the same as it always has, there are a few changes that are worth noting. In this article, we’ll explore some of the changes and how you can use them to be more productive and expressive when creating apps with Vue.js.
If you’ve tried Vue.js before, your experience might be that it’s similar to other frameworks, but is a lighter-weight alternative that’s easier to use. This is true in many ways, and Vue is certainly loved for its ability to serve solely as the view layer for applications. Using it as the view layer, you can implement Single Page App features with very little overhead. However, the Vue.js ecosystem goes way beyond the view layer and makes it possible to craft large-scale SPAs easily.
READ MOREIf you’ve tried Vue.js before, your experience might be that it’s similar to other frameworks, but is a lighter-weight alternative that’s easier to use. This is true in many ways, and Vue is certainly loved for its ability to serve solely as the view layer for applications. Using it as the view layer, you can implement Single Page App features with very little overhead. However, the Vue.js ecosystem goes way beyond the view layer and makes it possible to craft large-scale SPAs easily.
Ok so for me right now I’m digging into the excellent Vue.js and looking to use it in a number of projects. But one thing got me out of the box was how can I use Vue globally with creating multiple instances for the different pages of the site. Ok so you might be thinking WTF is he on about. So let me explain a little more.
I am using Browserify and gulp to combine my scripts so I end up with one single file to load reducing the number of requests for the client and thus lies the problem. If I have multiple instances of Vue within the single file Vue would complain not finding the binding element on a page. Also if for example I had a subscription component I would have to require that in the separate instances.
Since switching from providing Desktop and LAN support as well as Business Technology Solutions to SMBs/SMEs to fullstack Javascript web development I’ve encountered many concepts and paradigms crucial to good web development practice.
A central paradigm for developing scalable and maintainable JS web apps is the adoption of some form of architectural pattern for the development of the UI. The most prevalent family of patterns is the MVC/MV* family.
The quality of the UI places a major role in the quality of the UX. In any app built with the MV* pattern, the View is responsible for the UI parts of the app.
For many of us, a common way of implementing the View involves manually manipulating the DOM when data needs to be rendered. While this is all well and good, in this article we will discover the power of using data driven views specifically as implemented in Vue.js. Along the way we will build a simple Todo app which allows todos to be added to a list, marked as complete and also renders various views.
A simple file upload component for Vue.js. Emits events for XHR Upload Progress for nice progress bars.
I came up with the original idea when looking at this repo. I knew I wanted a nice component with upload progress and so I copied some code from that library.
In order to use the demo, you need to have PHP setup and this project running under a server. There is a script in the root called upload.php, which is a simple script to handle single file uploads. Most likely you will have your own way of handling files.
READ MORE
I came up with the original idea when looking at this repo. I knew I wanted a nice component with upload progress and so I copied some code from that library.
In order to use the demo, you need to have PHP setup and this project running under a server. There is a script in the root called upload.php, which is a simple script to handle single file uploads. Most likely you will have your own way of handling files.
Vue.Js has been gaining a lot of attention since a couple of months. Vue.Js is a data-binding javascript framework that is specifically built for SPAs ie, Single Page Application.
The beauty of creating a SPA application is to provide a desktop like an experience in which the page remains the same throughout the application, no refresh, only the views being changed along with the URL. It’s much faster and smoother than conventional applications.
Vue is inspired by AngularJS. There are lots of similarities like Directives, Filters, Modules
READ MORE DEMO
The beauty of creating a SPA application is to provide a desktop like an experience in which the page remains the same throughout the application, no refresh, only the views being changed along with the URL. It’s much faster and smoother than conventional applications.
Vue is inspired by AngularJS. There are lots of similarities like Directives, Filters, Modules
READ MORE DEMO