IE11忽略了Gridstack的JS方法来动态创建新元素

问题描述

我正在构建一个包含Gridstack网格的网页。我这样初始化:

<script type="text/javascript">
  var grid = GridStack.init({
    acceptWidgets: false,// Accept widgets from other grids or from outside.
    alwaysShowResizeHandle: true,// Should resize handle be visible at all times or only at hover.
    animate: false,// ???
    auto: true,// Should Gridstack automaticaly initialize it's items?
    cellHeight: "155px",// One cell height.
    column: 48,// Number of columns to which to snap to.
    disableDrag: false,// Eanble or disable dragging.
    disableOneColumnMode: true,// disable "one-column" mode when width equals minimal width.
    disableResize: false,// Enable or disable resizing.
    draggable: true,// ???
    dragOut: true,// Prevent dragging items outside of their parent element.
    float: true,// Enable floating tiles.
    handle: '.grid-stack-item-content',// Select draggable handle class.
    handleClass: 'grid-stack-item-content',// Select draggable handle class (override).
    itemClass: 'grid-stack-item',// Choose class,which will be treated as a tile.
    maxRow: 12,// Maximum rows where zero means unlimited.
    minRow: 1,// Minimum rows to prevent empty grid from colapsing.
    minWidth: 768,// Constant width which determines,when "one-column" mode is triggered.
    oneColumnDomSort: false,// ???
    placeholderClass: 'grid-stack-placeholder',// Select placeholder class.
    placeholderText: '',// Text inside a placeholder.
    resizable: {                                  // Should resize handle be visible at all times or only at hover (override). 
      autoHide: false,handles: 'n,nw,w,sw,s,se,e,ne'
    },removeable: false,// Enables removing of tiles if they are dragged outside of the grid.
    removeTimeout: 2000,// Time in "ms" before tiles dragged out of the grid are removed.
    row: 48,// Fixed number of rows where zero means unlimited.
    rtl: false,// Right to left mode.
    staticGrid: false,// Prevent any kind of resizing or drag & drop functionalities.
    verticalMargin: 20,// Vertical gap between tiles.               
  });
</script>

然后我使用以下方法动态创建小部件,即平铺:

<!-- Gridstack: Example of adding a tile i.e. widget -->
<script>
  grid.addWidget(`
    <div>
      <div class="grid-stack-item-content">
        <p>...</p>
      </div>
    </div>`,1,true,48,"ID");
</script>

这将在Chromium,Firefox,Edge中创建窗口小部件。但不是在IE11中。有人知道我在做什么错吗?看来我正在manual ...


这是IE11中的控制台日志:

enter image description here

如果我单击错误,则会显示以下行,其中似乎没有奇怪的字符:

enter image description here

解决方法

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

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

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