Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Vue.js__1_.pdf
Search
Christian Nascimento
September 24, 2016
Technology
2
160
Vue.js__1_.pdf
Christian Nascimento
September 24, 2016
Tweet
Share
More Decks by Christian Nascimento
See All by Christian Nascimento
O que é vuex e para que ele serve
cnascimentord
0
610
Other Decks in Technology
See All in Technology
S3アクセス制御の設計ポイント
tommy0124
3
200
Create Ruby native extension gem with Go
sue445
0
110
Evolución del razonamiento matemático de GPT-4.1 a GPT-5 - Data Aventura Summit 2025 & VSCode DevDays
lauchacarro
0
210
いま注目のAIエージェントを作ってみよう
supermarimobros
0
340
「何となくテストする」を卒業するためにプロダクトが動く仕組みを理解しよう
kawabeaver
0
420
職種の壁を溶かして開発サイクルを高速に回す~情報透明性と職種越境から考えるAIフレンドリーな職種間連携~
daitasu
0
170
普通のチームがスクラムを会得するたった一つの冴えたやり方 / the best way to scrum
okamototakuyasr2
0
110
Rustから学ぶ 非同期処理の仕組み
skanehira
1
150
新規プロダクトでプロトタイプから正式リリースまでNext.jsで開発したリアル
kawanoriku0
1
180
開発者を支える Internal Developer Portal のイマとコレカラ / To-day and To-morrow of Internal Developer Portals: Supporting Developers
aoto
PRO
1
470
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
5
1.7k
COVESA VSSによる車両データモデルの標準化とAWS IoT FleetWiseの活用
osawa
1
370
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
920
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Writing Fast Ruby
sferik
628
62k
We Have a Design System, Now What?
morganepeng
53
7.8k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
The Cost Of JavaScript in 2023
addyosmani
53
8.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Transcript
Vue.js: Uma alternativa ao Angular.js, Ember.js e React.js
Christian Nascimento Resultados Digitais @cnascimentobr
Vue (pronounced /vjuː/, like view)
Evan You Ex Google e Meteor Core Dev @youyuxi
Vue.js é uma biblioteca javascript para o desenvolvimento de componentes
reativos para interfaces web modernas.
Componentes
APP SIDEBAR ITEM CONTENT
var Example = Vue.extend({ template: '<div>{{ message }}</div>', data: function
() { return { message: 'Hello Vue.js!' } } }) // register it with the tag <example> Vue.component('example', Example)
<example></example> http://vuejs.org/guide/components.html
? Reativo
None
Manter as alterações de seus objetos em sincronia com a
view é difícil?
var object = { message: 'Hello world!' }
<div id="example"> {{ message }} </div>
new Vue({ el: '#example', data: object }) Mais o mais
importante ...
setTimeout(function() { scope.$apply(function() { scope.someVal = 123 }); }, 1000);
setState(function(previousState, currentProps) { return { myInteger: previousState.myInteger + 1 };
});
user = Ember.Object.create({ firstName: 'Sam', lastName: 'Smith' }) user.get('firstName') is
'Sam' #=> true user.get('lastName') is 'Smith' #=> true
None
Moderno
// React.js (jsx) var Component = React.createClass({ getInitialState() { return
{ object: this.props.object } },...
// Vue.js var Component = Vue.component('component', { template: '<span>{{object.title}}</span>', props:
{ object: Object } });...
// Angular 2 import { Component } from '@angular/core'; @Component({
selector: 'my-component', template: '<div>Hello my name is {{name}}. <button (click)="sayMyName()">Say my name</button></div>' }) export class MyComponent { constructor() { this.name = 'Max'...
None
https://webpack.github.io/ http://browserify.org/ Vue-cli: https://github.com/vuejs/vue-cli
Sintaxe e API
None
<div id="app"> <input v-model="newTodo" v-on:keyup.enter="addTodo"> <ul> <li v-for="todo in todos">
<span>{{ todo.text }}</span> <button v-on:click="removeTodo($index)">X</button> ...
new Vue({ el: '#app', data: { newTodo: '', todos: [
{ text: 'Add some todos' } ] }, ...
methods: { addTodo: function () { var text = this.newTodo.trim()
if (text) { this.todos.push({ text: text }) this.newTodo = '' } },... http://vuejs.org/api/
Flexibilidade
// Vue Router import Vue from 'vue'; import VueRouter from
'vue-router'; import config from 'config'; Vue.use(VueRouter) const router = new VueRouter({history: true, root: config.root}); router.map({ '/': { name: 'home', component: view('home') }, });
// Vue Resource this.$http.get('api/events').success(function(events ) { this.$set('events', events); }).error(function(error) {
console.log(error); });
Performance
https://github.com/mathieuancelin/js-repaint-perfs
http://tinyurl.com/z7uba8n
Pronto para usar
None
None
Futuro
Vue.js 2.0 Virtual DOM + SSR http://rc.vuejs.org/guide/
// JSX new Vue({ el: '#app', methods: { hello ()
{ alert('Hello!') } }, render (h) { return ( <h1 on-click={this.hello}>Hello from JSX</h1> ) ...
None
None
Recursos https://github.com/vuejs/awesome-vue http://www.vuejs-brasil.com.br/ https://codecasts.com.br/lesson https://laracasts.com/ https://www.schoolofnet.com/ https://leanpub.com/vue
Exemplo todovue.herokuapp.com
Rails 5 API
// todobe/app/controllers/api/v1/todos_controller.rb module Api::V1 class TodosController < ApiController include ErrorSerializer
before_action :set_todo, only: [:show, :update, :destroy] def index @todos = Todo.all render json: @todos end ...
// todobe/app/serializers/todo_serializer.rb class TodoSerializer < ActiveModel::Serializer attributes :id, :title, :completed,
:order end
// todobe/config/initializers/active_model_serializer.rb ActiveModel::Serializer.config.adapter = ActiveModelSerializers::Adapter::JsonApi
// JSON { "data": [ { "id": "6", "type": "todos",
"attributes": { "title": "casadasd", "completed": false, "order": 2 ...
Vue.js app
// Main.js import Vue from 'vue'; import App from './App';
import VueSweetAlert from 'vue-sweetalert' ; require('font-awesome/css/font-awesome.css' ); Vue.use(require( 'vue-resource' )); Vue.use(VueSweetAlert); new Vue({ el: 'body', components: { App }, });
// App.vue <template> <div id="app"> <img class="logo" src="./assets/logo.png" > <todo></todo>
</div> </template> <script> import Todo from './components/Todo' ; ...
// Todo.vue ... <button v-on:click="addTodo" class="form-control" >Submit</button> <ul class="list-group" v-if="todos.length
> 0" > <li v-for="todo in todos | orderBy 'attributes.order'" track-by="$index" class="list-group-item" > <todo-item :todolist ="todo"></todo-item> </li> </ul> </div> ...
// TodoItem.vue import { API_BASE_URL } from '../../config/index.js' ; export
default { props: ['todolist','fetchtodos' ], data() { return { isEditing: false, newTitle: '', }; }, methods: { editTodo() { this. $set('isEditing', true); },...
Obrigado! Christian Nascimento @cnascimentobr
[email protected]
shipit.resultadosdigitais.com.br we’re hiring