<template> <div class="base-dialog"> <van-overlay :show="BaseDialogShow"> <div class="wrapper" @click.stop> <div class="content"> <van-icon v-if="BaseDialogShowClose" class="close-icon" name="close" size="30" @click="BaseDialogShow = false" /> <p v-if="BaseDialogTitle" class="title">{{ BaseDialogTitle }}</p> <slot name="content" /> <div class="content-submit-btn"> <van-button round @click="onBtn">{{ BaseDialogBtn }}</van-button> </div> </div> </div> </van-overlay> </div> </template> <script> export default { name: "BaseDialog", props: { BaseDialogShowClose: { type: Boolean, default: false }, BaseDialogShow: { type: Boolean, default: false }, BaseDialogTitle: { type: String, default: "" }, BaseDialogBtn: { type: String, default: "确定" } }, methods: { onBtn() { this.$emit("onClick"); } } }; </script> <style lang="scss" scoped> .wrapper { display: flex; align-items: center; justify-content: center; height: 100vh; } .content { position: relative; box-sizing: border-box; position: relative; width: 315px; height: 293px; background: #ffffff; border-radius: 4px; p { margin: 0; } .title { margin: 29px 0; text-align: center; font-size: 20px; color: #333333; } .close-icon { position: absolute; top: 0; right: 0; } .content-submit-btn { position: absolute; bottom: 31px; width: 100%; text-align: center; .van-button { width: 160px; color: #ffffff; font-size: 16px; background-color: #88c678; } } } </style>