huaweicloud-sdk-browserjs-obs icon indicating copy to clipboard operation
huaweicloud-sdk-browserjs-obs copied to clipboard

Hotfix/iframe

Open lixiaofeng666 opened this issue 2 years ago • 0 comments

场景: UEditor 上传视频是通过 iframe 方式 obs 上传是在主窗口定义和调用 obs.uploadFile({ SourceFile:file }) UEditor 上传视频拿到 file 对象后, 调用主窗口上传方法 window.parent.obs.uploadFile({ SourceFile:file }) 问题: 用 file instanceof window.File 判断 file 传参类型会报错,因为 file 对象是在 iframe 生成,原型指向的是 iframe 作用域的 File, 而不是主窗口的 window.File 方案: 用Object.prototype.toString.call(...)代替 instanceof window.File进行类型判断

lixiaofeng666 avatar Sep 09 '22 01:09 lixiaofeng666