自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

[譯]Vue 2.0的變化(一)之基本API變化

開發(fā) 前端
模板解析器不再依賴于DOM(除非你使用真正的DOM作為模板),因此只要你使用字符串模板,你將不再受到任何1.0版本中的解析限制。但是,如果你依賴在存在的內(nèi)容中掛載一個元素作為模板(使用el元素),你將依然受到這些限制。

高層級的變化

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

全局配置

  • Vue.config.silent
  • Vue.config.optionMergeStrategies
  • Vue.config.devtools
  • Vue.config.errorHandler(新API,全局的掛鉤用于在組件渲染和監(jiān)控的時候處理未捕獲的錯誤)
  • 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,請使用compute屬性)

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

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

DOM

  • el
  • template
  • render(新API)
  • replace(已丟棄,組件現(xiàn)在必須有一個根元素)

生命周期鉤子

  • init(已丟棄,請使用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(已丟棄,沒有真正的使用)
  • vm.$interpolate(已丟棄,同上)
  • vm.$log(已丟棄,使用devtools)

events

  • vm.$on
  • vm.$once
  • vm.$off
  • vm.$emit
  • vm.$dispatch(已丟棄,使用全局的事件或使用vuex,見下面)
  • 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,對象中使用(value, key, index) in obj

。$index和$key被丟棄

  • v-on

。modifiers

。on child component

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

  • v-bind

。作為prop

。xlink

。綁定對象

  • 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)在只是一個特殊的屬性ref)
  • v-el(和ref合并)

特殊組件

  • <component>
    • :is
    • async組件
    • inline-template
  • <transition>
  • <transition-group>
  • <keep-alive>
  • <slot>
  • partial(已丟棄)

特殊屬性

  • key
  • ref
  • slot

服務(wù)器端渲染

  • renderToString
  • renderToStream
  • client-side hydration
責(zé)任編輯:龐桂玉 來源: segmentfault
相關(guān)推薦

2014-07-17 10:11:53

Android LAPI谷歌

2019-02-18 15:29:08

TensorFlow開源機(jī)器學(xué)習(xí)

2021-09-03 08:23:21

Vue 插槽子組件

2009-06-19 13:12:05

Spring2.0Spring2.0.7

2021-05-14 07:35:06

Vue Router 特性變化

2023-06-02 07:32:34

localStorage?監(jiān)聽

2009-12-28 00:00:00

2014-07-17 08:52:11

Android LAPI

2021-11-17 08:24:47

Vue3 插件Vue應(yīng)用

2013-07-25 14:47:46

網(wǎng)站分析網(wǎng)站流量分析訪問量變化

2009-12-27 23:32:22

2009-12-28 00:12:03

2009-12-27 19:06:18

2015-01-06 09:11:54

TCP

2020-03-13 09:06:45

人工智能AI機(jī)器學(xué)習(xí)

2023-05-26 11:32:05

GPT人工智能

2022-10-25 08:52:09

KubuntuUbuntuLinux

2022-10-29 19:53:28

Xubuntu??Ubuntu

2022-10-24 11:26:01

UbuntuLinux

2009-06-08 13:02:34

Java變化Java趨勢
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號