File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const { ref, reactive } = VueCompositionAPI
5252
5353## TypeScript 支持
5454
55- > 本插件要求使用 TypeScript ** 3.5.1 ** 或以上版本
55+ > 本插件要求使用 TypeScript ** 4.2 ** 或以上版本
5656
5757为了让 TypeScript 在 Vue 组件选项中正确地进行类型推导,我们必须使用 ` defineComponent ` 来定义组件:
5858
@@ -384,6 +384,26 @@ watch(
384384
385385</details >
386386
387+ ### ` createApp `
388+
389+ <details >
390+ <summary >
391+ ⚠️ <code >createApp()</code > 是全局的
392+ </summary >
393+
394+ 在 Vue3 中,引入了 ` createApp() ` 来隔离不同应用实例的上下文(plugin, components 等)。 由于 Vue2 的设计,在这个插件中,我们提供 ` createApp() ` 作为一个向前兼容的 API ,它只是全局的一个别名。
395+
396+ ``` ts
397+ const app1 = createApp (RootComponent1 )
398+ app1 .component (' Foo' , Foo ) // 相当于 Vue.component('Foo', Foo)
399+ app1 .use (VueRouter ) // 相当于 Vue.use(VueRouter)
400+
401+ const app2 = createApp (RootComponent2 )
402+ app2 .component (' Bar' , Bar ) // 相当于 Vue.use('Bar', Bar)
403+ ```
404+
405+ </details >
406+
387407### ` shallowReadonly `
388408
389409<details >
You can’t perform that action at this time.
0 commit comments