Vue源碼閱讀、七

響應(yīng)式原理

Vue實(shí)現(xiàn)響應(yīng)式的核心是利用了Object.defindProperty為對(duì)象的屬性添加getter和setter方法洒闸,接下來(lái)我們從源碼層面來(lái)看具體的實(shí)現(xiàn)方式

initState

Vue在初始化的過(guò)程中會(huì)調(diào)用initState方法染坯,他定義在core/instance/state.js:

export function initState (vm: Component) {
  vm._watchers = []
  const opts = vm.$options
  if (opts.props) initProps(vm, opts.props)
  if (opts.methods) initMethods(vm, opts.methods)
  if (opts.data) {
    initData(vm)
  } else {
    observe(vm._data = {}, true /* asRootData */)
  }
  if (opts.computed) initComputed(vm, opts.computed)
  if (opts.watch && opts.watch !== nativeWatch) {
    initWatch(vm, opts.watch)
  }
}

initState方法對(duì)vm.$options中的props, methods,data,computed,watch這些屬性做了初始化操作。

  • initProps:
function initProps (vm: Component, propsOptions: Object) {
  const propsData = vm.$options.propsData || {}
  const props = vm._props = {}
  // cache prop keys so that future props updates can iterate using Array
  // instead of dynamic object key enumeration.
  const keys = vm.$options._propKeys = []
  const isRoot = !vm.$parent
  // root instance props should be converted
  if (!isRoot) {
    toggleObserving(false)
  }
  for (const key in propsOptions) {
    keys.push(key)
    const value = validateProp(key, propsOptions, propsData, vm)
    /* istanbul ignore else */
    if (process.env.NODE_ENV !== 'production') {
      const hyphenatedKey = hyphenate(key)
      if (isReservedAttribute(hyphenatedKey) ||
          config.isReservedAttr(hyphenatedKey)) {
        warn(
          `"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`,
          vm
        )
      }
      defineReactive(props, key, value, () => {
        if (vm.$parent && !isUpdatingChildComponent) {
          warn(
            `Avoid mutating a prop directly since the value will be ` +
            `overwritten whenever the parent component re-renders. ` +
            `Instead, use a data or computed property based on the prop's ` +
            `value. Prop being mutated: "${key}"`,
            vm
          )
        }
      })
    } else {
      defineReactive(props, key, value)
    }
    // static props are already proxied on the component's prototype
    // during Vue.extend(). We only need to proxy props defined at
    // instantiation here.
    if (!(key in vm)) {
      proxy(vm, `_props`, key)
    }
  }
  toggleObserving(true)
}

initProps方法對(duì)props中的每一個(gè)key調(diào)用了defineReactive方法丘逸,然后調(diào)用proxy方法將屬性代理到vm實(shí)例上单鹿。

  • initData
    function initData (vm: Component) {
    let data = vm.options.data data = vm._data = typeof data === 'function' ? getData(data, vm) : data || {} if (!isPlainObject(data)) { data = {} process.env.NODE_ENV !== 'production' && warn( 'data functions should return an object:\n' + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm ) } // proxy data on instance const keys = Object.keys(data) const props = vm.options.props
    const methods = vm.options.methods let i = keys.length while (i--) { const key = keys[i] if (process.env.NODE_ENV !== 'production') { if (methods && hasOwn(methods, key)) { warn( `Method "{key}" has already been defined as a data property., vm ) } } if (props && hasOwn(props, key)) { process.env.NODE_ENV !== 'production' && warn(The data property "${key}" is already declared as a prop. +Use prop default value instead., vm ) } else if (!isReserved(key)) { proxy(vm,_data`, key)
    }
    }
    // observe data
    observe(data, true /* asRootData */)
    }
`initData`方法在開(kāi)發(fā)環(huán)境下檢查data中的屬性是否已經(jīng)在props和methods里重復(fù)定義,然后調(diào)用
`proxy`方法將這些屬性代理到vm實(shí)例上深纲。最后調(diào)用`observe`方法

那么我們重點(diǎn)看一下`observe`方法和`defindReactive`方法做了什么
## `observe`
`observe`方法定義在`core/observer/index.js`中:

export function observe (value: any, asRootData: ?boolean): Observer | void {
if (!isObject(value) || value instanceof VNode) {
return
}
let ob: Observer | void
if (hasOwn(value, 'ob') && value.ob instanceof Observer) {
ob = value.ob
} else if (
shouldObserve &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
!value._isVue
) {
ob = new Observer(value)
}
if (asRootData && ob) {
ob.vmCount++
}
return ob
}

`observe`方法為非VNode的對(duì)象類(lèi)型值添加了一個(gè)`Observer`對(duì)象仲锄,`Observer`的定義:

export class Observer {
value: any;
dep: Dep;
vmCount: number; // number of vms that has this object as root $data

constructor (value: any) {
this.value = value
this.dep = new Dep()
this.vmCount = 0
def(value, 'ob', this)
if (Array.isArray(value)) {
const augment = hasProto
? protoAugment
: copyAugment
augment(value, arrayMethods, arrayKeys)
this.observeArray(value)
} else {
this.walk(value)
}
}

/**

  • Walk through each property and convert them into
  • getter/setters. This method should only be called when
  • value type is Object.
    */
    walk (obj: Object) {
    const keys = Object.keys(obj)
    for (let i = 0; i < keys.length; i++) {
    defineReactive(obj, keys[i])
    }
    }

/**

  • Observe a list of Array items.
    */
    observeArray (items: Array<any>) {
    for (let i = 0, l = items.length; i < l; i++) {
    observe(items[i])
    }
    }
    }
`Observer`的構(gòu)造函數(shù)創(chuàng)建了一個(gè)`Dep`對(duì)象,然后通過(guò)`def(value, '__ob__', this)`將這個(gè)對(duì)象的`__ob__`屬性設(shè)置為自身湃鹊,這會(huì)使`__ob__`屬性的descriptor中的`enumerable`為false儒喊。接下來(lái)調(diào)用`walk`方法對(duì)這個(gè)對(duì)象的每一個(gè)屬性調(diào)用`defineReactive`方法。
## `defineReactive`

export function defineReactive (
obj: Object,
key: string,
val: any,
customSetter?: ?Function,
shallow?: boolean
) {
const dep = new Dep()

const property = Object.getOwnPropertyDescriptor(obj, key)
if (property && property.configurable === false) {
return
}

// cater for pre-defined getter/setters
const getter = property && property.get
const setter = property && property.set
if ((!getter || setter) && arguments.length === 2) {
val = obj[key]
}

let childOb = !shallow && observe(val)
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter () {
const value = getter ? getter.call(obj) : val
if (Dep.target) {
dep.depend()
if (childOb) {
childOb.dep.depend()
if (Array.isArray(value)) {
dependArray(value)
}
}
}
return value
},
set: function reactiveSetter (newVal) {
const value = getter ? getter.call(obj) : val
/* eslint-disable no-self-compare /
if (newVal === value || (newVal !== newVal && value !== value)) {
return
}
/
eslint-enable no-self-compare */
if (process.env.NODE_ENV !== 'production' && customSetter) {
customSetter()
}
if (setter) {
setter.call(obj, newVal)
} else {
val = newVal
}
childOb = !shallow && observe(newVal)
dep.notify()
}
})
}

`defineReactive`的作用是將對(duì)象上的一個(gè)屬性定義為響應(yīng)式屬性币呵,它的邏輯也十分清晰怀愧。首先創(chuàng)建了一個(gè)`Dep`對(duì)象,然后對(duì)這個(gè)屬性的值遞歸地調(diào)用`observe`方法余赢,使這個(gè)屬性的值也成為響應(yīng)式的芯义,最后用`Object.defineProperty`為這個(gè)屬性的descriptor定義了`get`和`set`方法

## getter
我們來(lái)看getter部分的邏輯,它會(huì)調(diào)用`dep.depend()`方法妻柒,那么我們首先來(lái)看`Dep`是什么扛拨。

### Dep
`Dep`的定義是在`core/observer/dep.js`

export default class Dep {
static target: ?Watcher;
id: number;
subs: Array<Watcher>;

constructor () {
this.id = uid++
this.subs = []
}

addSub (sub: Watcher) {
this.subs.push(sub)
}

removeSub (sub: Watcher) {
remove(this.subs, sub)
}

depend () {
if (Dep.target) {
Dep.target.addDep(this)
}
}

notify () {
// stabilize the subscriber list first
const subs = this.subs.slice()
for (let i = 0, l = subs.length; i < l; i++) {
subs[i].update()
}
}
}

`Dep`表示dependence,它是用來(lái)記錄有那些組件依賴(lài)了特定的屬性举塔。每個(gè)響應(yīng)式的屬性都有一個(gè)Dep對(duì)象鬼癣,Dep對(duì)象的`subs`屬性就表示subscript陶贼,訂閱。`subs`數(shù)組中放的是`Watcher`類(lèi)型的值待秃。

### `Watcher`
`Watcher`的定義在`core/observer/watcher.js`拜秧,代碼太長(zhǎng)就不貼了。
`Watcher`的構(gòu)造函數(shù)定義了一些`Dep`的數(shù)組
this.deps = []
this.newDeps = []
this.depIds = new Set()
this.newDepIds = new Set()

// ...
if (this.computed) {
this.value = undefined
this.dep = new Dep()
} else {
this.value = this.get()
}

如果不是計(jì)算屬性章郁,`Watcher`的構(gòu)造函數(shù)最后調(diào)用了`this.get()`方法枉氮。
### 流程
`Watcher`的創(chuàng)建是在Vue掛載的時(shí)候,在`mountComponent`方法中有這么一段邏輯: 
updateComponent = () => {
  vm._update(vm._render(), hydrating)
}

// ...
new Watcher(vm, updateComponent, noop, {
before () {
if (vm._isMounted) {
callHook(vm, 'beforeUpdate')
}
}
}, true /* isRenderWatcher */)
hydrating = false

當(dāng)一個(gè)組件掛載的時(shí)候暖庄,創(chuàng)建`Watch`聊替,執(zhí)行`this.get()`方法,首先調(diào)用

pushTarget(this)

pushTarget 的定義在 src/core/observer/dep.js 中:
···
export function pushTarget (_target: Watcher) {
  if (Dep.target) targetStack.push(Dep.target)
  Dep.target = _target
}
···
就是講當(dāng)前的`Dep.target`入棧培廓,然后將`Dep.target`設(shè)置為當(dāng)前的watcher惹悄。接著執(zhí)行了

value = this.getter.call(vm, vm)

`this.getter`也就是傳入的`updateComponent`方法,對(duì)組件進(jìn)行了一次渲染更新肩钠。在渲染更新的時(shí)候會(huì)訪問(wèn)到vm上的數(shù)據(jù)泣港,也就調(diào)用了響應(yīng)式屬性的getter,getter中會(huì)調(diào)用`dep.depend()`

depend () {
if (Dep.target) {
Dep.target.addDep(this)
}
}

又調(diào)用了`Dep.target.addDep(this)

addDep (dep: Dep) {
const id = dep.id
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id)
this.newDeps.push(dep)
if (!this.depIds.has(id)) {
dep.addSub(this)
}
}
}

`addDep`方法檢查了dep是否重復(fù)价匠,如果沒(méi)有重復(fù)就將這個(gè)dep添加到`this.newDeps`數(shù)組当纱,并且經(jīng)這個(gè)watcher添加到dep的subs數(shù)組中

`updateComponet`的過(guò)程中會(huì)觸發(fā)所有數(shù)據(jù)的getter,也就完成了一個(gè)依賴(lài)收集過(guò)程踩窖,記錄了當(dāng)數(shù)據(jù)發(fā)生變化坡氯,有哪些組件需要更新。

最后洋腮,`Watcher`的`get()`方法執(zhí)行了
  popTarget()
  this.cleanupDeps()
將Dep.Target恢復(fù)成父級(jí)組件的Watcher箫柳,并清空已經(jīng)不再依賴(lài)的數(shù)據(jù)的Dep

## setter
設(shè)置響應(yīng)式屬性的值的時(shí)候,它的setter會(huì)被調(diào)用啥供。
setter的邏輯有這么幾點(diǎn):
1. 如果舊的值和新的值相等或都是NaN滞时,則返回
2. 調(diào)用
  childOb = !shallow && observe(newVal)
遞歸地將為新值添加getter/setter
3. 調(diào)用
  dep.notify()

notify () {
// stabilize the subscriber list first
const subs = this.subs.slice()
for (let i = 0, l = subs.length; i < l; i++) {
subs[i].update()
}
}

調(diào)用每個(gè)訂閱此屬性的Watcher的`update`方法

class Watcher {
// ...
update () {
/* istanbul ignore else */
if (this.computed) {
// A computed property watcher has two modes: lazy and activated.
// It initializes as lazy by default, and only becomes activated when
// it is depended on by at least one subscriber, which is typically
// another computed property or a component's render function.
if (this.dep.subs.length === 0) {
// In lazy mode, we don't want to perform computations until necessary,
// so we simply mark the watcher as dirty. The actual computation is
// performed just-in-time in this.evaluate() when the computed property
// is accessed.
this.dirty = true
} else {
// In activated mode, we want to proactively perform the computation
// but only notify our subscribers when the value has indeed changed.
this.getAndInvoke(() => {
this.dep.notify()
})
}
} else if (this.sync) {
this.run()
} else {
queueWatcher(this)
}
}
}

如果不是計(jì)算屬性獲知this.sync為false,就會(huì)調(diào)用`queWatcher(this)`

export function queueWatcher (watcher: Watcher) {
const id = watcher.id
if (has[id] == null) {
has[id] = true
if (!flushing) {
queue.push(watcher)
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
let i = queue.length - 1
while (i > index && queue[i].id > watcher.id) {
i--
}
queue.splice(i + 1, 0, watcher)
}
// queue the flush
if (!waiting) {
waiting = true
nextTick(flushSchedulerQueue)
}
}
}

`queueWatcher`將watcher加入到一個(gè)隊(duì)列滤灯,在nextTick調(diào)用`flushSchedulerQueue`

function flushSchedulerQueue () {
flushing = true
let watcher, id

// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort((a, b) => a.id - b.id)

// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index = 0; index < queue.length; index++) {
watcher = queue[index]
if (watcher.before) {
watcher.before()
}
id = watcher.id
has[id] = null
watcher.run()
// in dev build, check and stop circular updates.
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1
if (circular[id] > MAX_UPDATE_COUNT) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? in watcher with expression "${watcher.expression}"
: in a component render function.
),
watcher.vm
)
break
}
}
}

// keep copies of post queues before resetting state
const activatedQueue = activatedChildren.slice()
const updatedQueue = queue.slice()

resetSchedulerState()

// call component updated and activated hooks
callActivatedHooks(activatedQueue)
callUpdatedHooks(updatedQueue)

// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush')
}
}

`flushSchedulerQueue`首先按照id從小到大對(duì)隊(duì)列中的watcher進(jìn)行排序坪稽,這么做是為了要確保以下幾點(diǎn):
1.組件的更新由父到子;因?yàn)楦附M件的創(chuàng)建過(guò)程是先于子的鳞骤,所以 watcher 的創(chuàng)建也是先父后子窒百,執(zhí)行順序也應(yīng)該保持先父后子。
2.用戶(hù)的自定義 watcher 要優(yōu)先于渲染 watcher 執(zhí)行豫尽;因?yàn)橛脩?hù)自定義 watcher 是在渲染 watcher 之前創(chuàng)建的篙梢。
3.如果一個(gè)組件在父組件的 watcher 執(zhí)行期間被銷(xiāo)毀,那么它對(duì)應(yīng)的 watcher 執(zhí)行都可以被跳過(guò)美旧,所以父組件的 watcher 應(yīng)該先執(zhí)行渤滞。
然后調(diào)用每個(gè)watcher的`run`方法贬墩。

run () {
if (this.active) {
this.getAndInvoke(this.cb)
}
}

getAndInvoke (cb: Function) {
const value = this.get()
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
const oldValue = this.value
this.value = value
this.dirty = false
if (this.user) {
try {
cb.call(this.vm, value, oldValue)
} catch (e) {
handleError(e, this.vm, callback for watcher "${this.expression}")
}
} else {
cb.call(this.vm, value, oldValue)
}
}
}

`run`方法實(shí)際上就是調(diào)用了`getAndInvoke`方法。而`getAndInvoke`有調(diào)用了`this.get()`方法妄呕,`this.get()`方法中會(huì)調(diào)用`this.getter`陶舞,也就是`vm._update(vm._render(), hydrating)`去重新渲染更新組件。

## 總結(jié)
Vue的響應(yīng)式原理實(shí)際上就是利用了`Object.defineProperty`為對(duì)象的屬性定義了getter/setter绪励,用`Dep`和`Watcher`配合完成了依賴(lài)收集和派發(fā)更新的過(guò)程肿孵。每一個(gè)響應(yīng)式的屬性對(duì)應(yīng)一個(gè)Dep,而每一個(gè)組件對(duì)應(yīng)一個(gè)Watcher疏魏。當(dāng)屬性更新是就通知依賴(lài)這個(gè)屬性的組件去更新停做。
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市大莫,隨后出現(xiàn)的幾起案子蛉腌,更是在濱河造成了極大的恐慌,老刑警劉巖只厘,帶你破解...
    沈念sama閱讀 218,755評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件烙丛,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡懈凹,警方通過(guò)查閱死者的電腦和手機(jī)蜀变,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén)悄谐,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)介评,“玉大人,你說(shuō)我怎么就攤上這事爬舰∶锹剑” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,138評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵情屹,是天一觀的道長(zhǎng)坪仇。 經(jīng)常有香客問(wèn)我,道長(zhǎng)垃你,這世上最難降的妖魔是什么椅文? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,791評(píng)論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮惜颇,結(jié)果婚禮上皆刺,老公的妹妹穿的比我還像新娘。我一直安慰自己凌摄,他們只是感情好羡蛾,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,794評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著锨亏,像睡著了一般痴怨。 火紅的嫁衣襯著肌膚如雪忙干。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 51,631評(píng)論 1 305
  • 那天浪藻,我揣著相機(jī)與錄音捐迫,去河邊找鬼。 笑死珠移,一個(gè)胖子當(dāng)著我的面吹牛弓乙,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播钧惧,決...
    沈念sama閱讀 40,362評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼暇韧,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了浓瞪?” 一聲冷哼從身側(cè)響起懈玻,我...
    開(kāi)封第一講書(shū)人閱讀 39,264評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎乾颁,沒(méi)想到半個(gè)月后涂乌,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,724評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡英岭,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評(píng)論 3 336
  • 正文 我和宋清朗相戀三年湾盒,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片诅妹。...
    茶點(diǎn)故事閱讀 40,040評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡罚勾,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出吭狡,到底是詐尸還是另有隱情尖殃,我是刑警寧澤,帶...
    沈念sama閱讀 35,742評(píng)論 5 346
  • 正文 年R本政府宣布划煮,位于F島的核電站送丰,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏弛秋。R本人自食惡果不足惜器躏,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,364評(píng)論 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望蟹略。 院中可真熱鬧登失,春花似錦、人聲如沸科乎。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,944評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至捏萍,卻和暖如春太抓,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背令杈。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,060評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工走敌, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人逗噩。 一個(gè)月前我還...
    沈念sama閱讀 48,247評(píng)論 3 371
  • 正文 我出身青樓掉丽,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親异雁。 傳聞我的和親對(duì)象是個(gè)殘疾皇子捶障,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,979評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • 「聲動(dòng)派」,專(zhuān)注互聯(lián)網(wǎng)價(jià)值傳播纲刀,為你分享大連接時(shí)代的一切项炼! 本文大約11000字閱讀需要12分鐘 第一部分 寫(xiě)在前...
    聲動(dòng)派閱讀 585評(píng)論 0 1
  • 本文是lhyt本人原創(chuàng),希望用通俗易懂的方法來(lái)理解一些細(xì)節(jié)和難點(diǎn)示绊。轉(zhuǎn)載時(shí)請(qǐng)注明出處锭部。文章最早出現(xiàn)于本人github...
    lhyt閱讀 2,215評(píng)論 0 4
  • 這方面的文章很多,但是我感覺(jué)很多寫(xiě)的比較抽象面褐,本文會(huì)通過(guò)舉例更詳細(xì)的解釋拌禾。(此文面向的Vue新手們,如果你是個(gè)大牛...
    Ivy_2016閱讀 15,393評(píng)論 8 64
  • vue理解淺談 一 理解vue的核心理念 使用vue會(huì)讓人感到身心愉悅,它同時(shí)具備angular和react的優(yōu)點(diǎn)...
    ambeer閱讀 24,133評(píng)論 2 18
  • 用自己喜歡的方式去愛(ài)展哭。 沒(méi)有你不想要的湃窍,只有你不喜歡的。 我熱戀了摄杂。 是的坝咐,我的那個(gè)二逼文藝女青年楊桃挺直了腰板對(duì)...
    白紗漁閱讀 346評(píng)論 0 0