123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <div class="simple-dialog" v-if="value">
- <div class="simple-dialog__container">
- <span
- class="el-icon-close simple-dialog__colse"
- @click="onCloseClick"
- ></span>
- <div class="simple-dialog__title">
- <span class="simple-dialog__title__text">提示</span>
- <slot name="title"></slot>
- </div>
- <div
- class="simple-dialog__content"
- :style="{ textAlign: center && 'center' }"
- >
- <slot></slot>
- <span class="simple-dialog__content__text" v-text="description"></span>
- </div>
- <div class="simple-dialog__footer">
- <slot name="footer" v-if="!confirm || !cancel"></slot>
- <div
- class="simple-dialog__confirm simple-dialog__btn"
- v-if="confirm"
- @click="onConfirm"
- >
- 确定
- </div>
- <div
- class="simple-dialog__cancel simple-dialog__btn"
- v-if="cancel"
- @click="onCancel"
- >
- 确定
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- model: {
- prop: 'value',
- event: 'change',
- },
- props: {
- value: {
- type: Boolean,
- default: false,
- },
- confirm: {
- type: Boolean,
- default: true,
- },
- cancel: {
- type: Boolean,
- default: true,
- },
- description: {
- type: String,
- default: '',
- },
- center: {
- type: Boolean,
- default: false,
- },
- },
- methods: {
- onCloseClick() {
- this.$emit('change', false)
- },
- onConfirm() {
- this.$emit('confirm')
- },
- onCancel() {
- this.$emit('cancel')
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- @media screen and (min-width: 768px) {
- .simple-dialog {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- background: rgba(0, 0, 0, 0.39);
- .simple-dialog__container {
- position: relative;
- width: 400px;
- background: #fff;
- .simple-dialog__colse {
- width: 36px;
- height: 36px;
- font-size: 26px;
- position: absolute;
- top: 8px;
- right: 12px;
- text-align: center;
- line-height: 36px;
- color: #c2c2c2;
- cursor: pointer;
- }
- .simple-dialog__title {
- padding: 12px 24px;
- border-bottom: 1px solid #c2c2c2;
- .simple-dialog__title__text {
- font-size: 18px;
- color: #282828;
- }
- }
- .simple-dialog__content {
- padding: 24px 24px;
- .simple-dialog__content__text {
- font-size: 16px;
- color: #282828;
- }
- }
- .simple-dialog__footer {
- padding: 0 24px 24px;
- .simple-dialog__btn {
- width: 100%;
- height: 40px;
- text-align: center;
- line-height: 40px;
- font-size: 16px;
- border-radius: 4px;
- cursor: pointer;
- }
- .simple-dialog__confirm {
- background: #f3920d;
- color: #fff;
- }
- .simple-dialog__cancel {
- color: #666666;
- box-sizing: border-box;
- border: 1px solid #c2c2c2;
- margin-top: 16px;
- }
- }
- }
- }
- }
- @media screen and (max-width: 768px) {
- .simple-dialog {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- background: rgba(0, 0, 0, 0.39);
- .simple-dialog__container {
- position: relative;
- width: 76vw;
- min-height: 20vw;
- background: #fff;
- .simple-dialog__colse {
- width: 6.4vw;
- height: 6.4vw;
- font-size: 5vw;
- position: absolute;
- top: 3vw;
- right: 3vw;
- text-align: center;
- line-height: 6.4vw;
- color: #c2c2c2;
- }
- .simple-dialog__title {
- padding: 3vw 4.8vw;
- border-bottom: 1px solid #c2c2c2;
- .simple-dialog__title__text {
- font-size: 4.2vw;
- color: #282828;
- }
- }
- .simple-dialog__content {
- padding: 3vw 4.8vw;
- .simple-dialog__content__text {
- font-size: 3.6vw;
- color: #282828;
- }
- }
- .simple-dialog__footer {
- padding: 0 4.8vw 7vw;
- .simple-dialog__confirm {
- width: 100%;
- height: 8.8vw;
- text-align: center;
- background: #f3920d;
- color: #fff;
- line-height: 8.8vw;
- font-size: 3.6vw;
- }
- }
- }
- }
- }
- </style>
|