( createApp: CreateAppFunction<Element>, createSingletonApp: CreateAppFunction<Element>, )
| 141 | |
| 142 | // Legacy global Vue constructor |
| 143 | export function createCompatVue( |
| 144 | createApp: CreateAppFunction<Element>, |
| 145 | createSingletonApp: CreateAppFunction<Element>, |
| 146 | ): CompatVue { |
| 147 | singletonApp = createSingletonApp({}) |
| 148 | |
| 149 | const Vue: CompatVue = (singletonCtor = function Vue( |
| 150 | options: ComponentOptions = {}, |
| 151 | ) { |
| 152 | return createCompatApp(options, Vue) |
| 153 | } as any) |
| 154 | |
| 155 | function createCompatApp(options: ComponentOptions = {}, Ctor: any) { |
| 156 | assertCompatEnabled(DeprecationTypes.GLOBAL_MOUNT, null) |
| 157 | |
| 158 | const { data } = options |
| 159 | if ( |
| 160 | data && |
| 161 | !isFunction(data) && |
| 162 | softAssertCompatEnabled(DeprecationTypes.OPTIONS_DATA_FN, null) |
| 163 | ) { |
| 164 | options.data = () => data |
| 165 | } |
| 166 | |
| 167 | const app = createApp(options) |
| 168 | |
| 169 | if (Ctor !== Vue) { |
| 170 | applySingletonPrototype(app, Ctor) |
| 171 | } |
| 172 | |
| 173 | const vm = app._createRoot!(options) |
| 174 | if (options.el) { |
| 175 | return (vm as any).$mount(options.el) |
| 176 | } else { |
| 177 | return vm |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | Vue.version = `2.6.14-compat:${__VERSION__}` |
| 182 | Vue.config = singletonApp.config |
| 183 | |
| 184 | Vue.use = (plugin: Plugin, ...options: any[]) => { |
| 185 | if (plugin && isFunction(plugin.install)) { |
| 186 | plugin.install(Vue as any, ...options) |
| 187 | } else if (isFunction(plugin)) { |
| 188 | plugin(Vue as any, ...options) |
| 189 | } |
| 190 | return Vue |
| 191 | } |
| 192 | |
| 193 | Vue.mixin = m => { |
| 194 | singletonApp.mixin(m) |
| 195 | return Vue |
| 196 | } |
| 197 | |
| 198 | Vue.component = ((name: string, comp: Component) => { |
| 199 | if (comp) { |
| 200 | singletonApp.component(name, comp) |
nothing calls this directly
no test coverage detected