简体   繁体   English

如何删除包装div或将其类型从div更改为ember-from-for中的span?

[英]How can I remove the wrapper div or change its type from div to span within ember-from-for?

I am using bulma.io and for using its style classes for a selectbox it requires the following code. 我正在使用bulma.io,并将其样式类用于selectbox,则需要以下代码。

<div class="field">
  <label class="label">Subject</label>
  <p class="control">
    <span class="select">
      <select>
        <option>Select dropdown</option>
        <option>With options</option>
      </select>
    </span>
  </p>
</div>

which requires a span instead of div for wrapping the (label and select tag). 它需要一个span而不是div来包装(label and select标签)。

I've tried to use tagName="span" but the generated code was like that link 我尝试使用tagName="span"但生成的代码类似于该链接

here is my code 这是我的代码

 <div class="field">
  <p class="control">
    {{f.select-field "countries"
      countries
      optionValuePath="value"
      optionLabelPath="text"
      labelClasses="label"
      label="Location"
      required=true
      tagName="span"
    }}
  </p>
 </div>

which generated a span wrapping the div .. not converting the div to span <span><div><label><select></div></span> 生成了一个包裹div的跨度..不将div转换为跨度<span><div><label><select></div></span>

If you include select into a component, the component is wrapped with span: 如果将select包含在组件中,则该组件将用span包裹:

component/my-select.js : import Ember from 'ember'; component / my-select.js:从'ember'导入Ember;

export default Ember.Component.extend({
  tagName: 'span',
  classNames: ['select']
});

templates/components/my-select.hbs : 模板/组件/my-select.hbs:

<select>
   <option>Select dropdown</option>
   <option>With options</option>
</select>>

myPage.hbs : myPage.hbs:

<div class="field">
 <p class="control">
  {{my-select}}
 </p>
</div>

here is the twiddle 这是旋转

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

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