代码拉取完成,页面将自动刷新
移动端高度自定义表格组件
组件名:
lyz-table
用于展示移动端高度自定义表格
目前仅支持 vue2 移动端
为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
npm i --save lyz-table
或
yarn add lyz-table
// main.js 注册全局
import lyzTable from 'lyz-table'
Vue.use(lyzTable)
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
title | String | 无 | 表格标题 |
columns | Array | [] | 表格配置项(详细配置参考下方说明) |
list | Array | [] | 表格数据列表 |
sticky | Boolean | false | 是否固定表头 |
插槽名 | 说明 | 返回参数 |
---|---|---|
nodata | 列表数据为空时展示插槽内容 | Slot&dom |
columns | 根据数据配置项中的key生成具名插槽可覆盖默认内容 | Slot&dom |
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
title | String | 无 | 列头显示文字 |
key | String | 无 | 列数据在数据项中对应的 key |
fixed | String | '' | 列是否固定, 'left' 'right' |
style | Object | {} | 列头样式与正常的内联写法一致(注:所有属性使用驼峰写法) |
columnStyle | Object | {} | 列样式与正常的内联写法一致(注:所有属性使用驼峰写法) |
columns 中的 style 默认是当前列生效(列头和列) 可以配置 columnStyle 来覆盖列头所产生的样式影响
<template>
<div >
<tableLyz style="padding: 0 34px 0 24px;" :columns="groupColumns" :list="groupList">
<template slot="nodata">暂无数据</template>
</tableLyz>
</div>
</template>
<script>
export default {
data () {
return {
groupList: [{
statTime: '111',
groupTotal: 11,
groupInc: 222,
groupCustomTotal: 2223,
groupCustomInc: 43,
groupCustomDec: 12
}, {
statTime: '111',
groupTotal: 11,
groupInc: 222,
groupCustomTotal: 2223,
groupCustomInc: 43,
groupCustomDec: 12
}, {
statTime: '111',
groupTotal: 11,
groupInc: 222,
groupCustomTotal: 2223,
groupCustomInc: 43,
groupCustomDec: 12
}, {
statTime: '111',
groupTotal: 11,
groupInc: 222,
groupCustomTotal: 2223,
groupCustomInc: 43,
groupCustomDec: 12
}, {
statTime: '111',
groupTotal: 11,
groupInc: 222,
groupCustomTotal: 2223,
groupCustomInc: 43,
groupCustomDec: 12
}],
groupColumns: [{
title: '日期',
key: 'statTime',
fixed: 'left',
style: {
width: '120px',
color: '#494949',
paddingLeft: '10px',
textAlign: 'center'
},
columnStyle: {
width: '120px',
color: 'pink',
}
},
{
title: '客户群总数',
key: 'groupTotal',
style: {
width: '200px',
color: '#494949'
}
},
{
title: '新增客户群',
key: 'groupInc',
style: {
width: '200px',
color: '#494949'
}
},
{
title: '客户群总人数',
key: 'groupCustomTotal',
style: {
width: '200px',
color: '#494949'
}
}, {
title: '客户群新增人数',
key: 'groupCustomInc',
style: {
width: '200px',
color: '#494949'
}
}, {
title: '退群客户数',
key: 'groupCustomDec',
style: {
width: '200px',
color: '#494949'
}
}
],
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。