基于Vue和Quasar的前端SPA项目实战联合索引(11)回顾通过上篇文章基础关于Vue和Quasar的前端SPA项目实战动态表单介绍(五),表单元数据配置相关的内容已经实现,本文主要介绍联合索引功能的实现。简介联合索引也称为复合索引。如果索引只有一个字段,在设置列属性时直接设置即可。如果是多个字段的联合索引,需要单独设置。这里可以创建通用或唯一的联合索引,通过下拉框选择多个字段。当然,如果索引只有一个字段,也可以通过联合索引函数来设置。由于UI界面索引管理的核心代码在创建和编辑表格单元数据时使用了联合索引功能,所以将其封装成名为CIndexList的组件组件,可以重复使用,避免代码冗余。CIndexList组件CIndexList通过getData方法获取索引内容getData(){letnewIndexs=[];this.table.indexs.forEach(function(item){constnewIndexLines=[];item.columns.forEach(function(column){newIndexLines.push({column:{id:column.id,name:column.name}})});constnewIndex={id:item.id,isNewRow:item.isNewRow,caption:item.caption,description:item.description,indexStorage:item.indexStorage,indexType:item.indexType,name:item.name,indexLines:newIndexLines}newIndexs.push(newIndex);});letdata={indexes:newIndexs}returndata;}应用在createandeditedapagethatcanbereferencedby
