- 运行官方的demo能正常打开线上文档
- 放到vue打开就报错
- 打开demo一行一行的排查
- 解决bug:组件初始化需要调用一下weboffice.OptionFlag |= 128;
相关代码:
// weboffice 组件
<object ref="weboffice" :height='height' :width='width' style='let: 0px; top: 0px'
classid='clsid:E77E049B-23FC-4DB8-B756-60529A35FAD5' codebase='WebOffice.cab#Version=7,0,1,8'>
<param name='_ExtentX' value='6350'>
<param name='_ExtentY' value='6350'>
</object>
// .......
props: {
height:{
type:String,
default:'100%'
},
width:{
type:String,
default:'100%'
}
},
getWeboffice(){
const instance = this.weboffice || this.$refs.weboffice
instance.OptionFlag |= 128; // !!!不调用打开线上文档会报错
return instance;
}
// 打开线上文档
this.getWeboffice().LoadOriginalFile('http:xxxxx/download?projectId=09af0d05e1774c538067b11a1b59c661&fileType=1', "xls")