vue中如何使用embed标签PDF预览
作者:weixin_38673922
这篇文章主要介绍了vue中如何使用embed标签PDF预览,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
使用embed标签PDF预览
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
预览效果:

使用vue-pdf预览开发正常,打包报错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
});以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
