🐛(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,
onUnmounted,
StyleValue,
Fragment,
Fragment,
} from "vue";
import { LayIcon } from "@layui/icons-vue";
import LayInput from "../input/index.vue";

View File

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

View File

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

View File

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