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
ガチな登山用デバイスからこんにちは
halka
1
230
allow_retry と Arel.sql / allow_retry and Arel.sql
euglena1215
1
160
Snowflakeの生成AI機能を活用したデータ分析アプリの作成 〜Cortex AnalystとCortex Searchの活用とStreamlitアプリでの利用〜
nayuts
1
410
ChatGPTとPlantUML/Mermaidによるソフトウェア設計
gowhich501
1
120
AI エージェントとはそもそも何か? - 技術背景から Amazon Bedrock AgentCore での実装まで- / AI Agent Unicorn Day 2025
hariby
4
1.2k
Nstockの一人目エンジニアが 3年間かけて向き合ってきた セキュリティのこととこれから〜あれから半年〜
yo41sawada
0
210
[ JAWS-UG 東京 CommunityBuilders Night #2 ]SlackとAmazon Q Developerで 運用効率化を模索する
sh_fk2
2
270
AI開発ツールCreateがAnythingになったよ
tendasato
0
110
20250910_障害注入から効率的復旧へ_カオスエンジニアリング_生成AIで考えるAWS障害対応.pdf
sh_fk2
2
150
スマートファクトリーの第一歩 〜AWSマネージドサービスで 実現する予知保全と生成AI活用まで
ganota
1
160
Codeful Serverless / 一人運用でもやり抜く力
_kensh
6
340
ZOZOマッチのアーキテクチャと技術構成
zozotech
PRO
3
1.3k
Featured
See All Featured
Building Applications with DynamoDB
mza
96
6.6k
Practical Orchestrator
shlominoach
190
11k
Building Adaptive Systems
keathley
43
2.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Facilitating Awesome Meetings
lara
55
6.5k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Balancing Empowerment & Direction
lara
3
610
Documentation Writing (for coders)
carmenintech
74
5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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