提交 1f779585 编写于 作者: 沐夕花开's avatar 沐夕花开

fix: 修复columns 第一项设置textAlign无效的问题:树形表格首列固定左对齐,其他可以自行设置 columns -> textAlign

上级 972bb4c6
......@@ -206,12 +206,14 @@ export const treeColumns = [{
// 通过设置 hidden 控制该列是否显示
export const columns2 = [{
"title": "区域",
"dataIndex": "区域"
"dataIndex": "区域",
"textAlign":'center'
},
{
"title": "销售",
"dataIndex": "销售",
"sort": true,
"textAlign":'left',
hidden: false
},
{
......@@ -247,7 +249,8 @@ export const tableData2 = [
// 分组示例 表格数据 columns
export const columns3 = [{
"title": "区域",
"dataIndex": "区域"
"dataIndex": "区域",
textAlign:'center'
},
{
"title": "销售",
......@@ -319,7 +322,8 @@ export const groupData = [{
// 字段映射示例 columns
export const enumColumns = [{
"title": "姓名",
"dataIndex": "姓名"
"dataIndex": "姓名",
textAlign:'left'
},
{
"title": '头像',
......
## 1.2.6(2022-05-07)
1. fix: 修复columns 第一项设置textAlign无效的问题:树形表格首列固定左对齐,其他可以自行设置 columns -> textAlign;
## 1.2.5(2022-05-06)
1. add: 示例发布微信小程序
## 1.2.4(2022-04-27)
......
......@@ -26,7 +26,7 @@
<view v-for=" (child, childIdx) in row.children" :key="childIdx"
class="group-open-wrap">
<view v-for="(col, jIndex) in dataIndexs"
:class="['n-table-container-col n-border border-right border-bottom', { 'head-row': jIndex == 0, 'n-table-stick-side': stickSide && jIndex == 0 , 'text-left': textAlign === 'left' && !isTree, 'text-center': textAlign === 'center' && !isTree, 'text-right': textAlign === 'right' && !isTree }]"
:class="['n-table-container-col n-border border-right border-bottom', { 'head-row': jIndex == 0, 'n-table-stick-side': stickSide && jIndex == 0 , 'text-left': getTextAlign(col) === 'left' && !isTree, 'text-center': getTextAlign(col) === 'center' && !isTree, 'text-right': getTextAlign(col) === 'right' && !isTree }]"
:style="{
width: getItemStyle(col).width,
paddingLeft: jIndex == 0 ? ( isTree ? (row.level + 1) : row.level )*8 + 'px' : '8px',
......@@ -34,12 +34,13 @@
:key="jIndex"
>
<view
:class="['n-table-col-text', {'text-left': getTextAlign(col) === 'left' || jIndex === 0 , 'text-center': getTextAlign(col) === 'center' && jIndex !== 0, 'text-right': getTextAlign(col) === 'right' && jIndex !== 0}]"
:class="['n-table-col-text', {'text-left': getTextAlign(col) === 'left' , 'text-center': getTextAlign(col) === 'center' , 'text-right': getTextAlign(col) === 'right'}]"
:style="{color: col.bodyColor || color, fontSize: fontSize + 'px'}">
<view class="tx-content" v-if="!col.isLink && !col.isImage"
v-html="getRowContent(child, col)">
</view>
<!-- 图片 -->
<view v-if="col.isImage" class="n-table-col-img">
......@@ -88,7 +89,7 @@
<view
v-if="!col.hidden"
class="n-border border-bottom border-right"
:class="['n-table-container-col', { 'head-row': jIndex == 0, 'n-table-stick-side': stickSide && jIndex == 0 , 'text-left': textAlign === 'left' && !isTree, 'text-center': textAlign === 'center' && !isTree, 'text-right': textAlign === 'right' && !isTree }]"
:class="['n-table-container-col', { 'head-row': jIndex == 0, 'n-table-stick-side': stickSide && jIndex == 0 , 'text-left': getTextAlign(col) === 'left' && !isTree, 'text-center': getTextAlign(col) === 'center' && !isTree, 'text-right': getTextAlign(col) === 'right' && !isTree }]"
:style="{
width: getItemStyle(col).width,
paddingLeft: jIndex == 0 ? ( isTree ? (row.level + 1) : row.level )*8 + 'px' : '8px',
......@@ -109,7 +110,7 @@
</view>
<view
:class="['n-table-col-text', {'text-left': getTextAlign(col) === 'left' || jIndex === 0 , 'text-center': getTextAlign(col) === 'center' && jIndex !== 0, 'text-right': getTextAlign(col) === 'right' && jIndex !== 0}]"
:class="['n-table-col-text', {'text-left': getTextAlign(col) === 'left' || isTree , 'text-center': getTextAlign(col) === 'center' && !isTree, 'text-right': getTextAlign(col) === 'right' && !isTree}]"
:style="{color: col.bodyColor || color, fontSize: fontSize + 'px'}">
<view class="tx-content" v-if="!col.isLink && !col.isImage"
v-html="getRowContent(row, col)">
......@@ -498,7 +499,7 @@
.head-row .n-table-col-text {
width: auto;
flex: unset;
flex: 1;
}
.n-table-col-text {
......@@ -507,7 +508,6 @@
flex: 1;
justify-content: flex-start;
align-content: center;
}
.text-left {
......
{
"id": "n-table",
"displayName": "n-table 多级表头、树形结构,高度配置表格组件",
"version": "1.2.5",
"version": "1.2.6",
"description": "n-table 多级表头、树形结构,高度配置表格组件",
"keywords": [
"表格,多级表头,树形结构,可配置"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册