this.viewer._viewer.zoom
确保是在viewer加载好之后运行的
也就是:
- documentLoaded: () => {
- this.viewer._viewer.zoom = {
- mode: 2
- };
- },
复制代码 而且您不能写this.viewer._viewer.zoom.mode = 2
因为从0切换到2,还有factor属性存在,
也就是如果您写的是this.viewer._viewer.zoom.mode = 2
它的实际效果是这样的:- zoom: {
- mode: 2,
- factor: 1
- }
复制代码 这样是不对的,同理当mode从2切换回0的时候也需要把factor属性在加上。
总体可以参考这个:
- viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#' + options.element,
- renderFormat: 'html',
- reportService: {
- url: 'api/reporting',
- },
- reportID: options.documentInfo.id,
- documentLoaded: () => {
- this.viewer._viewer.zoom = {
- mode: 2
- };
- }
- });
复制代码
|