🐛(component): 排除 uuid 依赖, 修复 table.css empty 与 tools 样式

This commit is contained in:
就眠儀式 2022-09-08 09:30:10 +08:00
parent 4b30714dab
commit 0e8e392e90
6 changed files with 9 additions and 24 deletions

View File

@ -41,12 +41,8 @@
"@umijs/ssr-darkreader": "^4.9.45", "@umijs/ssr-darkreader": "^4.9.45",
"dayjs": "^1.11.0", "dayjs": "^1.11.0",
"evtd": "^0.2.3", "evtd": "^0.2.3",
"uuid": "^8.3.2",
"vue-i18n": "^9.1.10" "vue-i18n": "^9.1.10"
}, },
"devDependencies": {
"@types/uuid": "^8.3.4"
},
"files": [ "files": [
"lib", "lib",
"es", "es",

View File

@ -2,6 +2,7 @@
@import "../radio/index.less"; @import "../radio/index.less";
@import "../dropdown/index.less"; @import "../dropdown/index.less";
@import "../page/index.less"; @import "../page/index.less";
@import "../empty/index.less";
.layui-table-col-special { .layui-table-col-special {
width: 34px; width: 34px;
@ -14,6 +15,10 @@
table-layout: fixed; table-layout: fixed;
} }
.layui-table .layui-empty {
margin: 20px;
}
.layui-table th { .layui-table th {
text-align: left; text-align: left;
font-weight: 400; font-weight: 400;

View File

@ -17,7 +17,6 @@ import {
computed, computed,
onBeforeUnmount, onBeforeUnmount,
} from "vue"; } from "vue";
import { v4 as uuidv4 } from "../../utils/guidUtil";
import { Recordable } from "../../types"; import { Recordable } from "../../types";
import { LayIcon } from "@layui/icons-vue"; import { LayIcon } from "@layui/icons-vue";
import LayCheckbox from "../checkbox/index.vue"; import LayCheckbox from "../checkbox/index.vue";
@ -78,8 +77,6 @@ const props = withDefaults(defineProps<LayTableProps>(), {
getRadioProps: () => {}, getRadioProps: () => {},
}); });
const tableId = uuidv4();
const emit = defineEmits([ const emit = defineEmits([
"change", "change",
"update:expandKeys", "update:expandKeys",
@ -92,6 +89,7 @@ const emit = defineEmits([
const slot = useSlots(); const slot = useSlots();
const slots = slot.default && slot.default(); const slots = slot.default && slot.default();
const tableRef = ref();
const s = ""; const s = "";
const allChecked = ref(false); const allChecked = ref(false);
@ -333,7 +331,7 @@ const rowContextmenu = (data: any, evt: MouseEvent) => {
// //
const print = () => { const print = () => {
let subOutputRankPrint = document.getElementById(tableId) as HTMLElement; let subOutputRankPrint = tableRef.value as HTMLElement;
let newContent = subOutputRankPrint.innerHTML; let newContent = subOutputRankPrint.innerHTML;
let oldContent = document.body.innerHTML; let oldContent = document.body.innerHTML;
document.body.innerHTML = newContent; document.body.innerHTML = newContent;
@ -621,12 +619,11 @@ onBeforeUnmount(() => {
</script> </script>
<template> <template>
<div :id="tableId"> <div ref="tableRef">
<table class="layui-hide" lay-filter="test"></table> <table class="layui-hide" lay-filter="test"></table>
<div class="layui-form layui-border-box layui-table-view" :class="classes"> <div class="layui-form layui-border-box layui-table-view" :class="classes">
<!-- 工具栏 -->
<div v-if="defaultToolbar || slot.toolbar" class="layui-table-tool"> <div v-if="defaultToolbar || slot.toolbar" class="layui-table-tool">
<div v-if="slot.toolbar" class="layui-table-tool-temp"> <div class="layui-table-tool-temp">
<slot name="toolbar"></slot> <slot name="toolbar"></slot>
</div> </div>
<div v-if="defaultToolbar" class="layui-table-tool-self"> <div v-if="defaultToolbar" class="layui-table-tool-self">

View File

@ -1,2 +0,0 @@
// @ts-ignore
export { v4 } from "uuid";

View File

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

10
pnpm-lock.yaml generated
View File

@ -77,14 +77,12 @@ importers:
specifiers: specifiers:
'@layui/icons-vue': ^1.0.9 '@layui/icons-vue': ^1.0.9
'@layui/layer-vue': ^1.4.2 '@layui/layer-vue': ^1.4.2
'@types/uuid': ^8.3.4
'@umijs/ssr-darkreader': ^4.9.45 '@umijs/ssr-darkreader': ^4.9.45
'@vueuse/core': ^8.7.3 '@vueuse/core': ^8.7.3
async-validator: ^4.1.1 async-validator: ^4.1.1
cropperjs: ^1.5.12 cropperjs: ^1.5.12
dayjs: ^1.11.0 dayjs: ^1.11.0
evtd: ^0.2.3 evtd: ^0.2.3
uuid: ^8.3.2
vue-i18n: ^9.1.10 vue-i18n: ^9.1.10
dependencies: dependencies:
'@layui/icons-vue': link:../icons '@layui/icons-vue': link:../icons
@ -95,10 +93,7 @@ importers:
cropperjs: 1.5.12 cropperjs: 1.5.12
dayjs: 1.11.0 dayjs: 1.11.0
evtd: 0.2.3 evtd: 0.2.3
uuid: 8.3.2
vue-i18n: 9.1.10_vue@3.2.37 vue-i18n: 9.1.10_vue@3.2.37
devDependencies:
'@types/uuid': 8.3.4
package/document-component: package/document-component:
specifiers: specifiers:
@ -5119,11 +5114,6 @@ packages:
resolution: {integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=} resolution: {integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=}
dev: true dev: true
/uuid/8.3.2:
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
hasBin: true
dev: false
/v8-compile-cache-lib/3.0.0: /v8-compile-cache-lib/3.0.0:
resolution: {integrity: sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==} resolution: {integrity: sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==}
dev: true dev: true