增加多级表头

This commit is contained in:
zouzhibing
2022-04-14 16:16:53 +08:00
parent da87dab7d6
commit 594446795f
20 changed files with 361 additions and 42 deletions

47
.idea/workspace.xml generated
View File

@@ -1,12 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="be7958c3-0d1c-4f74-a433-b590462e7034" name="Default Changelist" comment="修改 回显问题">
<change beforePath="$PROJECT_DIR$/uni_modules/zb-table/changelog.md" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/zb-table/changelog.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uni_modules/zb-table/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/zb-table/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uni_modules/zb-table/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/zb-table/readme.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-alipay/app.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-alipay/app.json" afterDir="false" />
<list default="true" id="be7958c3-0d1c-4f74-a433-b590462e7034" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/assets/1.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/all.js" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/all.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uni_modules/zb-table/components/zb-table/components/table-header-item.vue" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/zb-table/components/zb-table/components/table-header-item.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uni_modules/zb-table/components/zb-table/zb-table.vue" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/zb-table/components/zb-table/zb-table.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-card/components/uni-card/uni-card.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-card/components/uni-card/uni-card.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/app.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/app.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/common/runtime.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/common/runtime.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/common/vendor.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/common/vendor.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/pages/index/index.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/project.config.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/project.config.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/uni-card/components/uni-card/uni-card.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/uni-card/components/uni-card/uni-card.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/uni-card/components/uni-card/uni-card.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/uni-card/components/uni-card/uni-card.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-checkbox.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-h5-summary.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-side-summary.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/table-summary.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/components/zb-load-more.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.js" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.json" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/unpackage/dist/dev/mp-weixin/uni_modules/zb-table/components/zb-table/zb-table.wxss" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

237
assets/1.vue Normal file
View File

@@ -0,0 +1,237 @@
<template>
<view
:style="{
flex:(wrapIndex===transColumns.length-1||(multify.length&&isMulitiLastLength))?1:'none',
flexDirection:multify.length?'column':'row'
}"
class="zb__item-inner"
>
<view
:style="[{
width:`${item.width?item.width+'px':'100%'}`,
flex:(index===transColumns.length-1)?1:'none',
minWidth:`${item.width?item.width:'100'}px`,
// borderBottom:`${border?'1px solid #e8e8e8':''}`,
justifyContent:textPosition(item),
// borderRight:`${border?'1px solid #e8e8e8':''}`,
<!-- #ifdef H5 || APP-PLUS -->
borderRight:`${(scrollbarSize&&wrapIndex===transColumns.length-1)?'':border?'1px solid #e8e8e8':''}`,
<!-- #endif -->
},getCellStyle(item,wrapIndex)]"
class="zb__inner-children"
>
<view
@click.stop="sortAction(item,index)"
class="item-th"
:style="{
// borderRight:`${border?'1px solid #e8e8e8':''}`,
borderBottom:`${border?'1px solid #e8e8e8':''}`,
}"
>
<template v-if="item.type==='selection'">
<view class="item-content" style="width: 100%">
<view class="checkbox-item">
<tableCheckbox
:indeterminate="indeterminate" :checked="checkedAll" @checkboxSelected="checkboxSelectedAll"></tableCheckbox>
</view>
</view>
</template>
<template v-else>
<view class="item-content" >
{{ item.label ||''}}
<view class="sorter-table" v-if="item.sorter">
<view :class="['sorter-table-icon',item.sorterMode==='_asc'&&`sorting${item.sorterMode||''}`]"></view>
<view :class="['sorter-table-icon',item.sorterMode==='_desc'&&`sorting${item.sorterMode||''}`]"></view>
</view>
</view>
</template>
</view>
<view class="item-children" v-if="item.children&&item.children.length">
<table-header-item
:item="ite"
@sortAction="sortAction"
:border="border"
wrapIndex="no"
@checkboxSelectedAll="checkboxSelectedAll"
:indeterminate="indeterminate"
:checkedAll="checkedAll"
:transColumns="transColumns"
:index='`${i}-1-${index}`'
:key='i'
:multify="multify"
:isMulitiLastLength="(item.children.length-1)===i"
:scrollbarSize="scrollbarSize"
v-for="(ite,i) in item.children"/>
</view>
</view>
</view>
</template>
<script >
import TableCheckbox from './table-checkbox.vue'
import TableHeaderItem from './table-header-item.vue'
export default {
name:'tableHeaderItem',
components:{
TableHeaderItem,
TableCheckbox
},
props:{
item:{
type:Object,
default:()=>{}
},
cellHeaderStyle:Function,
formatter:Function,
multify:{
type:Array,
default:()=>[]
},
isMulitiLastLength:{
type:Boolean,
default:false
},
border:{
type:Boolean,
default:false
},
indeterminate:Boolean,
checkedAll:Boolean,
transColumns:{
type:Array,
default:()=>[]
},
scrollbarSize:{
type:Number,
default:0
},
realColumns:{
type:Array,
default:()=>[]
},
index:[Number,String],
wrapIndex:[Number,String],
childIndex:[Number,String],
fixedLeftColumns:{
type:Array,
default:()=>[]
}
},
computed:{
textPosition(){
return(item)=>{
if(item.align==='right') return 'flex-end'
if(item.align==='left') return 'flex-start'
if(item.align==='center') return 'center'
}
},
getCellStyle() {
return (column, columnIndex,childIndex)=>{
const cellStyle = this.cellHeaderStyle;
if(typeof cellStyle==='function'){
return cellStyle({ column, columnIndex})
}
return {}
}
},
},
data(){
return{
}
},
methods:{
sortAction(item,index){
this.$emit('sortAction',item,index)
},
checkboxSelectedAll(e){
this.$emit('checkboxSelectedAll',e)
}
}
}
</script>
<style lang="scss" scoped>
.zb-stick-side{
position: sticky;
top: 0;
left: 0;
z-index: 2;
//border-right: solid 1rpx #dbdbdb;
box-sizing: border-box;
background: #fafafa;
//box-shadow: 6px 0 6px -4px #ccc;
}
.zb__item-inner{
/* #ifndef H5 || APP-PLUS */
height: 100%;
/* #endif*/
display: flex;
flex-direction: column;
.zb__inner-children{
height: 100%;
display: flex;
box-sizing: border-box;
justify-content: center;
flex-direction: column;
}
.item-th{
//height: 100%!important;
position: relative;
display: flex;
background: #fafafa;
align-items: center;
box-sizing: border-box;
.item-content{
height: 40px;
padding-left: 8px;
padding-right: 20px;
display: flex;
align-items: center;
box-sizing: border-box;
}
}
.sorter-table{
position: absolute;
right: 6px;
top:50%;
transform:translateY(-50%);
.sorter-table-icon{
width: 0;
height: 0;
color: #dcdcdc;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
.sorter-table-icon:first-child{
border-bottom: 5px solid currentColor;
}
.sorter-table-icon:last-child{
margin-top: 1.5px;
border-top: 5px solid currentColor;
}
.sorting_desc{
color: #2979ff;
}
.sorting_asc{
color: #2979ff;
}
}
.checkbox-item{
display: flex;align-items: center;justify-content: center;width: 100%;height: 100%
}
.item-children{
display: flex;
}
}
</style>

View File

@@ -12,7 +12,14 @@ export const column5 = [
{ name: 'zip', label: '邮编' },
]
},
{
label: '配送信息',
children:[
{ name: 'province', label: '省份',width:130 },
{ name: 'city', label: '城市' },
{ name: 'zip', label: '邮编' },
]
},
]

View File

@@ -5,12 +5,12 @@
flexDirection:multify.length?'column':'row'
}"
class="zb__item-inner"
>
<view
@click.stop="sortAction(item,index)"
class="item-th"
:style="[{
height:item.muilty?'100%':'auto',
width:`${item.width?item.width+'px':'100%'}`,
flex:(index===transColumns.length-1)?1:'none',
minWidth:`${item.width?item.width:'100'}px`,
@@ -49,7 +49,7 @@
:item="ite"
@sortAction="sortAction"
:border="border"
wrapIndex=""
wrapIndex="no"
@checkboxSelectedAll="checkboxSelectedAll"
:indeterminate="indeterminate"
:checkedAll="checkedAll"
@@ -169,7 +169,7 @@
display: flex;
flex-direction: column;
.item-th{
height: 100%!important;
//height: 100%!important;
position: relative;
display: flex;
background: #fafafa;

View File

@@ -64,7 +64,7 @@
<view
:style="[{
width:`${ite.width?ite.width:'100'}px`,
flex:i===transColumns.columns.length-1?1:'none',
flex:i===transColumns.realColumns.length-1?1:'none',
minWidth:`${ite.width?ite.width:'100'}px`,
borderRight:`${border?'1px solid #e8e8e8':''}`,
textAlign:ite.align||'left',
@@ -302,7 +302,7 @@
:style="[{
left:`${ite.left}px`,
width:`${ite.width?ite.width:'100'}px`,
flex:i===transColumns.columns.length-1?1:'none',
flex:i===transColumns.realColumns.length-1?1:'none',
minWidth:`${ite.width?ite.width:'100'}px`,
borderRight:`${border?'1px solid #e8e8e8':''}`,
textAlign:ite.align||'left',
@@ -555,6 +555,9 @@ export default {
}
let number = 0
this.columns.forEach((item,index)=>{
if(!(item.children&&item.children.length)){
item.muilty = true
}
if(item.type==="operation"&&item.renders&&!item.width){
let str = ''
item.renders.map((item)=>{
@@ -574,6 +577,7 @@ export default {
item.emptyString = item.emptyString||'--'
})
let realColumns = this.renderRealColumns(this.columns)
console.log('===========',this.columns)
return {
columns:this.columns,
realColumns:realColumns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -10,5 +10,6 @@
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"usingComponents": {}
"usingComponents": {},
"sitemapLocation": "sitemap.json"
}

View File

@@ -2110,9 +2110,16 @@ var column5 = [
children: [
{ name: 'province', label: '省份', width: 130 },
{ name: 'city', label: '城市' },
{ name: 'zip', label: '邮编' }] }];exports.column5 = column5;
{ name: 'zip', label: '邮编' }] },
{
label: '配送信息',
children: [
{ name: 'province', label: '省份', width: 130 },
{ name: 'city', label: '城市' },
{ name: 'zip', label: '邮编' }] }];exports.column5 = column5;

View File

@@ -322,12 +322,6 @@ __webpack_require__.r(__webpack_exports__);
@@ -503,16 +497,16 @@ var _all = __webpack_require__(/*! ./all.js */ 16); //
//
//
//
//
//
//
//
//
//
var that = null;var _default = { components: {}, data: function data() {return { column1: _all.column1, column2: _all.column2, column3: _all.column3, column4: _all.column4, column5: _all.column5, title: 'Hello', column: [{ type: 'selection', fixed: true, width: 60 }, { name: 'name', label: '姓名', fixed: true, width: 80, emptyString: '--' }, { name: 'age', label: '年龄', sorter: 'custom', align: 'right', fixed: false, formatter: true }, { name: 'sex', label: '性别', filters: { 0: '男', 1: '女' } }, { name: 'price', label: '价格', sorter: true }, { name: 'admin', label: '账号' }, { name: 'address', label: '地址' }, { name: 'date', label: '日期', sorter: true }, { name: 'province', label: '省份' }, { name: 'city', label: '城市' }, { name: 'zip', label: '邮编' }, { name: 'img', label: '图片', type: "img", align: "center" }, { name: 'operation', type: 'operation', label: '操作', renders: [{ name: '编辑', class: 'edit', type: "primary", func: 'edit' // func 代表子元素点击的事件 父元素接收的事件 父元素 @edit
}, { name: '自定义按钮', type: 'custom', // type 为custom的时候自定义按钮
class: "custom", func: 'custom' }, { name: '删除', type: 'warn', // type 为custom的时候自定义按钮
class: "del", func: 'dele' }] }], data: [{ date: '2016-05-02', name: '', price: 0, province: '上海', admin: "admin", sex: '1', checked: true, id: "20", img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", age: 0, city: '普陀区', address: '上海市普上海市普上海市普上海市普', zip: 200333 }, { date: '2016-05-01', name: '王小虎2', province: '上海', sex: '0', price: 0, id: "2", age: 12, city: '普陀区', img: "https://img.pddpic.com/mms-material-img/2020-11-27/84c7fad3-d945-4e71-ab09-7a1ed80f6055.jpeg.a.jpeg", address: '上海市普', zip: 200333 }, { date: '2022-03-25T09:27:42', name: '王小虎3', province: '上海', sex: 1, price: 33, id: "3", age: '15', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 200333555 }, { date: '2016-04-02', name: '王小虎4', province: '上海', sex: 1, age: '11', price: 33, id: "4", img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2016-03-02', name: '王小虎5', province: '上海', price: 0, sex: 1, age: '14', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", id: "5", city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2014-05-02', name: '王小虎6', province: '上海', price: 33, sex: 1, id: "6", age: '12', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 0 }, { date: '2019-05-02', name: '王小虎7', price: 33, province: '上海', sex: 1, age: 0, id: "7", city: '普陀区', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", address: '上海市普', zip: 200333 }, { date: '2012-05-02', name: '王小虎8', province: '上海', price: 0, sex: 1, age: '29', id: "8", city: '普陀区', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", address: '上海市普', zip: 200333 }, { date: '2011-05-02', name: '王小虎91', price: 33, img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", province: '上海', sex: 1, id: "9", age: '30', city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2011-05-02', name: '王小虎10', province: '上海', sex: 1, id: "10", age: '30', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2011-05-02', name: '王小虎20', province: '上海', sex: 1,
class: "del", func: 'dele' }] }], data: [{ date: '2016-05-02', name: '', price: 0, province: '上海', admin: "admin", sex: '1', checked: true, id: "20", img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", age: 0, city: '普陀区', address: '上海市普上海市普上海市普上海市普', zip: 200333 }, { date: '2016-05-01', name: '王小虎2', province: '上海', sex: '0', price: 0, id: "2", age: 12, city: '普陀区', img: "https://img.pddpic.com/mms-material-img/2020-11-27/84c7fad3-d945-4e71-ab09-7a1ed80f6055.jpeg.a.jpeg", address: '上海市普', zip: 200333 }, { date: '2022-03-25T09:27:42', name: '王小虎3', province: '上海', sex: 1, price: 33, id: "3", age: '15', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 200333555 }, { date: '2016-04-02', name: '王小虎4', province: '上海', sex: 1, age: '11', price: 33, id: "4", img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2016-03-02', name: '王小虎5', province: '上海', price: 0, sex: 1, age: '14', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", id: "5", city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2014-05-02', name: '王小虎6', province: '上海', price: 33, sex: 1, id: "6", age: '12', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普', zip: 0 }, { date: '2019-05-02', name: '王小虎7', price: 33, province: '上海', sex: 1, age: 0, id: "7", city: '普陀区', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", address: '上海市普', zip: 200333 }, { date: '2012-05-02', name: '王小虎8', province: '上海', price: 0, sex: 1, age: '29', id: "8", city: '普陀区', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", address: '上海市普', zip: 200333 }, { date: '2011-05-02', name: '王小虎91', price: 33, img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", province: '上海', sex: 1, id: "9", age: '30', city: '普陀区', address: '上海市普', zip: 200333 }, { date: '2011-05-02', name: '王小虎10', province: '上海', sex: 1, id: "10", age: '30', img: "https://img1.baidu.com/it/u=300787145,1214060415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", city: '普陀区', address: '上海市普',
zip: 200333 },
{
date: '2011-05-02',
name: '王小虎20',
province: '上海',
sex: 1,
price: 33,
id: "11",
age: '30',

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,39 @@
"ignore": []
},
"setting": {
"urlCheck": false
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false
},
"compileType": "miniprogram",
"libVersion": "",
@@ -12,19 +44,15 @@
"projectname": "zzb-table",
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}

View File

@@ -95,7 +95,7 @@ var render = function() {
{
left: ite.left + "px",
width: (ite.width ? ite.width : "100") + "px",
flex: i === _vm.transColumns.columns.length - 1 ? 1 : "none",
flex: i === _vm.transColumns.realColumns.length - 1 ? 1 : "none",
minWidth: (ite.width ? ite.width : "100") + "px",
borderRight: "" + (_vm.border ? "1px solid #e8e8e8" : ""),
textAlign: ite.align || "left"
@@ -766,6 +766,9 @@ var _util = __webpack_require__(/*! ./js/util */ 42);function _interopRequireDef
}
var number = 0;
this.columns.forEach(function (item, index) {
if (!(item.children && item.children.length)) {
item.muilty = true;
}
if (item.type === "operation" && item.renders && !item.width) {
var str = '';
item.renders.map(function (item) {
@@ -785,6 +788,7 @@ var _util = __webpack_require__(/*! ./js/util */ 42);function _interopRequireDef
item.emptyString = item.emptyString || '--';
});
var realColumns = this.renderRealColumns(this.columns);
console.log('===========', this.columns);
return {
columns: this.columns,
realColumns: realColumns };