vue中如何使用embed標簽PDF預(yù)覽
更新時間:2022年05月25日 16:43:43 作者:weixin_38673922
這篇文章主要介紹了vue中如何使用embed標簽PDF預(yù)覽,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
使用embed標簽PDF預(yù)覽
embed的四個屬性

<el-row type="flex" class="row-bg" justify="space-between">
<el-col :span="12">
<embed
:src='srcSourceLan'
type="application/pdf"
width="90%"
height="700px;"
/>
</el-col>
<el-col :span="12">
<embed
:src="srcTargetLan"
type="application/pdf"
width="90%"
height="700px;"
/>
</el-col>
</el-row>
srcSourceLan和srcTargetLan是請求接口返回的url
預(yù)覽效果:

使用vue-pdf預(yù)覽開發(fā)正常,打包報錯work.js404
解決方式
修改依賴文件node_modules下worker-loader里的index.js文件里路徑
代碼如下(示例):
?const filename = _loaderUtils2.default.interpolateName(this, options.name || 'static/js/[hash].worker.js', {
? ? context: options.context || this.rootContext || this.options.context,
? ? regExp: options.regExp
? });以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

