mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 08:57:19 +08:00
feat: withInstall (#275)
This commit is contained in:
parent
b6ed8b40d1
commit
1f8e50f482
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
import reBarcode from "./src/index.vue";
|
||||
|
||||
/** 条形码组件 */
|
||||
export const ReBarcode = Object.assign(reBarcode, {
|
||||
install(app: App) {
|
||||
app.component(reBarcode.name, reBarcode);
|
||||
}
|
||||
});
|
||||
export const ReBarcode = withInstall(reBarcode);
|
||||
|
||||
export default ReBarcode;
|
||||
|
@ -1,19 +1,11 @@
|
||||
import { App } from "vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
import reNormalCountTo from "./src/normal";
|
||||
import reboundCountTo from "./src/rebound";
|
||||
|
||||
/** 普通数字动画组件 */
|
||||
const ReNormalCountTo = Object.assign(reNormalCountTo, {
|
||||
install(app: App) {
|
||||
app.component(reNormalCountTo.name, reNormalCountTo);
|
||||
}
|
||||
});
|
||||
const ReNormalCountTo = withInstall(reNormalCountTo);
|
||||
|
||||
/** 回弹式数字动画组件 */
|
||||
const ReboundCountTo = Object.assign(reboundCountTo, {
|
||||
install(app: App) {
|
||||
app.component(reboundCountTo.name, reboundCountTo);
|
||||
}
|
||||
});
|
||||
const ReboundCountTo = withInstall(reboundCountTo);
|
||||
|
||||
export { ReNormalCountTo, ReboundCountTo };
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import reCropper from "./src";
|
||||
import { withInstall } from "/@/utils";
|
||||
|
||||
/** 图片裁剪组件 */
|
||||
export const ReCropper = Object.assign(reCropper, {
|
||||
install(app: App) {
|
||||
app.component(reCropper.name, reCropper);
|
||||
}
|
||||
});
|
||||
export const ReCropper = withInstall(reCropper);
|
||||
|
||||
export default ReCropper;
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import reFlop from "./src/index.vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
|
||||
/** 时间翻牌组件 */
|
||||
export const ReFlop = Object.assign(reFlop, {
|
||||
install(app: App) {
|
||||
app.component(reFlop.name, reFlop);
|
||||
}
|
||||
});
|
||||
export const ReFlop = withInstall(reFlop);
|
||||
|
||||
export default ReFlop;
|
||||
|
@ -1,28 +1,16 @@
|
||||
import { App } from "vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
import control from "./src/Control.vue";
|
||||
import nodePanel from "./src/NodePanel.vue";
|
||||
import dataDialog from "./src/DataDialog.vue";
|
||||
|
||||
/** LogicFlow流程图-控制面板 */
|
||||
const Control = Object.assign(control, {
|
||||
install(app: App) {
|
||||
app.component(control.name, control);
|
||||
}
|
||||
});
|
||||
const Control = withInstall(control);
|
||||
|
||||
/** LogicFlow流程图-拖拽面板 */
|
||||
const NodePanel = Object.assign(nodePanel, {
|
||||
install(app: App) {
|
||||
app.component(nodePanel.name, nodePanel);
|
||||
}
|
||||
});
|
||||
const NodePanel = withInstall(nodePanel);
|
||||
|
||||
/** LogicFlow流程图-查看数据 */
|
||||
const DataDialog = Object.assign(dataDialog, {
|
||||
install(app: App) {
|
||||
app.component(dataDialog.name, dataDialog);
|
||||
}
|
||||
});
|
||||
const DataDialog = withInstall(dataDialog);
|
||||
|
||||
export { Control, NodePanel, DataDialog };
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
import reImageVerify from "./src/index.vue";
|
||||
|
||||
/** 图形验证码组件 */
|
||||
export const ReImageVerify = Object.assign(reImageVerify, {
|
||||
install(app: App) {
|
||||
app.component(reImageVerify.name, reImageVerify);
|
||||
}
|
||||
});
|
||||
export const ReImageVerify = withInstall(reImageVerify);
|
||||
|
||||
export default ReImageVerify;
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import amap from "./src/Amap.vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
|
||||
/** 高德地图组件 */
|
||||
export const Amap = Object.assign(amap, {
|
||||
install(app: App) {
|
||||
app.component(amap.name, amap);
|
||||
}
|
||||
});
|
||||
export const Amap = withInstall(amap);
|
||||
|
||||
export default Amap;
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import reQrcode from "./src/index";
|
||||
import { withInstall } from "/@/utils";
|
||||
|
||||
/** 二维码组件 */
|
||||
export const ReQrcode = Object.assign(reQrcode, {
|
||||
install(app: App) {
|
||||
app.component(reQrcode.name, reQrcode);
|
||||
}
|
||||
});
|
||||
export const ReQrcode = withInstall(reQrcode);
|
||||
|
||||
export default ReQrcode;
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import { withInstall } from "/@/utils";
|
||||
import reSeamlessScroll from "./src/index.vue";
|
||||
|
||||
/** 无缝滚动组件 */
|
||||
export const ReSeamlessScroll = Object.assign(reSeamlessScroll, {
|
||||
install(app: App) {
|
||||
app.component(reSeamlessScroll.name, reSeamlessScroll);
|
||||
}
|
||||
});
|
||||
export const ReSeamlessScroll = withInstall(reSeamlessScroll);
|
||||
|
||||
export default ReSeamlessScroll;
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { App } from "vue";
|
||||
import reSelector from "./src";
|
||||
import { withInstall } from "/@/utils";
|
||||
|
||||
/** 选择器组件 */
|
||||
export const ReSelector = Object.assign(reSelector, {
|
||||
install(app: App) {
|
||||
app.component(reSelector.name, reSelector);
|
||||
}
|
||||
});
|
||||
export const ReSelector = withInstall(reSelector);
|
||||
|
||||
export default ReSelector;
|
||||
|
@ -1,9 +1,5 @@
|
||||
import { App } from "vue";
|
||||
import epTableProBar from "./src/bar";
|
||||
import { withInstall } from "/@/utils";
|
||||
|
||||
/** table-crud组件 */
|
||||
export const EpTableProBar = Object.assign(epTableProBar, {
|
||||
install(app: App) {
|
||||
app.component(epTableProBar.name, epTableProBar);
|
||||
}
|
||||
});
|
||||
export const EpTableProBar = withInstall(epTableProBar);
|
||||
|
9
src/utils/index.ts
Normal file
9
src/utils/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import type { App, Plugin } from "vue";
|
||||
|
||||
export const withInstall = <T>(component: T) => {
|
||||
const comp = component as any;
|
||||
comp.install = (app: App) => {
|
||||
app.component(comp.name, component);
|
||||
};
|
||||
return component as T & Plugin;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user