您的位置:首页 > 汽车 > 时评 > 室内装修设计软件app_如何利用网站赚钱_聚合搜索引擎_深圳市文化广电旅游体育局

室内装修设计软件app_如何利用网站赚钱_聚合搜索引擎_深圳市文化广电旅游体育局

2025/4/27 21:49:04 来源:https://blog.csdn.net/kuangshp128/article/details/147542310  浏览:    关键词:室内装修设计软件app_如何利用网站赚钱_聚合搜索引擎_深圳市文化广电旅游体育局
室内装修设计软件app_如何利用网站赚钱_聚合搜索引擎_深圳市文化广电旅游体育局

一、基本步骤

  • 1、最终运行效果
    在这里插入图片描述

  • 2、具体代码实现

    <template><Teleport to="body"><Transition name="modal-fade"><div class="modal" ref="modalRef" v-show="visible" tabindex="-1" @keyup.esc="onEsc()"><div class="mask" @click="onClickMask()"></div><Transition name="modal-zoom" @afterLeave="contentVisible = false" @before-enter="contentVisible = true"><div class="modal-content" v-show="visible" :style="contentStyle"><div class="modal-header"><template v-if="isHeader"><slot name="title"></slot></template><template v-else>{{ title }}</template><span class="close-btn" v-if="closeButton" @click="close()">x</span></div><div class="modal-body"><slot v-if="contentVisible"></slot></div><div class="modal-footer" v-if="isFooter"><slot name="footer"></slot></div></div></Transition></div></Transition></Teleport>
    </template><script lang="js" setup>
    import { computed, defineProps, nextTick, ref, watch ,useSlots} from 'vue';const isHeader = !!useSlots().title;
    const isFooter = !!useSlots().footer;
    const props = defineProps({title: {type: String,default: '',},visible: {type: Boolean,required: true,},width: {type: Number,default: 480,},closeButton: {type: Boolean,default: true,},closeOnClickMask: {type: Boolean,default: true,},closeOnEsc: {type: Boolean,default: true,},contentStyle: {type: Object,default: () => ({}),},
    });const modalRef = ref();const emit = defineEmits(['update:visible', 'closed']);const contentVisible = ref(false);const contentStyle = computed(() => {return {width: props.width + 'px',...(props.contentStyle || {}),};
    });watch(() => props.visible,() => {if (props.visible) {nextTick(() => modalRef.value.focus());}}
    );const close = () => {emit('update:visible', false);emit('closed');
    };const onEsc = () => {if (props.visible && props.closeOnEsc) close();
    };const onClickMask = () => {if (props.closeOnClickMask) close();
    };
    </script><style lang="scss" scoped>
    .modal,
    .mask {top: 0;left: 0;width: 100%;height: 100%;z-index: 5000;
    }.modal {position: fixed;display: flex;justify-content: center;align-items: center;outline: 0;border: 0;
    }.mask {position: absolute;background: rgba(0, 0, 0, 0.25);
    }.modal-content {z-index: 5001;background: #fff;border-radius: 2px;overflow: hidden;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);.modal-header {width: 100%;height: 48px;padding: 0 20px;box-sizing: border-box;font-size: 16px;font-weight: 500;color: #1d2129;line-height: 48px;border-bottom: 1px solid #e5e6eb;position: relative;display: flex;flex-direction: row;align-items: center;.close-btn {width: 20px;height: 20px;display: flex;justify-content: center;align-items: center;position: absolute;top: 16px;right: 16px;cursor: pointer;}}.modal-body {padding: 20px;box-sizing: border-box;}.modal-footer {border-top: 1px solid #e5e6eb;padding: 16px 20px;display: flex;flex-direction: row;justify-content: flex-end;align-items: center;}
    }.modal-fade-enter-active {animation: modal-fade-enter 0.25s both ease-in;
    }
    .modal-fade-leave-active {animation: modal-fade-leave 0.25s both ease-out;
    }
    .modal-zoom-enter-active {animation: modal-zoom-enter 0.25s both cubic-bezier(0.4, 0, 0, 1.5);
    }
    .modal-zoom-leave-active {animation: modal-zoom-leave 0.25s both;
    }@keyframes modal-fade-enter {from {opacity: 0;}
    }
    @keyframes modal-fade-leave {to {opacity: 0;}
    }
    @keyframes modal-zoom-enter {from {transform: scale3d(0.3, 0.3, 0.3);}
    }
    @keyframes modal-zoom-leave {to {transform: scale3d(0.3, 0.3, 0.3);}
    }
    </style>
    
  • 3、使用组件的时候

<Modal title="导出" :visible="!!dialogForExport" @closed="closeExportDialog()"><template #title>你好</template><h1>你好</h1><template #footer><button @click="dialogForExport = false">关闭</button></template></Modal>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com