refactor: 前端统一使用prettier格式化&枚举值统一管理

This commit is contained in:
meilin.huang
2023-07-06 20:59:22 +08:00
parent f25bdb07ce
commit 5463ae9d7e
125 changed files with 3932 additions and 3735 deletions

View File

@@ -1,44 +1,44 @@
import { h, render, VNode } from 'vue'
import SqlExecDialog from './SqlExecDialog.vue'
import { h, render, VNode } from 'vue';
import SqlExecDialog from './SqlExecDialog.vue';
export type SqlExecProps = {
sql: string
dbId: number,
db: string,
runSuccessCallback?: Function,
cancelCallback?: Function
}
sql: string;
dbId: number;
db: string;
runSuccessCallback?: Function;
cancelCallback?: Function;
};
const boxId = 'sql-exec-id'
const boxId = 'sql-exec-id';
const renderBox = (): VNode => {
const props: SqlExecProps = {
sql: '',
dbId: 0,
} as any
const container = document.createElement('div')
container.id = boxId
} as any;
const container = document.createElement('div');
container.id = boxId;
// 创建 虚拟dom
const boxVNode = h(SqlExecDialog, props)
const boxVNode = h(SqlExecDialog, props);
// 将虚拟dom渲染到 container dom 上
render(boxVNode, container)
render(boxVNode, container);
// 最后将 container 追加到 body 上
document.body.appendChild(container)
document.body.appendChild(container);
return boxVNode
}
return boxVNode;
};
let boxInstance: any
let boxInstance: any;
const SqlExecBox = (props: SqlExecProps): void => {
if (boxInstance) {
const boxVue = boxInstance.component
const boxVue = boxInstance.component;
// 调用open方法显示弹框注意不能使用boxVue.ctx来调用组件函数build打包后ctx会获取不到
boxVue.exposed.open(props);
} else {
boxInstance = renderBox()
SqlExecBox(props)
boxInstance = renderBox();
SqlExecBox(props);
}
}
};
export default SqlExecBox;