fix: 修复自定义弹窗控制footer时的逻辑错误,改为默认显示保存和取消,增加custom-footer插槽来自定义footer,以使其更加灵活
This commit is contained in:
parent
b0499f0748
commit
42e1000c11
|
@ -1,10 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal :class="'custom-modal' + (innerFullscreen ? ' fullscreen' : '')" v-bind="_attrs" v-model="visible">
|
||||||
:class="'custom-modal' + (innerFullscreen ? ' fullscreen' : '')"
|
|
||||||
v-bind="_attrs"
|
|
||||||
v-model="visible"
|
|
||||||
:footer="null"
|
|
||||||
>
|
|
||||||
<img slot="closeIcon" src="@/assets/images/global/close.png" />
|
<img slot="closeIcon" src="@/assets/images/global/close.png" />
|
||||||
<div slot="title">
|
<div slot="title">
|
||||||
<div class="custom-modal-title">
|
<div class="custom-modal-title">
|
||||||
|
@ -16,10 +11,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
<a-space v-if="showFooter" class="operators" :size="20">
|
<template slot="footer">
|
||||||
|
<slot name="custom-footer"></slot>
|
||||||
|
<a-space v-if="!hasCustomFooter" class="operators" :size="20">
|
||||||
<a-button type="success" @click="onSave" :loading="confirmLoading">Save</a-button>
|
<a-button type="success" @click="onSave" :loading="confirmLoading">Save</a-button>
|
||||||
<a-button type="warn" @click="onCancel">Cancel</a-button>
|
<a-button type="warn" @click="onCancel">Cancel</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
|
</template>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -34,10 +32,6 @@ export default {
|
||||||
title: {
|
title: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
showFooter: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
enableFullScreen: {
|
enableFullScreen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
@ -92,6 +86,11 @@ export default {
|
||||||
attrs['width'] = '100%'
|
attrs['width'] = '100%'
|
||||||
}
|
}
|
||||||
return attrs
|
return attrs
|
||||||
|
},
|
||||||
|
|
||||||
|
// 是否有自定义的footer
|
||||||
|
hasCustomFooter() {
|
||||||
|
return !!this.$slots['custom-footer']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user