如何修改对接面板的标题

问题描述

我想更改面板的标题(使用dockingpanel创建)

我使用停靠面板'setTitle(...)'的方法。

发生以下错误

” DockingPanel.js:477未捕获的TypeError:无法读取未定义的属性'removeAttribute' 在MyPanel.o.setTitle(DockingPanel.js:477) “

如果您能告诉我如何更改停靠面板标题,我将不胜感激

解决方法

就像调用DockinPanel#setTitle之前一样,它的晚餐构造函数被调用。请尝试在Autodesk.Viewing.UI.DockingPanel.callsuper()

之后调用该函数
  // es5
  var SimplePanel = function(parentContainer,id,title,content,x,y)
  {
      this.content = content;
      Autodesk.Viewing.UI.DockingPanel.call(this,parentContainer,'');
      // Auto-fit to the content and don't allow resize.  Position at the coordinates given.
      //
      this.container.style.height = "auto";
      this.container.style.width = "auto";
      this.container.style.resize = "none";
      this.container.style.left = x + "px";
      this.container.style.top = y + "px";
    

      // Call setTitle here
  };

  SimplePanel.prototype = Object.create(Autodesk.Viewing.UI.DockingPanel.prototype);
  SimplePanel.prototype.constructor = SimplePanel;

  // es6
  class SimplePanel extends Autodesk.Viewing.UI.DockingPanel {
     constructor(parentContainer,y) {
       super();

       // Call setTitle here
     }

  }

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...