Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
沐夕花开
n-table示例
提交
1f779585
N
n-table示例
项目概览
沐夕花开
/
n-table示例
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
n-table示例
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1f779585
编写于
5月 07, 2022
作者:
沐夕花开
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复columns 第一项设置textAlign无效的问题:树形表格首列固定左对齐,其他可以自行设置 columns -> textAlign
上级
972bb4c6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
10 deletion
+16
-10
pages/index/tableData.js
pages/index/tableData.js
+7
-3
uni_modules/n-table/changelog.md
uni_modules/n-table/changelog.md
+2
-0
uni_modules/n-table/components/n-table/table-body.vue
uni_modules/n-table/components/n-table/table-body.vue
+6
-6
uni_modules/n-table/package.json
uni_modules/n-table/package.json
+1
-1
未找到文件。
pages/index/tableData.js
浏览文件 @
1f779585
...
...
@@ -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
"
:
'
头像
'
,
...
...
uni_modules/n-table/changelog.md
浏览文件 @
1f779585
## 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)
...
...
uni_modules/n-table/components/n-table/table-body.vue
浏览文件 @
1f779585
...
...
@@ -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
{
...
...
uni_modules/n-table/package.json
浏览文件 @
1f779585
{
"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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录