<template>
    <el-dialog :title='title' :visible.sync='dialogVisible' width='500px'>
        <iframe
            v-if='flag'
            id='google_ads_frame2'
            name='google_ads_frame2'
            frameborder='0'
            :src='iframeSrc'
            marginwidth='0'
            marginheight='0'
            vspace='0'
            hspace='0'
            allowtransparency='true'
            scrolling='no'
            allowfullscreen='true'
        ></iframe>
    </el-dialog>
</template>

<script>
export default {
    name: 'saga-dialog',
    data() {
        return {
            dialogVisible: false,
            flag: true
        }
    },
    props: {
        iframeSrc: {
            default: ''
        },
        title: {
            default: '详情'
        }
    },
    methods: {
        show() {
            this.dialogVisible = true
        },
        refresh() {
            this.flag = this.flag ? false : true
            this.$nextTick(() => {
                this.flag = this.flag ? false : true
            })
        }
    },
    watch: {
        iframeSrc() {
            this.refresh()
        }
    }
}
</script>

<style scoped lang='less'>
#google_ads_frame2 {
    height: 350px;
    width: 100%;
}
</style>
