💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
// 模态框组件,统一化,方便管理 ~~~ <template> <Modal v-model="show" v-bind="$attrs" v-on="$listeners"> <div slot="header" class="modal-header"> <span class="title">{{ $attrs.title }}</span> </div> <slot></slot> <div slot="footer" class="modal-footer"> <ErsButton type="primary" class="close-btn" @click="handleClose" >取消</ErsButton > <ErsButton @click="handleConfirm" :loading="loading" :disabled="isDisabled" >确定</ErsButton > </div> </Modal> </template> <script> export default { inheritAttrs: false, name: "ErsModal", props: { // 弹窗标题 // modalTitle: { // type: String, // default: () => "" // }, // v-model value: { type: Boolean, default: () => false }, // 点击确定后,是否在外部控制弹窗消失 closeByOuter: { type: Boolean, default: () => false }, loading: { type: Boolean, default: () => false }, isDisabled: { type: Boolean, default: () => false } }, data() { return { show: this.value }; }, watch: { show(n) { this.$emit("input", n); }, value(n) { this.show = n; } }, methods: { handleClose() { this.$emit("on-close"); this.show = false; }, handleConfirm() { this.$emit("on-confirm"); if (!this.closeByOuter) { this.show = false; } } } }; </script> <style scoped lang="scss"> .modal-header { .title { @include scw(1.04rem, #ffffff, 700); } } // .modal-footer { // .close-btn { // display: inline-block; // vertical-align: middle; // @include TBase; // cursor: pointer; // margin-right: 2rem; // &:hover { // color: $primary-color; // } // } // } </style> ~~~