新的版本可以同一网页加载多个文档,具体用法有介绍吗?
你好v2.0.2是可以支持多实例的。
示例参考:
const startup = async (opts = {}) => {
const token = 'xxx'
const instance = WebOfficeSDK.init({
appId:'xxx',
token,
...opts
})
instance.on('fileOpen', data => {
console.log('fileOpen', data)
})
await instance.ready()
return Promise.resolve(instance)
}
window.onload = async function() {
const p1 = startup({
mount: '#app1',
fileId:'xxx',
officeType: 'p',
})
const p2 = startup({
mount: '#app2',
fileId: 'xxx',
officeType: 'w',
})
const [pptInstance, wordInstance] = await Promise.all([p1, p2])
}