APICloud AVM框架封装数据表格组件

33 阅读1分钟

用以展示基础表格数据的组件。

组件的核心功能点是在数据展示的时候,用到了2个v-for循环,第一层循环是数据对象的循环,然后嵌套列名的对象,通过列名中的key值在数据对象中查询对应的数据,这样就保证了在数据对象与列名对象顺序打乱的情况下也可以把数据对应起来,并能够在列名没有对应的数据的时候进行特殊处理。以APICloud AVM框架封装数据表格组件为例。

\

组件文件

easy-data-grid.stml

\

.easy-data-grid_header{ flex-flow: row nowrap; justify-content: space-between; align-items: center; width: 100%; } .easy-data-grid_header-item{ background-color: #cccccc; text-align: center; justify-content: center; flex-flow: row nowrap; padding: 5px; width: 20%; } .easy-data-grid_header-item-content{ font-size: 15px; font-weight: bolder; } .easy-data-grid_tbody{ height: 200px; } .easy-data-grid_tbody-item{ flex-flow:  row nowrap; justify-content: center; align-items: center; border-bottom: 0.5px solid #cccccc; padding: 5px 0; width: 100%; } .easy-data-grid_tbody-item-columns{ flex-flow:  row nowrap; text-align: center; width: 20%; justify-content: center; } .easy-data-grid_tbody-item-content{ font-size: 14px; }

\

组件使用

demo-easy-data-grid.stml

\

.page { height: 100%; background-color: #f0f0f0; }

\