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

vue-onsenuiを教材に Vue2 migrationを 試してみる // migrate vue-onsenui to vue2

tadyjp
October 28, 2016

vue-onsenuiを教材に Vue2 migrationを 試してみる // migrate vue-onsenui to vue2

2016-10-28
Vue.js Tokyo v-meetup="#2" 祝 2.0 リリース記念 LT
http://vuejs-meetup.connpass.com/event/41955/

tadyjp

October 28, 2016
Tweet

More Decks by tadyjp

Other Decks in Technology

Transcript

  1. [1] ready lifecycle hook has been deprecated [Error] Replace ready

    with mounted, then use Vue.nextTick if you need an in-document guarantee. [༁] ready Λ mountedʹஔ͖׵͑ ͯɻཁૉ͕ଘࡏ͢ΔͷΛ଴ͭඞ ཁ͕͋Ε͹ Vue.nextTick Λ ࢖ͬͯɻ
  2. [2] Built-in filters have been deprecated. [Error] Replace the built-in

    capitalize filter with a custom filter, method, or computed property using npmjs.com/package/ lodash.capitalize. [༁] ϏϧτΠϯͷϑΟϧλʔ͕ͳ ͘ͳ͔ͬͨΒಠࣗͰ࡞Δ͔ɺ computed propertyͱଞͷϥ ΠϒϥϦΛ࢖ͬͯɻ
  3. [3] Rename $index to index and explicity declare it. [Error]

    $index has been deprecated to avoid implicitly defined (i.e. "magic") variables [༁] ҉໧తͳม਺ͷఆٛΛආ͚ ΔͨΊʹ $index ͸ඇਪ঑ʹ ͳͬͨΑɻ v-for="(item, index) in items” Λ࢖ͬͯͶɻ
  4. [4] Update v-el:navigator to ref=“navigator". [Error] v-el and v-ref merged

    into ref attribute. Update this.$els to this. $refs. [༁] v-el ͱ v-ref ͸ refʹ౷߹͞ ΕͨΑɻ
 this.$els ͸ this.$refs ʹม ߋͯ͠Ͷɻ
  5. [5] Update name="tab-bar-{{ key }}" to v- bind:name="'tab-bar-' + key”.

    [Error] Interpolation within attributes has been deprecated. [༁] ଐੑͷதͷม਺ల։ ͸ඇਪ঑ʹͳͬͨΑɻ
  6. [6] Replace this.$dispatch('push', options) to use a global event bus

    or vuex. [Error] $dispatch and $broadcast have been deprecated because the pattern doesn't scale well. [༁] $dispatch ͱ $broadcast ͸εέʔϧ͠ͳ͍͔Βඇਪ ঑ʹͳͬͨΑɻ
 άϩʔόϧͳΠϕϯτΛ࢖ ͏͔VuexΛ࢖ͬͯͶɻ ▼ src/components/OnsNavigator.vue ▼ src/index.js
  7. [7] Switch argument order in v-for="(key, value) in collection" to

    (value, key). [Error] Argument order for v- for has been updated to match JavaScript conventions. [༁] v-forͷҾ਺ͷॱ൪Λ JavaScriptʹϚον͢Δ Α͏ʹ௚ͨ͠Αɻ
  8. ٙ໰ ˍ ͓ΘΓ • Component͔ΒMutationݺΜͰ΋ྑ͍ʁ • Vuex࢖͍ͭͭ
 <input v-model=“someValue” />͍ͨ͠

    • ࢠComponent͕શͯreadyʹͳͬͨλΠϛϯάΛ஌Γ͍ͨ • ͜ͷεϥΠυͷdiff
 → https://github.com/tadyjp/OnsenUI/pull/1