Skip to content

Commit e15737b

Browse files
committed
fix(table): fix table row misalignment close #353
1 parent f818bb9 commit e15737b

File tree

5 files changed

+520
-54
lines changed

5 files changed

+520
-54
lines changed

package.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"name": "vben-admin",
33
"version": "2.0.3",
4+
"author": {
5+
"name": "vben",
6+
"email": "anncwb@126.com",
7+
"url": "https://github.com/anncwb"
8+
},
49
"scripts": {
510
"bootstrap": "yarn install",
611
"serve": "npx --max_old_space_size=4096 vite",
@@ -28,7 +33,7 @@
2833
},
2934
"dependencies": {
3035
"@iconify/iconify": "^2.0.0-rc.6",
31-
"@vueuse/core": "^4.3.4",
36+
"@vueuse/core": "^4.3.5",
3237
"@zxcvbn-ts/core": "^0.3.0",
3338
"ant-design-vue": "2.0.1",
3439
"apexcharts": "^3.25.0",
@@ -91,6 +96,7 @@
9196
"is-ci": "^3.0.0",
9297
"less": "^4.1.1",
9398
"lint-staged": "^10.5.4",
99+
"madge": "^4.0.2",
94100
"postcss": "^8.2.8",
95101
"prettier": "^2.2.1",
96102
"pretty-quick": "^3.1.0",
@@ -106,7 +112,7 @@
106112
"vite-plugin-compression": "^0.2.3",
107113
"vite-plugin-html": "^2.0.3",
108114
"vite-plugin-imagemin": "^0.2.9",
109-
"vite-plugin-mock": "^2.2.3",
115+
"vite-plugin-mock": "^2.2.4",
110116
"vite-plugin-purge-icons": "^0.7.0",
111117
"vite-plugin-pwa": "^0.5.6",
112118
"vite-plugin-style-import": "^0.8.1",
@@ -120,7 +126,7 @@
120126
"//": "Used to install imagemin dependencies, because imagemin may not be installed in China.If it is abroad, you can delete it",
121127
"bin-wrapper": "npm:bin-wrapper-china",
122128
"esbuild": "0.8.57",
123-
"rollup": "2.41.0"
129+
"rollup": "2.41.1"
124130
},
125131
"repository": {
126132
"type": "git",

src/components/Button/src/BasicButton.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Button v-bind="getBindValue" :class="[getColor, $attrs.class]">
2+
<Button v-bind="getBindValue" :class="[getColor, $attrs.class]" @click="onClick">
33
<template #default="data">
44
<Icon :icon="preIcon" v-if="preIcon" :size="14" />
55
<slot v-bind="data"></slot>
@@ -26,6 +26,7 @@
2626
disabled: propTypes.bool,
2727
preIcon: propTypes.string,
2828
postIcon: propTypes.string,
29+
onClick: propTypes.func,
2930
},
3031
setup(props, { attrs }) {
3132
const getColor = computed(() => {

src/components/Table/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
2-
31
export { default as BasicTable } from './src/BasicTable.vue';
42
export { default as TableAction } from './src/components/TableAction.vue';
53
export { default as EditTableHeaderIcon } from './src/components/EditTableHeaderIcon.vue';
6-
7-
export const TableImg = createAsyncComponent(() => import('./src/components/TableImg.vue'));
4+
export { default as TableImg } from './src/components/TableImg.vue';
85

96
export * from './src/types/table';
107
export * from './src/types/pagination';

src/components/Table/src/components/TableImg.vue

+21-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
2-
<div :class="prefixCls" v-if="imgList && imgList.length">
2+
<div
3+
:class="prefixCls"
4+
class="flex mx-auto items-center"
5+
v-if="imgList && imgList.length"
6+
:style="getWrapStyle"
7+
>
38
<PreviewGroup>
49
<template v-for="img in imgList" :key="img">
510
<Image :width="size" :src="img" />
@@ -8,36 +13,38 @@
813
</div>
914
</template>
1015
<script lang="ts">
11-
import { defineComponent, PropType } from 'vue';
16+
import type { CSSProperties } from 'vue';
17+
import { defineComponent, computed } from 'vue';
1218
import { useDesign } from '/@/hooks/web/useDesign';
1319
1420
import { Image } from 'ant-design-vue';
21+
import { propTypes } from '/@/utils/propTypes';
1522
1623
export default defineComponent({
1724
name: 'TableImage',
1825
components: { Image, PreviewGroup: Image.PreviewGroup },
1926
props: {
20-
imgList: {
21-
type: Array as PropType<string[]>,
22-
default: null,
23-
},
24-
size: {
25-
type: Number as PropType<number>,
26-
default: 40,
27-
},
27+
imgList: propTypes.arrayOf(propTypes.string),
28+
size: propTypes.number.def(40),
2829
},
29-
setup() {
30+
setup(props) {
31+
const getWrapStyle = computed(
32+
(): CSSProperties => {
33+
const { size } = props;
34+
const wh = `${size}px`;
35+
return { height: wh, width: wh };
36+
}
37+
);
38+
3039
const { prefixCls } = useDesign('basic-table-img');
31-
return { prefixCls };
40+
return { prefixCls, getWrapStyle };
3241
},
3342
});
3443
</script>
3544
<style lang="less">
3645
@prefix-cls: ~'@{namespace}-basic-table-img';
3746
3847
.@{prefix-cls} {
39-
display: flex;
40-
4148
.ant-image {
4249
margin-right: 4px;
4350
cursor: zoom-in;

0 commit comments

Comments
 (0)