elementUI el-dialog 解決embed標籤沒法實時更新預覽PDF文件

<el-dialog class="padd-dialog" width="60%" title="詳情" @opened="opened" :visible.sync="previewDialogvisible" append-to-body>
      <div class="dialog-body">
<!--        <embed style="width:100%;height:600px">-->
      </div>
    </el-dialog> 

  jsjavascript

opened(){
            let oldEmbed = document.querySelector("embed");
            if(oldEmbed != null){
                oldEmbed.parentNode.removeChild(oldEmbed);
            }
            let dialogBody = document.querySelector(".dialog-body");
            let embed = document.createElement("embed");
            embed.src = this.url;
            embed.style.width="100%";
            embed.style.height="600px";
            dialogBody.appendChild(embed);
        },
相關文章
相關標籤/搜索