使用bootstrap时,当我需要根据设备更改标签/输入的布局时,我使用next代码:
<fieldset class="bordered text-muted p-0 m-0 mb-4">
<legend class="bordered">Filters</legend>
<dl class="block_2columns_md m-0 p-2">
<dt class="key_values_rows_label_13">
<label class="col-form-label" for="filter_title">
By title
</label>
</dt>
<dd class="key_values_rows_value_13">
<input style="flex: 1 0" name="filter_title" id="filter_title" class="form-control" type="text" value="" v-model="filter_title">
</dd>
</dl>根据设备的不同,在block_2columns_md的伸缩方向上进行更改,我在不同的行上放置了小型设备标签输入。现在我使用bootstrap-vue,想知道对于这样的块,bootstrap-vue有哪些元素,因为我认为如果我使用bootstrap-vue,使用bootstrap-vue会更好。
"bootstrap-vue": "^2.3.0",谢谢!
发布于 2020-02-13 21:51:26
听起来您想要的是Form Group组件。更具体地说,它的Horizontal Layout部分。
该组件有label-cols-{breakpoint}属性来定义标签在给定断点处应该使用多少空间。它使用与普通bootstrap相同的12网格系统。
因此,如果希望标签在某个断点处使用整行(位于输入之上),请向form-group添加label-cols-{breakpoint}="12"。
在小型移动设备上,该代码片段具有上面的标签,而在sm及以上的设备上,它位于输入旁边。
new Vue({
el: '#app'
})<link href="https://unpkg.com/bootstrap@4.4.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://unpkg.com/bootstrap-vue@2.4.1/dist/bootstrap-vue.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.js"></script>
<script src="https://unpkg.com/bootstrap-vue@2.4.1/dist/bootstrap-vue.js"></script>
<div id="app">
<b-form-group label-cols="12" label-cols-sm="2" label="Default">
<b-input></b-input>
</b-form-group>
</div>
https://stackoverflow.com/questions/60209033
复制相似问题