“typeof videojs”类型上不存在属性“extend”

问题描述

我正在尝试向 TypeScript 中的 videoJS 控制栏添加菜单栏,但我收到错误消息,指出 “类型 'typeof videojs' 上不存在属性 'extend'”

// Info Menu Button in control bar
  var MenuButton = videojs.getComponent('MenuButton');
  var MenuItem = videojs.getComponent('MenuItem');

  var CustomMenuButton = videojs.extend(MenuButton,{
    createItems: function () {
      // Must return an array of `MenuItem`s
      // Options passed in `addChild` are available at `this.options_`
      return this.options_.myItems.map((i: { name: any }) => {
        var item = new MenuItem(this.player,{ label: i.name });
        item.handleClick = function () {
          /* ... */
        };
        return item;
      });
    },});

  // Register as a component,so it can be added
  videojs.registerComponent('CustomMenuButton',CustomMenuButton);

  // Use `addChild` to add an instance of the new component,with options
  this.player.controlBar.addChild('CustomMenuButton',{
    title: 'My menu',myItems: [{ name: 'Hello' },{ name: 'World' }],});

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)