!21 refactor(layer): 全局引入时挂载 layer 到 globalProperties,优化使用体验

Merge pull request !21 from Sight/N/A
This commit is contained in:
就眠儀式 2022-01-23 11:17:17 +00:00 committed by Gitee
commit ea98aeb1df
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -4,7 +4,7 @@ import type { IDefineComponent, InstallOptions } from "./component/type/index";
import "./theme/layui.css";
import "@layui/layer-vue/lib/index.css";
import "@layui/icons-vue/lib/index.css";
import { layer } from "@layui/layer-vue";
import { layer, useLayer } from "@layui/layer-vue";
import LayLayer from "./component/layer/index";
import LayBacktop from "./component/backTop/index";
@ -149,6 +149,7 @@ const components: Record<string, IDefineComponent> = {
const install = (app: App, options?: InstallOptions): void => {
const _options = options;
app.config.globalProperties.$PROOPTIONS = _options;
app.config.globalProperties.$layer = useLayer(app._context);
for (const key in components) {
const item = components[key];
app.component(item.name || key, item);