Commit ea8aebc29db76733d30c72ab5037d400b749b60f

Authored by Aaron
1 parent 330a169f
Exists in master and in 1 other branch legacy

Scheme组件表格支持自定义

examples/views/docs/scheme.md
@@ -10,7 +10,7 @@ Scheme是一个数æ®é©±åŠ¨çš„è§£å†³æ–¹æ¡ˆï¼Œé€šè¿‡æ—¢å®šçš„ä¸šåŠ¡é…ç½®å‚æ•°ï¼ @@ -10,7 +10,7 @@ Scheme是一个数æ®é©±åŠ¨çš„è§£å†³æ–¹æ¡ˆï¼Œé€šè¿‡æ—¢å®šçš„ä¸šåŠ¡é…ç½®å‚æ•°ï¼
10 10
11 ```html 11 ```html
12 <template> 12 <template>
13 - <eagle-scheme :list="schemeList"> 13 + <eagle-scheme :list="schemeList" :option="{ auto: false }">
14 <!-- <div slot="action-bar" slot-scope="{ handleNew }"> 14 <!-- <div slot="action-bar" slot-scope="{ handleNew }">
15 <el-button type="warn" @click="handleNew">新增</el-button> 15 <el-button type="warn" @click="handleNew">新增</el-button>
16 </div> --> 16 </div> -->
packages/scheme/index.vue
@@ -46,7 +46,6 @@ @@ -46,7 +46,6 @@
46 margin-right: 0px !important; 46 margin-right: 0px !important;
47 } 47 }
48 .eagle-scheme__pagination { 48 .eagle-scheme__pagination {
49 - text-align: right;  
50 padding-top: 10px; 49 padding-top: 10px;
51 } 50 }
52 .eagle-scheme__dialog .el-dialog__body { 51 .eagle-scheme__dialog .el-dialog__body {
@@ -77,8 +76,14 @@ @@ -77,8 +76,14 @@
77 </template> 76 </template>
78 </div> 77 </div>
79 <div class="eagle-scheme__table"> 78 <div class="eagle-scheme__table">
  79 + <slot v-if="$scopedSlots['table'] || $slots['table']" name="table"
  80 + v-bind="{ ...slotMethod, list: _tableList, value: tableData, loading: tableLoading,
  81 + tableProps: { border: true, 'row-key': 'id', ...tableProps },
  82 + tableEvents: { 'selection-change': handleTableSelectionChange, ...tableEvents }
  83 + }"
  84 + ></slot>
80 <!-- 表格 --> 85 <!-- 表格 -->
81 - <eagle-table ref="eagle-table" :list="_tableList" :value="tableData" 86 + <eagle-table v-else ref="eagle-table" :list="_tableList" :value="tableData"
82 v-loading="tableLoading" 87 v-loading="tableLoading"
83 element-loading-background="rgba(255, 255, 255, 0.6)" 88 element-loading-background="rgba(255, 255, 255, 0.6)"
84 :tableProps="{ border: true, 'row-key': 'id', ...tableProps }" 89 :tableProps="{ border: true, 'row-key': 'id', ...tableProps }"
@@ -117,7 +122,7 @@ @@ -117,7 +122,7 @@
117 </el-table-column> 122 </el-table-column>
118 </eagle-table> 123 </eagle-table>
119 <!-- 分页器 --> 124 <!-- 分页器 -->
120 - <div v-if="option.showPagination !== false" class="eagle-scheme__pagination"> 125 + <div v-if="option.showPagination !== false" class="eagle-scheme__pagination" :style="{ 'text-align': paginationProps.textAlign || 'right' }">
121 <el-pagination size="small" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" v-loading="tableLoading" element-loading-spinner="none" element-loading-background="rgba(255, 255, 255, 0.6)" 126 <el-pagination size="small" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" v-loading="tableLoading" element-loading-spinner="none" element-loading-background="rgba(255, 255, 255, 0.6)"
122 :page-size="pageSize" :total="totalCount" v-bind="{ 'page-sizes': [10, 20, 50], layout: 'total, sizes, prev, pager, next, jumper', ...paginationProps }"></el-pagination> 127 :page-size="pageSize" :total="totalCount" v-bind="{ 'page-sizes': [10, 20, 50], layout: 'total, sizes, prev, pager, next, jumper', ...paginationProps }"></el-pagination>
123 </div> 128 </div>
@@ -267,7 +272,7 @@ export default { @@ -267,7 +272,7 @@ export default {
267 }, 272 },
268 mounted() { 273 mounted() {
269 // 设置自动加载数据 274 // 设置自动加载数据
270 - if (!this.option.auto) { 275 + if (this.option.auto !== false) {
271 this.handleSearch(); 276 this.handleSearch();
272 } 277 }
273 }, 278 },