与极光的兼容性问题

阅读次数 3

项目配置:vue2+weboffice+JAnalyticsInterface(极光) 主要位置:weboffice演示的播放模式 问题:主要是weboffice在使用过程中,调用以下的极光代码 var CountEvent = window.JAnalyticsInterface.Event.CountEvent;
var cEvent = new CountEvent("create_sign");
window.JAnalyticsInterface.onEvent(cEvent);
就会出现以下的weboffice的代码无法调用问题,需要鼠标操作weboffice大一点的操作的时候才可以使用(当前页的动画切换不可以,换页和关闭播放都可以,其他没试)
//this.office是weboffice的init
if (this.boardData.current == 1) {
return;
}
this.boardData.current--;
// this.teduBoard.prevBoard();
let app = this.office.Application;
//这里开始就调用不下去了
// Slide设置对象
const SlideShowSettings = await app.ActivePresentation.SlideShowSettings;
// 进入幻灯片播放模式
await SlideShowSettings.Run();
const SlideShowWindow = await app.ActivePresentation.SlideShowWindow;
// 视图对象
const view = await SlideShowWindow.View;
// 幻灯片的第一个动画开始播放
await view.Play(this.boardData.current, 1);

尝试了一下,其他的所有通过代码的操作都没办法实现,我这边暂时只能使用destroy,重新init获取到能够操作的权限

2 Answers

哈哈哈哈 让我找到解决方案了 var CountEvent = window.JAnalyticsInterface.Event.CountEvent; var cEvent = new CountEvent("create_sign"); window.JAnalyticsInterface.onEvent(cEvent);
执行之后立马调用以下代码(可能有些代码没必要)
await this.office.ready(); //这里应该是关键1
let app = this.office.Application;
// Slide设置对象
const SlideShowSettings = await app.ActivePresentation.SlideShowSettings;
// 进入幻灯片播放模式
await SlideShowSettings.Run();
const SlideShowWindow = await app.ActivePresentation.SlideShowWindow;
// 视图对象
const view = await SlideShowWindow.View;
// 幻灯片的第一个动画开始播放
await view.Play(当前页面页码, 1); //这里应该是关键2

添加一些个人见解(仅供参考,有问题可以提出): 1.应该是对于window的操作对导致webOffice实例没办法操作,需要将实例重新加载之后才能操作。 2.this.office.ready()后一定要调用比较大的操作代码(页面切换/退出播放),不然可能对于实例还是不能操作。