如何使用 v-bind:height?
How to use v-bind:height?
如何动态设置元素的高度?
我有一个 v-carousel
,但它在屏幕上占用了太多 space。
所以我需要这样的东西:
v-bind:height="{ '300' : $vuetify.breakpoint.mdAndDown}"
但是没用。
我也虽然“嗯,也许它是一个字符串,所以让我们试试一个数字”
:height="{ 300 : $vuetify.breakpoint.mdAndDown }"
而且也没用。也尝试了 300px
和 '300px'
和 none 的工作。
正确的语法是将高度绑定到计算的 属性,例如:
<v-carousel v-model="model" :height="customHeight">
和:
computed:{
customHeight(){
return this.$vuetify.breakpoint.mdAndDown?300:500;
}
}
如何动态设置元素的高度?
我有一个 v-carousel
,但它在屏幕上占用了太多 space。
所以我需要这样的东西:
v-bind:height="{ '300' : $vuetify.breakpoint.mdAndDown}"
但是没用。 我也虽然“嗯,也许它是一个字符串,所以让我们试试一个数字”
:height="{ 300 : $vuetify.breakpoint.mdAndDown }"
而且也没用。也尝试了 300px
和 '300px'
和 none 的工作。
正确的语法是将高度绑定到计算的 属性,例如:
<v-carousel v-model="model" :height="customHeight">
和:
computed:{
customHeight(){
return this.$vuetify.breakpoint.mdAndDown?300:500;
}
}