Vuetify上有选项组吗?

时间:2018-09-24 13:26:43

标签: vuetify.js

我想在option group上使用select(如this)。

有可能吗?如果是的话,我该怎么做?

2 个答案:

答案 0 :(得分:6)

似乎可以通过vuetify本身提供此功能。请参见vuetify doku的示例模型:vuetify doc

因此,您只需要给数组“ items”一个位于所需位置的对象即可。

示例{'header': 'Mitarbeiter'}

答案 1 :(得分:3)

您可以通过在所选数据中添加y = '12'; x = 'hello 123'; % First, check if the content of y is present in x temp = contains(x, y); if temp == 1 % x contains y disp ('x contains y'); else disp ('X does not contain y'); end % Second, replace y characters with nothing. % Result: Only characters not present in y will remain % for more information type 'docs strrep' temp2 = strrep(x,y,''); disp (['Characters of x not in y: ' temp2]) 并使用divider来更好地控制所选内容的显示方式。

赞:

HTML

template

数据

<v-select
    v-model="peopleSelected"
    :items="people"
    box
    chips
    color="blue-grey lighten-2"
    label="Select"
    item-text="name"
    item-value="name"
    multiple
  >
    <!-- Template for render selected data -->
    <template
      slot="selection"
      slot-scope="data"
    >
      <v-chip
        :selected="data.selected"
        close
        class="chip--select-multi"
        @input="remove(data.item)"
      >
        {{ data.item.name }}
      </v-chip>
    </template>
    <!-- Template for render data when the select is expanded -->
    <template
      slot="item"
      slot-scope="data"
    >
      <!-- Divider and Header-->
      <template v-if="typeof data.item !== 'object'">
        <v-list-tile-content v-text="data.item"/>
      </template>
      <!-- Normal item -->
      <template v-else>
        <v-list-tile-content>
          <v-list-tile-title v-html="data.item.name"/>
          <v-list-tile-sub-title v-html="data.item.group"/>
        </v-list-tile-content>
      </template>
    </template>
  </v-select>

CodePen