Commit d09a3b67ba536b6f08fd7d5a896b76dabdc960e9
1 parent
096f9b03
Exists in
master
and in
1 other branch
Scheme支持追加按钮
Showing
3 changed files
with
11 additions
and
3 deletions
Show diff stats
examples/views/docs/scheme.md
| ... | ... | @@ -11,6 +11,8 @@ Scheme是一个数æ®é©±åŠ¨çš„è§£å†³æ–¹æ¡ˆï¼Œé€šè¿‡æ—¢å®šçš„ä¸šåŠ¡é…ç½®å‚æ•°ï¼ |
| 11 | 11 | ```html |
| 12 | 12 | <template> |
| 13 | 13 | <eagle-scheme :list="schemeList"> |
| 14 | + <el-button slot="action-button" type="success" plain size="small">å¯ç”¨</el-button> | |
| 15 | + <el-button slot="action-button" type="danger" plain size="small">ç¦ç”¨</el-button> | |
| 14 | 16 | <el-table-column type="selection" width="50" align="center"></el-table-column> |
| 15 | 17 | <template #table-status="{ setDialog }"> |
| 16 | 18 | <el-table-column prop="status" label="激活状æ€" min-width="120"> | ... | ... |
packages/detail/index.vue
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | <el-col :key="index + 'data'" :span="!item.span ? span : item.span"> |
| 33 | 33 | <el-form-item :label="item.label" :label-width="item.label ? undefined : item.labelWidth || '0px'" :prop="item.key"> |
| 34 | 34 | <slot v-if="$scopedSlots[`item-${item.key}`] || $slots[`item-${item.key}`]" :name="`item-${item.key}`" :model="model" v-bind="item"></slot> |
| 35 | - <label v-else><b>{{ model[item.key] }}</b></label> | |
| 35 | + <label v-else>{{ model[item.key] }}</label> | |
| 36 | 36 | </el-form-item> |
| 37 | 37 | </el-col> |
| 38 | 38 | </template> | ... | ... |
packages/scheme/index.vue
| ... | ... | @@ -60,7 +60,8 @@ |
| 60 | 60 | <!-- 操作按钮栏 --> |
| 61 | 61 | <div v-if="!option.showActionBar" class="eagle-scheme__action" v-loading="tableLoading" element-loading-spinner="none" element-loading-background="rgba(255, 255, 255, 0.6)"> |
| 62 | 62 | <el-button class="eagle-scheme__action-btn" type="primary" size="small" @click="handleNew">新增</el-button> |
| 63 | - <el-button v-if="hasSelectionSlot" class="eagle-scheme__action-btn" plain size="small" @click="handleDelete('more')">删除</el-button> | |
| 63 | + <el-button v-if="hasSelectionSlot" :disabled="tableSelection && tableSelection.length <= 0" class="eagle-scheme__action-btn" plain size="small" @click="handleDelete('more')">删除</el-button> | |
| 64 | + <slot v-if="$scopedSlots['action-button'] || $slots['action-button']" name="action-button" class="eagle-scheme__action-btn" :model="formModel" :selection="tableSelection" :setDialog="setDialog"></slot> | |
| 64 | 65 | <div v-if="hasSelectionSlot && tableSelection && tableSelection.length > 0" class="eagle-scheme__action-btn eagle-scheme__text-selection">已选中<span class="eagle-scheme__text-selection-highlight">{{ tableSelection.length }}</span>项</div> |
| 65 | 66 | </div> |
| 66 | 67 | <div class="eagle-scheme__table"> |
| ... | ... | @@ -364,9 +365,14 @@ export default { |
| 364 | 365 | this.dialogType = ''; |
| 365 | 366 | }, |
| 366 | 367 | // 设置弹出框模式 |
| 367 | - setDialog({ title, type }) { | |
| 368 | + setDialog({ title, type, model }) { | |
| 368 | 369 | this.dialogTitle = title; |
| 369 | 370 | this.dialogType = type; |
| 371 | + if (model) { | |
| 372 | + Object.keys(model).forEach(key => { | |
| 373 | + this.formModel[key] = model[key]; | |
| 374 | + }); | |
| 375 | + } | |
| 370 | 376 | this.dialogVisible = true; |
| 371 | 377 | } |
| 372 | 378 | } | ... | ... |