showCloseIcon for OverlayPanel
parent
9e97b24882
commit
fe1507d480
|
@ -4,6 +4,9 @@
|
||||||
<div class="p-overlaypanel-content">
|
<div class="p-overlaypanel-content">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="p-overlaypanel-close p-link" @click="hide" v-if="showCloseIcon">
|
||||||
|
<span class="p-overlaypanel-close-icon pi pi-times"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
@ -14,6 +17,14 @@ import DomHandler from '../utils/DomHandler';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
appendTo: String,
|
appendTo: String,
|
||||||
|
showCloseIcon: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
dismissable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
baseZIndex: {
|
baseZIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
|
@ -32,7 +43,9 @@ export default {
|
||||||
outsideClickListener: null,
|
outsideClickListener: null,
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.restoreAppend();
|
this.restoreAppend();
|
||||||
this.unbindOutsideClickListener();
|
if (this.dismissable) {
|
||||||
|
this.unbindOutsideClickListener();
|
||||||
|
}
|
||||||
this.target = null;
|
this.target = null;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -52,14 +65,19 @@ export default {
|
||||||
onEnter() {
|
onEnter() {
|
||||||
this.appendContainer();
|
this.appendContainer();
|
||||||
this.alignOverlay();
|
this.alignOverlay();
|
||||||
this.bindOutsideClickListener();
|
|
||||||
|
if (this.dismissable) {
|
||||||
|
this.bindOutsideClickListener();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.autoZIndex) {
|
if (this.autoZIndex) {
|
||||||
this.$refs.container.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex());
|
this.$refs.container.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLeave() {
|
onLeave() {
|
||||||
this.unbindOutsideClickListener();
|
if (this.dismissable) {
|
||||||
|
this.unbindOutsideClickListener();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
alignOverlay() {
|
alignOverlay() {
|
||||||
DomHandler.absolutePosition(this.$refs.container, this.target);
|
DomHandler.absolutePosition(this.$refs.container, this.target);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="content-section implementation">
|
<div class="content-section implementation">
|
||||||
<Button type="button" label="Toggle" @click="toggle" />
|
<Button type="button" label="Toggle" @click="toggle" />
|
||||||
|
|
||||||
<OverlayPanel ref="op" appendTo="body">
|
<OverlayPanel ref="op" appendTo="body" :showCloseIcon="true">
|
||||||
<img src="/demo/images/nature/nature1.jpg" alt="Nature Image">
|
<img src="/demo/images/nature/nature1.jpg" alt="Nature Image">
|
||||||
</OverlayPanel>
|
</OverlayPanel>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue