Skip to content

Commit

Permalink
feat: 补充ProTable rowKey属性
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Jan 24, 2021
1 parent 1011aa2 commit 9f91d3a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/component/crud-table/src/CrudTable.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<!--
* @file:
* @author: BoBo
* @copyright: NanJing Anshare Tech .Com
* @Date: 2021-01-20 10:00:48
-->
<!--
* @file: el-table CrudTable封装,支持高级查询 分页 增删改查表单
* @copyright: BoBo
Expand All @@ -18,6 +12,7 @@
<ProTable v-bind="$attrs"
v-on="$listeners"
ref="table"
:rowKey="rowKey"
@selection-change="handleSelectionChange"
:visibleList="view"
:columns="tableConfig"
Expand Down Expand Up @@ -163,6 +158,12 @@ export default class CrudTable extends Vue {
})
listField!: string;

@Prop({
type: Function,
default: row => row.id,
})
rowKey!: any;

// 设置只读
@Prop({ default: false, type: Boolean }) readOnly!: any;

Expand Down
3 changes: 2 additions & 1 deletion src/demo/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</el-link>
</div>
</el-header>

<el-main class="content">
<el-container class="container">
<el-header>表格设计器(TableDesigner)</el-header>
Expand Down Expand Up @@ -295,6 +296,7 @@ import CusDialog from '@/component/common/CusDialog.vue';
import PersonCrudTable from './component/PersonCrudTable.vue';
import PersonProTable from './component/PersonProTable.vue';


export default {
name: 'app',
methods: {
Expand All @@ -316,7 +318,6 @@ export default {
// 保存设计
btnSaveOnClick() {
const formValues = this.$refs.formDesigner.getData();
console.log(formValues);
},
initFormJson() {
getFormDetail('person').then((res) => {
Expand Down
8 changes: 8 additions & 0 deletions src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ export interface columnConfig {
sortable: 'false' | 'custom' // 是否可排序
searchable: boolean // 是否可查询
}

export interface fn {
(...args: any[]): any
}

export interface AnyObject {
[key: string]: any
}

0 comments on commit 9f91d3a

Please sign in to comment.