11import Vue , { VueConstructor } from 'vue'
22import { Data , SetupFunction , SetupContext } from './component'
3- import { currentVue } from './runtimeContext'
43import { install } from './install'
54import { mixin } from './setup'
65
@@ -10,17 +9,12 @@ declare module 'vue/types/options' {
109 }
1110}
1211
13- const _install = ( Vue : VueConstructor ) => install ( Vue , mixin )
14- const plugin = {
15- install : _install ,
16- }
17- // Auto install if it is not done yet and `window` has `Vue`.
18- // To allow users to avoid auto-installation in some cases,
19- if ( currentVue && typeof window !== 'undefined' && window . Vue ) {
20- _install ( window . Vue )
12+ const VueCompositionAPI = {
13+ install : ( Vue : VueConstructor ) => install ( Vue , mixin ) ,
2114}
2215
23- export default plugin
16+ export default VueCompositionAPI
17+
2418export { nextTick } from './nextTick'
2519export { default as createElement } from './createElement'
2620export { SetupContext }
@@ -40,3 +34,8 @@ export * from './apis/lifecycle'
4034export * from './apis/watch'
4135export * from './apis/computed'
4236export * from './apis/inject'
37+
38+ // auto install when using CDN
39+ if ( typeof window !== 'undefined' && window . Vue ) {
40+ window . Vue . use ( VueCompositionAPI )
41+ }
0 commit comments