🐛: 修复 withInstall

This commit is contained in:
sight
2022-05-15 03:17:00 +08:00
parent f972c94f55
commit 334699b210
82 changed files with 238 additions and 241 deletions

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { LayIcon as Component } from "@layui/icons-vue";
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../../utils";
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,11 +1,10 @@
import type { App, Component } from "vue";
import type { App, Plugin } from "vue";
import "./theme/index.less";
import "@layui/layer-vue/lib/index.css";
import "@layui/icons-vue/lib/index.css";
import { layer } from "@layui/layer-vue";
import layerInstall from "@layui/layer-vue";
import i18n from "./language";
import LayBacktop from "./component/backTop/index";
import LayAvatar from "./component/avatar/index";
@@ -86,7 +85,7 @@ import LayNoticeBar from "./component/noticeBar/index";
import LayConfigProvider from "./provider";
import { InstallOptions } from "./types";
const components: Record<string, Component> = {
const components: Record<string, Plugin> = {
LaySplitPanel,
LaySplitPanelItem,
LayRadio,
@@ -167,11 +166,9 @@ const components: Record<string, Component> = {
};
const install = (app: App, options?: InstallOptions): void => {
for (const key in components) {
const item = components[key];
app.component(item.name || key, item);
for (const key of Object.keys(components)) {
app.use(components[key], options);
}
app.use(i18n);
app.use(layerInstall);
};

View File

@@ -1,5 +1,5 @@
import { withInstall } from "../utils";
import { withInstall, WithInstallType } from "../utils";
import Component from "./index.vue";
const component = withInstall(Component);
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -1,3 +1,3 @@
export * from "./domUtil";
export * from "./guidUtil";
export * from "./install";
export * from "./withInstall";

View File

@@ -1,17 +0,0 @@
import type { App } from "vue";
import i18n from "../language";
export const withInstall = (comp: any) => {
comp.install = (app: App | any) => {
if (
!app._instance?.isCE &&
!app._instance?.appContext?.app?.__VUE_I18N_SYMBOL__
) {
app.use(i18n);
}
app.component(comp.name, comp);
};
return comp;
};

View File

@@ -0,0 +1,17 @@
import type { App, Plugin } from "vue";
import i18n from "../language";
export type WithInstallType<T> = T & Plugin;
export const withInstall = <T>(comp: T): T & Plugin => {
const component = comp as any;
component.install = (app: App | any) => {
if (!app.__VUE_I18N_SYMBOL__) {
app.use(i18n);
}
app.component(component.name, comp);
};
return component as T & Plugin;
};