0

选择组件显示在表格下方,而不是上方。怎么修?同时保持表响应。这个问题在移动设备上更严重。
https://codepen.io/anon/pen/wXgbPr

<div id="app">
  <h1>Vue Select - Selecting Multiple Values</h1>
  <div class="table-responsive">
    <table class="table table-bordered">
      <thead>
        <tr>
          <td>col1</td>
          <td>col2</td>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>
 <v-select multiple v-model="selected" :options="options"></v-select>
          </td>
          <td></td>
        </tr>
        <tr>
          <td>text</td>
          <td>text</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

<script>
    Vue.component('v-select', VueSelect.VueSelect)

    new Vue({
      el: '#app',
      data: {
        selected: ['foo','bar'],
        options: ['foo','bar','baz']
      }
    })
</script>
4

1 回答 1

2

如果我的问题正确,请从包装表格的 div 中删除“表格响应”类。而是将其添加到表中。

<div id="app">
  <h1>Vue Select - Selecting Multiple Values</h1>
  <div>
    <table class="table table-responsive table-bordered">
      <thead>
        <tr>
          <td>col1</td>
          <td>col2</td>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>
 <v-select multiple v-model="selected" :options="options"></v-select>
          </td>
          <td></td>
        </tr>
        <tr>
          <td>text</td>
          <td>text</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

<script>
    Vue.component('v-select', VueSelect.VueSelect)

    new Vue({
      el: '#app',
      data: {
        selected: ['foo','bar'],
        options: ['foo','bar','baz']
      }
    })
</script>

CodePen 链接

或者:

<div id="app">
  <h1>Vue Select - Selecting Multiple Values</h1>
  <div class="table-responsive" style="overflow-x:visible;">
    <table class="table table-bordered">
      <thead>
        <tr>
          <td>col1</td>
          <td>col2</td>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>
 <v-select multiple v-model="selected" :options="options"></v-select>
          </td>
          <td></td>
        </tr>
        <tr>
          <td>text</td>
          <td>text</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

<script>
    Vue.component('v-select', VueSelect.VueSelect)

    new Vue({
      el: '#app',
      data: {
        selected: ['foo','bar'],
        options: ['foo','bar','baz']
      }
    })
</script>
于 2018-06-12T18:46:10.630 回答