| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /* @flow */
- import Vue from 'core/index'
- import config from 'core/config'
- import { extend, noop } from 'shared/util'
- import { devtools, inBrowser } from 'core/util/index'
- import { patch } from 'web/runtime/patch'
- import platformDirectives from 'web/runtime/directives/index'
- import platformComponents from 'web/runtime/components/index'
- import { query, isUnknownElement, isReservedTag, mustUseProp } from 'web/util/index'
- // install platform specific utils
- Vue.config.isUnknownElement = isUnknownElement
- Vue.config.isReservedTag = isReservedTag
- Vue.config.mustUseProp = mustUseProp
- // install platform runtime directives & components
- extend(Vue.options.directives, platformDirectives)
- extend(Vue.options.components, platformComponents)
- // install platform patch function
- Vue.prototype.__patch__ = config._isServer ? noop : patch
- // wrap mount
- Vue.prototype.$mount = function (
- el?: string | Element,
- hydrating?: boolean
- ): Component {
- return this._mount(el && query(el), hydrating)
- }
- // devtools global hook
- /* istanbul ignore next */
- setTimeout(() => {
- if (config.devtools) {
- if (devtools) {
- devtools.emit('init', Vue)
- } else if (
- process.env.NODE_ENV !== 'production' &&
- inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
- ) {
- console.log(
- 'Download the Vue Devtools for a better development experience:\n' +
- 'https://github.com/vuejs/vue-devtools'
- )
- }
- }
- }, 0)
- export default Vue
|