Skip to content

Commit

Permalink
refactor: metable命名修复
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayun zhang committed Sep 19, 2022
1 parent eb5a77d commit eec04d3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/meTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</ul>
</template>
</el-popover>
<el-button v-if="print" icon="mel-icon-printer" :title="$t('打印')" @click="printTable(elTable, name)" />
<el-button v-if="print" icon="mel-icon-printer" :title="$t('打印')" @click="printTable(elTableRef, name)" />
<slot name="tools"></slot>
</el-button-group>
<el-button v-if="$slots.search" :title="$t('更多筛选')" @click="showSearch = !showSearch">
Expand All @@ -67,7 +67,7 @@
</div>
</div>
</div>
<el-table v-bind="$attrs" ref="elTable" v-loading="loading">
<el-table v-bind="$attrs" ref="elTableRef" v-loading="loading">
<component :is="customColumnProps.children"></component>
<template #append>
<slot name="append"></slot>
Expand Down Expand Up @@ -180,9 +180,9 @@ export default defineComponent<
customColumnProps.value!.checkedLabels.delete(data.value);
}
};
const elTable = ref<ELTable>();
const elTableRef = ref<ELTable>();
onMounted(() => {
elTable.value!.getSelectionIndexs = function () {
elTableRef.value!.getSelectionIndexs = function () {
const index = [] as number[];
if (this.data) {
this.getSelectionRows()?.forEach((item: unknown) => {
Expand All @@ -192,24 +192,24 @@ export default defineComponent<
return index;
};
});
expose({ elTable, customColumnProps });
expose({ elTable: elTableRef, customColumnProps });
return {
showSearch,
searchText,
customColumnProps,
checkedLabels,
checkChange,
elTable,
elTableRef,
exportTable,
printTable,
handleExport: (
handle: (elTable: ELTable, filename: string) => void | 'xls' | 'txt' | 'csv',
filename: string,
) => {
if (typeof handle === 'string') {
exportTable(elTable.value!, handle, filename);
exportTable(elTableRef.value!, handle, filename);
} else {
handle(elTable.value!, filename);
handle(elTableRef.value!, filename);
}
},
};
Expand Down

0 comments on commit eec04d3

Please sign in to comment.