|
7 | 7 | <transition :name="transitionNames[0]" @after-leave="animationFinish"> |
8 | 8 | <div v-bind="$attrs" :class="classes" :style="mainStyles" v-show="visible" @mousedown="handleMousedown"> |
9 | 9 | <div :class="contentClasses" ref="content" :style="contentStyles" @click="handleClickModal"> |
| 10 | + <a :class="[prefixCls + '-fullscreen-icon']" :style="fullscreenIconStyles" |
| 11 | + v-if="showFullscreenIcon" @click="handleFullscreen"> |
| 12 | + <slot name="fullscreen"> |
| 13 | + <Icon :type="fullscreen ? 'ios-contract' : 'ios-expand'"></Icon> |
| 14 | + </slot> |
| 15 | + </a> |
10 | 16 | <a :class="[prefixCls + '-close']" v-if="closable" @click="close"> |
11 | 17 | <slot name="close"> |
12 | 18 | <Icon type="ios-close"></Icon> |
|
59 | 65 | name: 'Modal', |
60 | 66 | mixins: [ Locale, ScrollbarMixins ], |
61 | 67 | components: { Icon, iButton }, |
62 | | - emits: ['on-cancel', 'on-ok', 'on-hidden', 'on-visible-change', 'update:modelValue'], |
| 68 | + emits: ['on-cancel', 'on-ok', 'on-hidden', 'on-visible-change', 'on-fullscreen', 'update:modelValue', 'update:fullscreenValue'], |
63 | 69 | provide () { |
64 | 70 | return { |
65 | 71 | ModalInstance: this |
|
129 | 135 | return !global.$VIEWUI || global.$VIEWUI.transfer === '' ? true : global.$VIEWUI.transfer; |
130 | 136 | } |
131 | 137 | }, |
132 | | - fullscreen: { |
| 138 | + fullscreenValue: { |
| 139 | + type: Boolean, |
| 140 | + default: false |
| 141 | + }, |
| 142 | + showFullscreenIcon: { |
133 | 143 | type: Boolean, |
134 | 144 | default: false |
135 | 145 | }, |
|
170 | 180 | showHead: true, |
171 | 181 | buttonLoading: false, |
172 | 182 | visible: this.modelValue, |
| 183 | + fullscreen: this.fullscreenValue, |
173 | 184 | dragData: deepCopy(dragData), |
174 | 185 | modalIndex: this.handleGetModalIndex(), // for Esc close the top modal |
175 | 186 | isMouseTriggerIn: false, // #5800 |
|
253 | 264 |
|
254 | 265 | return style; |
255 | 266 | }, |
| 267 | + fullscreenIconStyles () { |
| 268 | + let style = {}; |
| 269 | +
|
| 270 | + const styleRight = { |
| 271 | + right: this.closable ? '44px' : '14px' |
| 272 | + }; |
| 273 | +
|
| 274 | + Object.assign(style, styleRight); |
| 275 | +
|
| 276 | + return style; |
| 277 | + }, |
256 | 278 | localeOkText () { |
257 | 279 | if (this.okText === undefined) { |
258 | 280 | return this.t('i.modal.okText'); |
|
272 | 294 | } |
273 | 295 | }, |
274 | 296 | methods: { |
| 297 | + handleFullscreen () { |
| 298 | + this.fullscreen = !this.fullscreen; |
| 299 | + this.$emit('update:fullscreenValue', this.fullscreen); |
| 300 | + this.$emit('on-fullscreen', this.fullscreen); |
| 301 | + }, |
275 | 302 | close () { |
276 | 303 | if (!this.beforeClose) { |
277 | 304 | return this.handleClose(); |
|
473 | 500 | this.dragData = deepCopy(dragData); |
474 | 501 | } |
475 | 502 | }, |
| 503 | + fullscreenValue (val) { |
| 504 | + if (val === this.fullscreen) return; |
| 505 | + this.fullscreen = val; |
| 506 | + this.$emit('on-fullscreen', this.fullscreen); |
| 507 | + }, |
476 | 508 | loading (val) { |
477 | 509 | if (!val) { |
478 | 510 | this.buttonLoading = false; |
|
0 commit comments