mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +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";
|
import reBarcode from "./src/index.vue";
|
||||||
|
|
||||||
/** 条形码组件 */
|
/** 条形码组件 */
|
||||||
export const ReBarcode = Object.assign(reBarcode, {
|
export const ReBarcode = withInstall(reBarcode);
|
||||||
install(app: App) {
|
|
||||||
app.component(reBarcode.name, reBarcode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReBarcode;
|
export default ReBarcode;
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
import { App } from "vue";
|
import { withInstall } from "/@/utils";
|
||||||
import reNormalCountTo from "./src/normal";
|
import reNormalCountTo from "./src/normal";
|
||||||
import reboundCountTo from "./src/rebound";
|
import reboundCountTo from "./src/rebound";
|
||||||
|
|
||||||
/** 普通数字动画组件 */
|
/** 普通数字动画组件 */
|
||||||
const ReNormalCountTo = Object.assign(reNormalCountTo, {
|
const ReNormalCountTo = withInstall(reNormalCountTo);
|
||||||
install(app: App) {
|
|
||||||
app.component(reNormalCountTo.name, reNormalCountTo);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 回弹式数字动画组件 */
|
/** 回弹式数字动画组件 */
|
||||||
const ReboundCountTo = Object.assign(reboundCountTo, {
|
const ReboundCountTo = withInstall(reboundCountTo);
|
||||||
install(app: App) {
|
|
||||||
app.component(reboundCountTo.name, reboundCountTo);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export { ReNormalCountTo, ReboundCountTo };
|
export { ReNormalCountTo, ReboundCountTo };
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
|
||||||
import reCropper from "./src";
|
import reCropper from "./src";
|
||||||
|
import { withInstall } from "/@/utils";
|
||||||
|
|
||||||
/** 图片裁剪组件 */
|
/** 图片裁剪组件 */
|
||||||
export const ReCropper = Object.assign(reCropper, {
|
export const ReCropper = withInstall(reCropper);
|
||||||
install(app: App) {
|
|
||||||
app.component(reCropper.name, reCropper);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReCropper;
|
export default ReCropper;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
|
||||||
import reFlop from "./src/index.vue";
|
import reFlop from "./src/index.vue";
|
||||||
|
import { withInstall } from "/@/utils";
|
||||||
|
|
||||||
/** 时间翻牌组件 */
|
/** 时间翻牌组件 */
|
||||||
export const ReFlop = Object.assign(reFlop, {
|
export const ReFlop = withInstall(reFlop);
|
||||||
install(app: App) {
|
|
||||||
app.component(reFlop.name, reFlop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReFlop;
|
export default ReFlop;
|
||||||
|
@ -1,28 +1,16 @@
|
|||||||
import { App } from "vue";
|
import { withInstall } from "/@/utils";
|
||||||
import control from "./src/Control.vue";
|
import control from "./src/Control.vue";
|
||||||
import nodePanel from "./src/NodePanel.vue";
|
import nodePanel from "./src/NodePanel.vue";
|
||||||
import dataDialog from "./src/DataDialog.vue";
|
import dataDialog from "./src/DataDialog.vue";
|
||||||
|
|
||||||
/** LogicFlow流程图-控制面板 */
|
/** LogicFlow流程图-控制面板 */
|
||||||
const Control = Object.assign(control, {
|
const Control = withInstall(control);
|
||||||
install(app: App) {
|
|
||||||
app.component(control.name, control);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/** LogicFlow流程图-拖拽面板 */
|
/** LogicFlow流程图-拖拽面板 */
|
||||||
const NodePanel = Object.assign(nodePanel, {
|
const NodePanel = withInstall(nodePanel);
|
||||||
install(app: App) {
|
|
||||||
app.component(nodePanel.name, nodePanel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/** LogicFlow流程图-查看数据 */
|
/** LogicFlow流程图-查看数据 */
|
||||||
const DataDialog = Object.assign(dataDialog, {
|
const DataDialog = withInstall(dataDialog);
|
||||||
install(app: App) {
|
|
||||||
app.component(dataDialog.name, dataDialog);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export { Control, NodePanel, DataDialog };
|
export { Control, NodePanel, DataDialog };
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
import { withInstall } from "/@/utils";
|
||||||
import reImageVerify from "./src/index.vue";
|
import reImageVerify from "./src/index.vue";
|
||||||
|
|
||||||
/** 图形验证码组件 */
|
/** 图形验证码组件 */
|
||||||
export const ReImageVerify = Object.assign(reImageVerify, {
|
export const ReImageVerify = withInstall(reImageVerify);
|
||||||
install(app: App) {
|
|
||||||
app.component(reImageVerify.name, reImageVerify);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReImageVerify;
|
export default ReImageVerify;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
|
||||||
import amap from "./src/Amap.vue";
|
import amap from "./src/Amap.vue";
|
||||||
|
import { withInstall } from "/@/utils";
|
||||||
|
|
||||||
/** 高德地图组件 */
|
/** 高德地图组件 */
|
||||||
export const Amap = Object.assign(amap, {
|
export const Amap = withInstall(amap);
|
||||||
install(app: App) {
|
|
||||||
app.component(amap.name, amap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default Amap;
|
export default Amap;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
|
||||||
import reQrcode from "./src/index";
|
import reQrcode from "./src/index";
|
||||||
|
import { withInstall } from "/@/utils";
|
||||||
|
|
||||||
/** 二维码组件 */
|
/** 二维码组件 */
|
||||||
export const ReQrcode = Object.assign(reQrcode, {
|
export const ReQrcode = withInstall(reQrcode);
|
||||||
install(app: App) {
|
|
||||||
app.component(reQrcode.name, reQrcode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReQrcode;
|
export default ReQrcode;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
import { withInstall } from "/@/utils";
|
||||||
import reSeamlessScroll from "./src/index.vue";
|
import reSeamlessScroll from "./src/index.vue";
|
||||||
|
|
||||||
/** 无缝滚动组件 */
|
/** 无缝滚动组件 */
|
||||||
export const ReSeamlessScroll = Object.assign(reSeamlessScroll, {
|
export const ReSeamlessScroll = withInstall(reSeamlessScroll);
|
||||||
install(app: App) {
|
|
||||||
app.component(reSeamlessScroll.name, reSeamlessScroll);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReSeamlessScroll;
|
export default ReSeamlessScroll;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { App } from "vue";
|
|
||||||
import reSelector from "./src";
|
import reSelector from "./src";
|
||||||
|
import { withInstall } from "/@/utils";
|
||||||
|
|
||||||
/** 选择器组件 */
|
/** 选择器组件 */
|
||||||
export const ReSelector = Object.assign(reSelector, {
|
export const ReSelector = withInstall(reSelector);
|
||||||
install(app: App) {
|
|
||||||
app.component(reSelector.name, reSelector);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ReSelector;
|
export default ReSelector;
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
import { App } from "vue";
|
|
||||||
import epTableProBar from "./src/bar";
|
import epTableProBar from "./src/bar";
|
||||||
|
import { withInstall } from "/@/utils";
|
||||||
|
|
||||||
/** table-crud组件 */
|
/** table-crud组件 */
|
||||||
export const EpTableProBar = Object.assign(epTableProBar, {
|
export const EpTableProBar = withInstall(epTableProBar);
|
||||||
install(app: App) {
|
|
||||||
app.component(epTableProBar.name, 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