🐛(table): 修复 column 配置 align 属性失效

This commit is contained in:
就眠儀式 2022-11-22 11:40:10 +08:00
parent beded0436f
commit 99a62ada52
4 changed files with 16 additions and 9 deletions

View File

@ -18,7 +18,7 @@ import {
watch, watch,
onUnmounted, onUnmounted,
StyleValue, StyleValue,
Fragment, Fragment,
} from "vue"; } from "vue";
import { LayIcon } from "@layui/icons-vue"; import { LayIcon } from "@layui/icons-vue";
import LayInput from "../input/index.vue"; import LayInput from "../input/index.vue";

View File

@ -291,10 +291,14 @@ const renderTabTitle = (attrs: Record<string, unknown>) => {
useResizeObserver(navRef, update); useResizeObserver(navRef, update);
watch(tabMap, () => { watch(
tabMap,
() => {
childrens.value = []; childrens.value = [];
setItemInstanceBySlot((slot.default && slot.default()) as VNode[]); setItemInstanceBySlot((slot.default && slot.default()) as VNode[]);
}, {immediate: true }); },
{ immediate: true }
);
watch( watch(
() => [ () => [

View File

@ -486,7 +486,7 @@ const radioProps = props.getRadioProps(props.data, props.index);
column.fixed ? `layui-table-fixed-${column.fixed}` : '', column.fixed ? `layui-table-fixed-${column.fixed}` : '',
]" ]"
> >
<div style="display: flex"> <div style="display: flex" :style="[{textAlign: column.align, justifyContent: column.align}]">
<span <span
v-if="expandSpace && columnIndex === expandIndex" v-if="expandSpace && columnIndex === expandIndex"
:style="{ 'margin-right': currentIndentSize + 'px' }" :style="{ 'margin-right': currentIndentSize + 'px' }"
@ -560,7 +560,7 @@ const radioProps = props.getRadioProps(props.data, props.index);
column.fixed ? `layui-table-fixed-${column.fixed}` : '', column.fixed ? `layui-table-fixed-${column.fixed}` : '',
]" ]"
> >
<div style="display: flex"> <div style="display: flex" :style="[{textAlign: column.align, justifyContent: column.align}]">
<span <span
v-if="expandSpace && columnIndex === expandIndex" v-if="expandSpace && columnIndex === expandIndex"
:style="{ 'margin-right': currentIndentSize + 'px' }" :style="{ 'margin-right': currentIndentSize + 'px' }"

View File

@ -13,7 +13,7 @@
::: demo 使用 `lay-table` 标签, 创建表格 ::: demo 使用 `lay-table` 标签, 创建表格
<template> <template>
<lay-table :columns="columns1" :data-source="dataSource1"></lay-table> <lay-table :columns="columns66" :data-source="dataSource1"></lay-table>
</template> </template>
<script> <script>
@ -22,18 +22,21 @@ import { ref } from 'vue'
export default { export default {
setup() { setup() {
const columns1 = [ const columns66 = [
{ {
title:"账户", title:"账户",
width:"200px", width:"200px",
align: "right",
key:"username" key:"username"
},{ },{
title:"密码", title:"密码",
width: "180px", width: "180px",
align: "center",
key:"password" key:"password"
},{ },{
title:"年龄", title:"年龄",
width: "180px", width: "180px",
align: "center",
key:"age" key:"age"
},{ },{
title:"备注", title:"备注",
@ -50,7 +53,7 @@ export default {
] ]
return { return {
columns1, columns66,
dataSource1 dataSource1
} }
} }
@ -299,7 +302,7 @@ export default {
title:"姓名", title:"姓名",
width:"200px", width:"200px",
key:"name", key:"name",
ellipsisTooltip: true, ellipsisTooltip: true
},{ },{
title:"成绩", title:"成绩",
width: "180px", width: "180px",