Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
沐夕花开
n-table示例
提交
1ec9b61c
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 搜索 >>
提交
1ec9b61c
编写于
4月 14, 2022
作者:
沐夕花开
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复 tableData = [] 时候一直显示loading状态: tableData 为Boolean类型时,显示 loading,空数组时候显示 无数据提示
上级
ae2c8026
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
20 deletion
+35
-20
pages/index/index.vue
pages/index/index.vue
+3
-1
uni_modules/n-table/changelog.md
uni_modules/n-table/changelog.md
+3
-0
uni_modules/n-table/components/n-table/n-table.vue
uni_modules/n-table/components/n-table/n-table.vue
+24
-15
uni_modules/n-table/components/n-table/table-body.vue
uni_modules/n-table/components/n-table/table-body.vue
+4
-3
uni_modules/n-table/package.json
uni_modules/n-table/package.json
+1
-1
未找到文件。
pages/index/index.vue
浏览文件 @
1ec9b61c
...
...
@@ -95,7 +95,9 @@
mounted
()
{
setTimeout
(()
=>
{
this
.
columns
=
baseColumns
this
.
tableData
=
baseColumnsData
// tableData 为Boolean 时,显示loading,空数组时候显示 无数据提示
// this.tableData = baseColumnsData
this
.
tableData
=
[]
this
.
tableData1
=
baseColumnsData
this
.
tableDataTree
=
treeColumnsData
...
...
uni_modules/n-table/changelog.md
浏览文件 @
1ec9b61c
## 1.0.7(2022-04-14)
修复 tableData = [] 时候一直显示loading状态:
tableData 为 Boolean类型时,显示 loading,空数组时候显示 无数据提示
## 1.0.6(2022-04-10)
设置不自动格式化数字:columns[i].formatNum = false ,默认true。
原有功能,文档写漏了配置,文档已更新!!!
...
...
uni_modules/n-table/components/n-table/n-table.vue
浏览文件 @
1ec9b61c
...
...
@@ -11,7 +11,7 @@
height: computedTableHeight.height,
minHeight: computedTableHeight.minHeight
}">
<view
v-if=
"!tableLoaded && (!dataList || !columns)"
class=
"ztableLoading n-loading"
>
<view
v-if=
"!tableLoaded && (!dataList || !columns)
&& showLoading
"
class=
"ztableLoading n-loading"
>
<view
class=
"n-loading-animate"
></view>
</view>
<view
class=
"n-table-container"
>
...
...
@@ -28,8 +28,6 @@
:isTree=
"isTree"
@
rowSort=
"onRowSort"
@
toggleTree=
"onToggleTree"
></table-header>
<!-- :height="_tableOpt.itemHeight" -->
<table-body
:isOpenAll=
"isOpenAll"
:isShowSum=
"_tableOpt.isShowSum"
...
...
@@ -47,8 +45,8 @@
</table-body>
</view>
</view>
<view
v-if=
"
dataList && dataList.length == 0 && !tableLoaded
"
class=
"table-empty"
>
<view
v-html=
"
showLoading ? '' :
_tableOpt.emptyText"
></view>
<view
v-if=
"
tableLoaded && !dataList.length
"
class=
"table-empty"
>
<view
v-html=
"_tableOpt.emptyText"
></view>
</view>
</view>
<!-- 内部分页处理 -->
...
...
@@ -83,7 +81,6 @@
return
{
nowSortKey
:
''
,
sortType
:
'
desc
'
,
// asc/desc 升序/降序
tableLoaded
:
false
,
dataList
:
[],
// 遍历显示的数据列表
saveDataList
:
[],
// 处理后的数据列表 - 用以备份 : 当分页形式无需重新计算
dataIndexs
:
[],
//
...
...
@@ -116,7 +113,7 @@
autoSort
:
{
type
:
Boolean
,
default
:
true
},
// 当前页
currentPage
:
{
type
:
[
Number
,
Boolean
],
default
:
false
},
currentPage
:
{
type
:
[
Number
,
Boolean
],
default
:
false
},
// 总页数
totalPage
:
{
type
:
Number
,
default
:
1
},
},
...
...
@@ -130,7 +127,7 @@
let
headerHeight
=
this
.
_headerOpt
.
height
return
{
height
:
this
.
tableHeight
?
uni
.
upx2px
(
this
.
tableHeight
-
nameHeight
-
pageHeight
)
+
'
px
'
:
'
100%
'
,
minHeight
:
this
.
tableHeight
?
'
auto
'
:
uni
.
upx2px
(
headerHeight
+
120
)
+
'
px
'
minHeight
:
this
.
tableHeight
?
'
auto
'
:
uni
.
upx2px
(
headerHeight
+
120
)
+
'
px
'
}
// return this.tableHeight ? 'height: ' + uni.upx2px(this.tableHeight - nameHeight - pageHeight) + 'px' : ''
},
...
...
@@ -167,6 +164,12 @@
minHeight
:
this
.
tableHeight
?
'
auto
'
:
uni
.
upx2px
(
nameHeight
+
pageHeight
+
headerHeight
+
120
)
+
'
px
'
}
},
// 表格数据是否已经加载
tableLoaded
()
{
let
res
=
typeof
this
.
tableData
===
'
boolean
'
?
false
:
true
return
res
}
},
watch
:
{
...
...
@@ -457,17 +460,23 @@
min-height
:
100%
;
width
:
fit-content
;
}
.table-empty
{
position
:
absolute
;
top
:
64rpx
;
height
:
64rpx
;
line-height
:
64rpx
;
top
:
0
;
left
:
0
;
z-index
:
0
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
border
:
none
;
height
:
100%
;
width
:
100%
;
text-align
:
center
;
background
:
transparent
;
pointer-events
:
none
;
color
:
#999
}
// 1.0.5
.n-loading
{
position
:
absolute
;
...
...
uni_modules/n-table/components/n-table/table-body.vue
浏览文件 @
1ec9b61c
...
...
@@ -13,8 +13,6 @@
v-for="(col, jIndex) in dataIndexs"
:key="jIndex" @click.stop="itemClick(row, col)">
<!-- 展开 -->
<!-- height: height ? height + 'rpx' : '64rpx',
lineHeight:height ? height + 'rpx' : '64rpx', -->
<view
class=
"open-child"
v-if=
"jIndex === 0"
...
...
@@ -74,7 +72,6 @@
name
:
'
tableBody
'
,
props
:
{
// 单元格高度
// height: { type: Number, default: 64 },
colKey
:
{
type
:
String
,
default
:
'
key
'
},
idKey
:
{
type
:
String
,
default
:
'
id
'
},
dataIndexs
:
{
type
:
Array
,
default
:
()
=>
[]
},
...
...
@@ -88,6 +85,10 @@
dataList
:
{
type
:
[
Array
,
Boolean
],
default
:
()
=>
[]
},
empty
:{
type
:
Boolean
,
default
:
false
}
},
data
()
{
...
...
uni_modules/n-table/package.json
浏览文件 @
1ec9b61c
{
"id"
:
"n-table"
,
"displayName"
:
"n-table 多级表头、树形结构,高度配置表格组件"
,
"version"
:
"1.0.
6
"
,
"version"
:
"1.0.
7
"
,
"description"
:
"n-table 多级表头、树形结构,高度配置表格组件"
,
"keywords"
:
[
"表格,多级表头,树形结构,可配置"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录