import Vue from './instance/index'
import {
initGlobalAPI
} from './global-api/index'
import {
isServerRendering
} from 'core/util/env'
import {
FunctionalRenderContext
} from 'core/vdom/create-functional-component'
initGlobalAPI(Vue)
Object.defineProperty(Vue.prototype, '$isServer', {
get: isServerRendering
})
Object.defineProperty(Vue.prototype, '$ssrContext', {
get () {
return this.$vnode && this.$vnode.ssrContext
}
})
Object.defineProperty(Vue, 'FunctionalRenderContext', {
value: FunctionalRenderContext
})
Vue.version = '__VERSION__'
export default Vue
复制代码
import {
initMixin
} from './init'
import {
stateMixin
} from './state'
import {
renderMixin
} from './render'
import {
eventsMixin
} from './events'
import {
lifecycleMixin
} from './lifecycle'
import {
warn
} from '../util/index'
function Vue (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue)
) {
warn('Vue is a constructor and should be called with the `new` keyword')
}
this._init(options)
}
initMixin(Vue)
stateMixin(Vue)
eventsMixin(Vue)
lifecycleMixin(Vue)
renderMixin(Vue)
export default Vue
复制代码
转载于:https://juejin.im/post/5ccd9be2e51d453b440236ca