繁体   English   中英

Bootstrap数据切换不适用于ember组件

[英]Bootstrap data-toggle doesn't work with ember component

我有一个jQuery插件,可以创建以下HTML

<div class="panel-heading">
  <h4 class="">
    <a data-toggle="collapse" href="#collapse2" class="collapsible-title display-inline full-width bold">Select Gigs</a>
  </h4>
</div>
<div id="collapse2" class="panel-collapse collapse">
  <div class="panel-body">
    <div class="row">
      <div class="col-xs-12">
        <input type="text" class="input-text-field margin-medium-bottom" placeholder="Search" />
      </div>
    </div>
...... and some other divs here .....

当我单击其上方的<a></a>时,我想切换ID为collapse2 div。 如果我在hbs文件中添加html,效果很好。 但是当我在jquery中创建以上html并按如下方式插入DOM时,它将url更改为domain/#collapse2

    _initializeAutoComplete: function () {
        Ember.$('#' + this.get('divId')).setAutocomplete({
            data: this.get('dataTree'),
            multiSelect: true,
            selectingType: 3
        });

    }.on('didInsertElement')
});

如何在不将href用作url更改的情况下进行切换? 感谢任何帮助。

将引导程序属性移到上面的div(或h4或根据需要创建新属性)

<div class="panel-heading" data-toggle="collapse" href="#collapse2" class="collapsible-title display-inline full-width bold">
  <h4 class="">
    <a href="#">Select Gigs</a>
  </h4>
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM