日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
[譯]Vue2.0的變化(一)之基本API變化

高層級(jí)的變化

  • 模板解析器不再依賴于DOM(除非你使用真正的DOM作為模板),因此只要你使用字符串模板,你將不再受到任何1.0版本中的解析限制。但是,如果你依賴在存在的內(nèi)容中掛載一個(gè)元素作為模板(使用el元素),你將依然受到這些限制。
  • 編譯器(將字符串模板轉(zhuǎn)換為渲染方法的部分)和運(yùn)行時(shí)間現(xiàn)在能夠被分開(kāi)。這里有兩種不同的構(gòu)建:
    • 獨(dú)立構(gòu)建:包括編譯并且運(yùn)行。這種方式和vue 1.0幾乎完全一樣。
    • 運(yùn)行時(shí)編譯:由于它不包括編譯器,在編譯步驟時(shí)要么預(yù)編譯模板,要么手動(dòng)編寫渲染功能。npm包默認(rèn)導(dǎo)出這個(gè)版本,那么你需要有一個(gè)編譯的過(guò)程(使用Browserify或Webpack ),從中vueify或vue-loader將可以進(jìn)行模板預(yù)編譯。

全局配置

  • Vue.config.silent
  • Vue.config.optionMergeStrategies
  • Vue.config.devtools
  • Vue.config.errorHandler(新API,全局的掛鉤用于在組件渲染和監(jiān)控的時(shí)候處理未捕獲的錯(cuò)誤)
  • Vue.config.keyCodes(新API,為v-on配置自定義的key的別名)

  • Vue.config.debug
    (已丟棄)

  • Vue.config.async
    (已丟棄)

  • Vue.config.delimiters
    (已丟棄)

  • Vue.config.unsafeDelimiters
    (已丟棄,使用v-html)

全局API

  • Vue.extend
  • Vue.nextTick
  • Vue.set
  • Vue.delete
  • Vue.directive
  • Vue.component
  • Vue.use
  • Vue.mixin
  • Vue.compile(新API,只能用于獨(dú)立版本構(gòu)建)
  • Vue.transition

  • stagger
    (已丟棄,在el上設(shè)置
  • Vue.filter

  • Vue.elementDirective
    (已丟棄,使用組件)

  • Vue.partial
    (已丟棄,使用功能組件)

選項(xiàng)

data

  • data
  • props

。prop

。default

。

coerce
(已丟棄,如果你需要轉(zhuǎn)換prop,請(qǐng)使用compute屬性)

。

prop binding modes
(已丟棄,v-model在組件上可以工作

  • propsData(新API)只能用于實(shí)例
  • computed
  • methods
  • watch

DOM

  • el
  • template
  • render(新API)

  • replace
    (已丟棄,組件現(xiàn)在必須有一個(gè)根元素)

生命周期鉤子


  • init
    (已丟棄,請(qǐng)使用beforeCreate)
  • created
  • beforeDestroy
  • destroyed
  • beforeMount(新API)
  • mounted(新API)
  • beforeUpdate(新API)
  • updated(新API)
  • activated(新API,用于keep-alive)
  • deactivated(新API用于keep-alive)

  • ready
    (已丟棄,使用mounted)

  • activate
    (已丟棄,遷移到vue-router)

  • beforeCompile
    (已丟棄,使用created)

  • compiled
    (已丟棄,使用mounted)

  • attached
    (已丟棄)

  • detached
    (已丟棄,同上)

Assets

  • directives
  • components
  • transitions
  • filters

  • partials
    (已丟棄)

  • elementDirectives
    (已丟棄)

雜項(xiàng)

  • parent
  • mixins
  • name
  • extends
  • delimiters(新API,替代原版的全局配置選項(xiàng),只在獨(dú)立構(gòu)建中可用)
  • functional(新API)

  • events
    (已丟棄)

實(shí)例方法

data

  • vm.$watch

  • vm.$get
    (已丟棄,直接檢索值)

  • vm.$set
    (已丟棄,使用Vue.set)

  • vm.$delete
    (已丟棄,使用Vue.delete)

  • vm.$eval
    (已丟棄,沒(méi)有真正的使用)

  • vm.$interpolate
    (已丟棄,同上)

  • vm.$log
    (已丟棄,使用devtools)

events

  • vm.$on
  • vm.$once
  • vm.$off
  • vm.$emit

  • vm.$dispatch
    (已丟棄,使用全局的事件或使用vuex,見(jiàn)下面)

  • vm.$broadcast
    (已丟棄,同上)

DOM

  • vm.$nextTick

  • vm.$appendTo
    (已丟棄,在 vm.$el上使用本地API)

  • vm.$before
    (已丟棄)

  • vm.$after
    (已丟棄)

  • vm.$remove
    (已丟棄)

生命周期

  • vm.$mount
  • vm.$destroy

指令

  • v-text
  • v-html(注意{{{ }}} 被丟棄)
  • v-if
  • v-show
  • v-else
  • v-for

。key (替代 track-by)

。object v-for

。range v-for

。參數(shù)順序更新:數(shù)組中使用(value, index) in arr,對(duì)象中使用(value, key, index) in obj

。$index和$key被丟棄

  • v-on

。modifiers

。on child component

。自定義鍵碼,目前版本Vue.config.keyCodes代替原來(lái)的Vue.directive('on').keyCodes

  • v-bind

。作為prop

。xlink

。綁定對(duì)象

  • v-bind:style
    • prefix sniffing
  • v-bind:class
  • v-model
    • lazy (as modifier)
    • number (as modifier)
    • ignoring composition events

    • debounce
      (已丟棄,使用v-on:input)
  • v-cloak
  • v-pre
  • v-once(新API)

  • v-ref
    (已丟棄,現(xiàn)在只是一個(gè)特殊的屬性ref)
  • v-el(和ref合并)

特殊組件

    • :is
    • async組件
    • inline-template

  • partial
    (已丟棄)

特殊屬性

  • key
  • ref
  • slot

服務(wù)器端渲染

  • renderToString
  • renderToStream
  • client-side hydration

文章名稱:[譯]Vue2.0的變化(一)之基本API變化
URL分享:http://www.5511xx.com/article/djjhoop.html