diff --git a/src/index.ts b/src/index.ts index df9de7c3a8836f1da3791593b18eadb328d014af..d6dfb2ff4afe0f9ae2d7a533e1ad411e6e1cbc9d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -200,11 +200,13 @@ const layer = { }; // 全局安装 -const install = (app: App, options: InstallOptions): void => { +const install = (app: App, options?: InstallOptions): void => { layer._context = app._context; - app.provide(zIndexKey, options.zIndex) app.component(LayLayer.name, LayLayer); app.config.globalProperties.$layer = layer; + if(options){ + app.provide(zIndexKey, options.zIndex); + } }; export { layer, LayLayer };