Vutify.js v-选择最小高度限制?
从下面可以看到,我正在尝试降低v-select
元素的高度,但似乎对我可以设置的最小高度有一个限制。也就是说,在height = 40
之后,进一步降低高度似乎不再起作用。有没有办法绕过这个极限,这样我就可以把这个元素变得更小?我需要它,因为我需要将它放入一个相对较小的div中。提前感谢-
new Vue({
el: "#app",
data: {
years: [2015, 2016, 2017, 2018]
}
})
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuetify/1.3.7/vuetify.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vuetify/1.3.7/vuetify.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div id="app">
<v-app>
<v-layout row>
<v-select
label="height=80"
outline
height="80"
:items="years">
</v-select>
<v-select
label="height=60"
outline
height="60"
:items="years">
</v-select>
<v-select
label="height=40"
outline
height="40"
:items="years">
</v-select>
<v-select
label="height=20"
outline
height="20"
:items="years">
</v-select>
</v-layout>
</v-app>
</div>
css
v-select
组件的min-height
为56px
,推荐答案规则定义如下:
.v-text-field--box .v-input__slot, .v-text-field--outline .v-input__slot{
min-height:56px;
}
让我们通过设置以下内容来覆盖它:
.v-text-field--box .v-input__slot, .v-text-field--outline .v-input__slot{
min-height: auto!important;
}
但是结果并不完美,并且内容没有正确对齐,为了解决这一问题,我们将向上述规则添加以下属性:
display: flex!important;
align-items: center!important
数据-lang="js"数据-隐藏="真"数据-控制台="假"数据-巴贝尔="假">
new Vue({
el: "#app",
data: {
years: [2015, 2016, 2017, 2018]
}
})
.v-text-field--box .v-input__slot,
.v-text-field--outline .v-input__slot {
min-height: auto!important;
display: flex!important;
align-items: center!important;
}
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuetify/1.3.7/vuetify.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vuetify/1.3.7/vuetify.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div id="app">
<v-app>
<v-layout row>
<v-select label="height=80" outline height="80" :items="years">
</v-select>
<v-select label="height=60" outline height="60" :items="years">
</v-select>
<v-select label="height=40" outline height="40" :items="years">
</v-select>
<v-select label="height=20" outline height="20" :items="years">
</v-select>
</v-layout>
</v-app>
</div>
相关文章