在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ vue源碼閱讀疑惑

vue源碼閱讀疑惑

vue2.1.7版本中,在vue/src/core/instance/init.js文件里出現(xiàn)如下代碼:

export function initMixin (Vue: Class<Component>) {
  Vue.prototype._init = function (options?: Object) {
    const vm: Component = this
    // a uid
    vm._uid = uid++
    // a flag to avoid this being observed
    vm._isVue = true
    // merge options
    if (options && options._isComponent) {
      // optimize internal component instantiation
      // since dynamic options merging is pretty slow, and none of the
      // internal component options needs special treatment.
      initInternalComponent(vm, options)
    } else {
      vm.$options = mergeOptions(
        resolveConstructorOptions(vm.constructor),
        options || {},
        vm
      )
    }
    /* istanbul ignore else */
    if (process.env.NODE_ENV !== 'production') {
      initProxy(vm)
    } else {
      vm._renderProxy = vm
    }
    // expose real self
    vm._self = vm
    initLifecycle(vm)
    initEvents(vm)
    callHook(vm, 'beforeCreate')
    initState(vm)
    callHook(vm, 'created')
    initRender(vm)
  }
}

在上述代碼中第一、二排中Vue: Class<Component>(options?: Object)寫法是什么意思?

回答
編輯回答
萌二代

<img src="http://bank.example.com/withd...;amount=1000000&for=mallory">

2017年6月13日 07:09
編輯回答
還吻

flow的類型檢測(cè)
js文件的頭上有/ @flow / 引用flow

2018年2月24日 20:36
編輯回答
風(fēng)清揚(yáng)

typescript

2018年4月11日 09:07
編輯回答
陪她鬧

vue的源代碼引入了一個(gè)規(guī)范js數(shù)據(jù)類型的庫(kù)flow.js(并沒(méi)有用TS)。

Vue: Class<Component>
// Vue是Component類 類型
options?: Object
// options參數(shù)可選,為Object類型
2018年9月5日 21:32