!21 refactor(layer): 全局引入时挂载 layer 到 globalProperties,优化使用体验
Merge pull request !21 from Sight/N/A
This commit is contained in:
commit
ea98aeb1df
@ -4,7 +4,7 @@ import type { IDefineComponent, InstallOptions } from "./component/type/index";
|
|||||||
import "./theme/layui.css";
|
import "./theme/layui.css";
|
||||||
import "@layui/layer-vue/lib/index.css";
|
import "@layui/layer-vue/lib/index.css";
|
||||||
import "@layui/icons-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 LayLayer from "./component/layer/index";
|
||||||
import LayBacktop from "./component/backTop/index";
|
import LayBacktop from "./component/backTop/index";
|
||||||
@ -149,6 +149,7 @@ const components: Record<string, IDefineComponent> = {
|
|||||||
const install = (app: App, options?: InstallOptions): void => {
|
const install = (app: App, options?: InstallOptions): void => {
|
||||||
const _options = options;
|
const _options = options;
|
||||||
app.config.globalProperties.$PROOPTIONS = _options;
|
app.config.globalProperties.$PROOPTIONS = _options;
|
||||||
|
app.config.globalProperties.$layer = useLayer(app._context);
|
||||||
for (const key in components) {
|
for (const key in components) {
|
||||||
const item = components[key];
|
const item = components[key];
|
||||||
app.component(item.name || key, item);
|
app.component(item.name || key, item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user