| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <view class="uv-new-modal">
- <uv-modal ref="modal" :class="className" v-model:show="show" :title="params.title"
- :confirmText="params.confirmText" :cancelText="params.cancelText"
- :showConfirmButton="params.showConfirmButton" :showCancelButton="params.showCancelButton"
- :confirmColor="params.confirmColor" :cancelColor="params.cancelColor" :duration="params.duration||3000"
- :asyncClose="params.asyncClose" :buttonReverse="params.buttonReverse"
- :closeOnClickOverlay="params.closeOnClickOverlay" :confirmButtonShape="params.confirmButtonShape"
- @confirm="confirm" @cancel="cancel">
- <view class="slot-content">
- <view class="content">
- {{params.content}}
- </view>
- </view>
- </uv-modal>
- </view>
- </template>
- <script>
- export default {
- name: "uv-new-modal",
- data() {
- return {
- show: false,
- className: 'show-modal',
- params: {
- title: '提示',
- content: '',
- confirmText: '确认',
- cancelText: '取消',
- showConfirmButton: true,
- showCancelButton: false,
- confirmColor: '#1D8AF6',
- cancelColor: '#DCEEFF',
- duration: 0,
- zIndex: 10075,
- buttonReverse: false,
- asyncClose: false,
- closeOnClickOverlay: false,
- confirmButtonShape: '',
- }
- };
- },
- methods: {
- open(params) {
- this.params = Object.assign({}, this.params, params)
- //console.log(this.params);
- this.show = true;
- // this.$refs.modal.close();
- this.$refs.modal.open();
- },
- close() {
- this.show = false;
- this.$refs.modal.close();
- },
- confirm(e) {
- if (typeof(this.params.confirm) != 'undefined') {
- this.params.confirm(e);
- }
- this.$emit('confirm', e);
- this.$refs.modal.close();
- },
- cancel(e) {
- this.$refs.modal.close();
- if (typeof(this.params.cancel) != 'undefined') {
- this.params.cancel(e);
- }
- this.$emit('cancel', e);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .uv-new-modal {
- .slot-content {
- text-align: center;
- color: #999;
- padding: 1rem 0;
- }
- .uv-popup {
- color: var(--color);
- ::v-deep .uv-modal {
- border-radius: .5rem;
- .uv-modal__title {
- color: var(--modal-title-color);
- font-size: 1rem;
- font-weight: normal;
- }
- .uv-modal__button-group {
- height: auto;
- ::v-deep .uv-modal__button-group__wrapper--confirm {
- background: var(--color);
- color: #fff;
- margin: .75rem 1.75rem .75rem .875rem;
- border-radius: .5rem;
- .uv-modal__button-group__wrapper__text {
- color: #fff !important;
- }
- }
- .uv-modal__button-group__wrapper--cancel {
- background: #DCEEFF;
- background-color: transparent;
- color: var(--color);
- margin: .75rem .875rem .75rem 1.75rem;
- border-radius: .5rem;
- .uv-modal__button-group__wrapper__text {
- color: var(--color) !important;
- }
- }
- .uv-modal__button-group__wrapper--only-confirm {
- background: var(--color);
- color: #fff;
- margin: .75rem 1.75rem;
- border-radius: .5rem;
- .uv-modal__button-group__wrapper__text {
- color: #fff !important;
- }
- }
- }
- }
- }
- }
- </style>
|