I have a vuetify dialog that contains an iframe.
I need that every time the dialog re-opens the iframe will reset to the beginning.
Right now the with every opening of the dialog the iframe is at its last state.
I tried using v-if on the dialog and adding a :key for re-rendering and it didn't work.
my dialog + iframe
<v-dialog
v-model="dialog['dialog_' + index]"
width="500">
<template v-slot:activator="{ on, attrs }">
<div style="display: flex; flex-direction: column; align-items: center;">
<v-btn
v-on="on"
v-bind="attrs"
@click="onActionClick(action)"
icon
class="action-button">
<img :src="'../../../static/assets/Images/' + action.icon +'.svg'">
</v-btn>
<p
class="mt-2"
style="line-height: 12px">{{ action.label }}</p>
</div>
</template>
<iframe
:src="iframeUrl"
:title="action.label"/>
</v-dialog>
Thank you.
In your v-dialog component do this:
<v-dialog
@input="refreshIframe"
v-model="dialog['dialog_' + index]"
width="500">
And add a method to your script like this:
methods: {
// other methods...
refreshIframe () {
const tempUrl = this.iframeUrl;
iframeUrl = "";
iframeUrl = tempUrl;
}
}