This commit is contained in:
神仙都没用 2024-07-14 13:49:56 +08:00
parent c128d3ee7f
commit 56e5357800
13 changed files with 48 additions and 38 deletions

View File

@ -743,9 +743,10 @@ declare interface Config {
autoHeight: boolean;
contextMenu: ClTable.ContextMenu;
column: {
minWidth: number;
minWidth: number | string;
align: ElementPlus.Align;
headerAlign: ElementPlus.Align;
opWidth: number | string;
};
plugins: ClTable.Plugin[];
};

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/crud",
"version": "7.1.24",
"version": "7.1.25",
"private": false,
"main": "./dist/index.umd.min.js",
"typings": "types/index.d.ts",

View File

@ -39,7 +39,7 @@ export function useHeight({ config, Table }: { Table: Vue.Ref<any>; config: ClTa
let n = vm.$el.nextSibling;
// 集合
let arr = [vm.$el];
const arr = [vm.$el];
while (n) {
if (n.offsetHeight > 0) {

View File

@ -46,7 +46,7 @@ export function useRender() {
ElTableColumn,
{
label: crud.dict.label.op,
width: "160px",
width: style.table.column.opWidth,
fixed: browser.isMini ? null : "right",
...item
},

View File

@ -1,13 +1,12 @@
import { App } from "vue";
import { useComponent } from "./components";
import { useProvide } from "./provide";
import temp from "./utils/temp";
import global from "./utils/global";
import "./static/index.scss";
const Crud = {
install(app: App, options?: Options) {
// 临时
temp.set("__CrudApp__", app);
global.set("__CrudApp__", app);
// 穿透值
useProvide(app, options);

View File

@ -1,6 +1,8 @@
import { createApp } from "vue";
import App from "./App.vue";
import Crud, { locale } from "./index";
// import Crud, { locale } from "./index";
import Crud, { locale } from "../dist/index.umd";
import "../dist/index.css";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
@ -14,7 +16,7 @@ app.use(ElementPlus)
prop: "order",
order: "sort"
},
label: locale.en
label: locale.zhCn
},
style: {
// size: "default"

View File

@ -64,13 +64,14 @@ function setConfig(app: App, options: Options = {}) {
autoHeight: true,
contextMenu: ["refresh", "check", "edit", "delete", "order-asc", "order-desc"],
column: {
align: "center"
align: "center",
opWidth: 160
}
}
},
events: {}
},
options || {}
} as Options,
options
);
// 初始化事件

View File

@ -508,10 +508,10 @@
}
.cl-dialog {
display: flex;
flex-direction: column;
&.el-dialog {
border-radius: 6px;
padding: 0;
}
.el-dialog {
&__header {

View File

@ -3,92 +3,92 @@ import { uuid } from "../utils";
const userList = [
{
id: "110000199206102819",
id: 1,
name: "楚行云",
createTime: "1996-09-14",
wages: 73026,
status: 1,
account: "ihknssft",
account: "chuxingyun",
occupation: 4,
phone: 13797353874
},
{
id: "410000199208224044",
id: 2,
name: "秦尘",
createTime: "1977-11-09",
wages: 74520,
status: 0,
account: "xlabchey",
account: "qincheng",
occupation: 3,
phone: 18593911044
},
{
id: "120000199708139664",
id: 3,
name: "叶凡",
createTime: "1982-11-28",
wages: 81420,
status: 0,
account: "xpqbtkul",
account: "yefan",
occupation: 1,
phone: 16234136338
},
{
id: "710000200203060278",
id: 4,
name: "白小纯",
createTime: "2012-12-17",
wages: 65197,
status: 1,
account: "kirukkje",
account: "baixiaochun",
occupation: 2,
phone: 16325661110
},
{
id: "210000201007157714",
id: 5,
name: "韩立",
createTime: "1982-07-10",
wages: 99107,
status: 1,
account: "rbrohvoj",
account: "hanli",
occupation: 2,
phone: 18486594866
},
{
id: "420000200901038044",
id: 6,
name: "唐三",
createTime: "2019-07-31",
wages: 80658,
status: 1,
account: "qtuwsfuh",
account: "tangsan",
occupation: 5,
phone: 15565014642
},
{
id: "150000197711136225",
id: 7,
name: "王林",
createTime: "2009-07-26",
wages: 57408,
status: 1,
account: "gxyhlwdq",
account: "wanglin",
occupation: 1,
phone: 13852767084
},
{
id: "710000198106232170",
id: 8,
name: "李强",
createTime: "2016-04-26",
wages: 71782,
status: 1,
account: "vruiimiy",
account: "liqiang",
occupation: 3,
phone: 18365332834
},
{
id: "530000199311309764",
id: 9,
name: "秦羽",
createTime: "1984-01-18",
wages: 87860,
status: 1,
account: "dtvkpyag",
account: "qinyu",
occupation: 0,
phone: 18149247129
}

View File

@ -1,7 +1,7 @@
import { h, resolveComponent, toRaw, VNode } from "vue";
import { isObject } from "./index";
import { parseExtensionComponent } from "./parse";
import temp from "./temp";
import global from "./global";
import { useConfig } from "../hooks";
import { isFunction, isString } from "lodash-es";
@ -48,7 +48,7 @@ export function parseNode(vnode: any, options: Options): VNode {
// 实例模式下,先注册到全局,再分解组件渲染
if (vnode.vm && !regs.get(vnode.name)) {
temp.vue.component(vnode.name, { ...vnode.vm });
global.vue.component(vnode.name, { ...vnode.vm });
regs.set(vnode.name, { ...vnode.vm });
}

View File

@ -8,7 +8,7 @@ declare class TestService {
info(params: {
id: any;
}): Promise<{
id: string;
id: number;
name: string;
createTime: string;
wages: number;
@ -21,7 +21,7 @@ declare class TestService {
ids: any[];
}): Promise<void>;
list(): Promise<{
id: string;
id: number;
name: string;
createTime: string;
wages: number;

7
packages/crud/types/utils/global.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import { App } from "vue";
declare const _default: {
readonly vue: App<any>;
get(key: string): any;
set(key: string, value: any): void;
};
export default _default;