123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <script setup name="Dialog">
- defineProps({
- show: {
- type: Boolean,
- default: false
- },
- title: {
- type: String,
- default: '标题名称'
- },
- message: {
- default: '这是一段内容'
- },
- close: {
- type: Function,
- default: fun => fun()
- }
- })
- </script>
- <template>
- <div v-if="show" class="dialog-mask custom-dialog">
- <div class="dialog-box">
- <div class="dialog-header">
- <p class="el-message-box__title">{{title}}</p>
- </div>
- <p class="dialog-content">{{message}}</p>
- <div class="dialog-footer">
- <button class="el-button primary small" @click="close">確認</button>
- </div>
- </div>
- </div>
- </template>
- <style lang="scss" scoped>
- .dialog-mask {
- position: fixed;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.5);
- z-index: 9999;
- display: flex;
- justify-content: center;
- align-items: center;
- .dialog-box {
- display: inline-block;
- min-width: 420px;
- padding-bottom: 10px;
- vertical-align: middle;
- background-color: #fff;
- border-radius: 4px;
- border: 1px solid #ebeef5;
- font-size: 18px;
- box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
- text-align: left;
- overflow: hidden;
- backface-visibility: hidden;
- .dialog-header {
- position: relative;
- padding: 15px 15px 10px;
- .el-message-box__title{
- padding-left: 0;
- margin-bottom: 0;
- font-size: 18px;
- line-height: 1;
- color: #303133;
- }
- }
- .dialog-content {
- padding: 10px 15px;
- color: #606266;
- font-size: 14px;
- white-space: pre-wrap;
- word-wrap: break-word;
- }
- .dialog-footer {
- padding: 5px 15px 0;
- text-align: right
- }
- }
- }
- .el-button{
- display: inline-block;
- line-height: 1;
- white-space: nowrap;
- cursor: pointer;
- background: #fff;
- border: 1px solid #dcdfe6;
- color: #606266;
- appearance:none;
- -webkit-appearance: none;
- text-align: center;
- box-sizing: border-box;
- outline: none;
- margin: 0;
- transition: .1s;
- font-weight: 500;
- user-select:none;
- -moz-user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
- padding: 12px 20px;
- font-size: 14px;
- border-radius: 4px;
- &.primary{
- color: #fff;
- background-color: #409eff;
- border-color: #409eff;
- }
- &.small{
- padding: 9px 15px;
- font-size: 12px;
- border-radius: 3px;
- }
- }
- </style>
|