Upgrade to Pro — share decks privately, control downloads, hide ads and more …

VueJS 101: Què és Vue?

VueJS 101: Què és Vue?

Breu introducció a VueJS.

Avatar for Adrià Fontcuberta

Adrià Fontcuberta

August 01, 2017
Tweet

More Decks by Adrià Fontcuberta

Other Decks in Programming

Transcript

  1. Què és Vue.js? Framework Javascript per construir UIs Versió actual:

    2.4 Publicat el 2014 (open source) Enfocat a desenvolupament per components https://vuejs.org/v2/guide/index.html https://vuejs.org/v2/guide/components.html
  2. “I figured, what if I could just extract the part

    that I really liked about Angular and build something really lightweight without all the extra concepts involved?” - Evan You
  3. 60412 ★ 109★ diàries 71262 ★ 74★ diàries 56484 ★

    11★ diàries 25953 ★ 30★ diàries
  4. Per què Vue.js? Progressiu: corba d’aprenentatge lleugera Templates: sintaxi més

    senzilla(?) Built-in transitions Top-down reactive data: com React. Canvi de paradigma. Data driven view. https://vuejs.org/v2/guide/reactivity.html
  5. <App /> <Home /> <Button /> <Email-Input /> <Form />

    <Item /> <Item-list /> <Media /> <Hero-image /> <Image /> <Icon /> Component-based UI
  6. FilterableProductTable (taronja) contains the entirety of the example SearchBar (blau)

    receives all user input ProductTable (verd) displays and filters the data collection based on user input ProductCategoryRow (turquesa) displays a heading for each category ProductRow (vermell) displays a row for each product Un sol component? https://pusher.com/sessions/meetup/bristol-js/thinking-in-react https://facebook.github.io/react/docs/thinking-in-react.html
  7. Declaratiu, no imperatiu! https://tylermcginnis.com/imperative-vs-declarative-programming/ https://medium.com/@ian.mundy/declarative-vs-imperative-programming-a8a7c93d9ad2 "This is what it should

    do” "This is how you should do it" Fes una pizza per sopar Vés a la cuina Obre la nevera Treu la base del congelador Treu el formatge de la nevera … Serveix el plat a taula
  8. const double = arr => { let results = [

    ] for (let i = 0; i < arr.length; i++) { results.push(arr[i] * 2) } return results } const double = arr => arr.map(item => item * 2) Declaratiu Imperatiu "This is what it should do” "This is how you should do it"
  9. const vm = new Vue({ el: '#demo', data: { firstName:

    'Foo', lastName: 'Bar', fullName: 'Foo Bar' }, watch: { firstName: function (val) { this.fullName = val + ' ' + this.lastName }, lastName: function (val) { this.fullName = this.firstName + ' ' + val } } }) Declaratiu Imperatiu "This is what it should do” "This is how you should do it" const vm = new Vue({ el: '#demo', data: { firstName: 'Foo', lastName: 'Bar' }, computed: { fullName: function () { return this.firstName + ' ' + this.lastName } } })
  10. 1. Framework JS lleuger per desenvolupar UIs 2. Desenvolupament per

    components 3. Cal entendre ecosistema Javascript 2017(?) 4. Reactiu. Data-driven. 5. Progressiu: router, vuex, axios, vue-test-utils... 6. Single File Components 7. Ens agrada Recap: Vue.js