html - vuetify v-col xs ="12"只填充一半的宽度

标签 html css vue.js vuetify.js

我想知道为什么当屏幕尺寸为 <600px 时 vuetify 断点不起作用

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  
})
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>


<div id="app">
  <v-app id="inspire">
    <v-container class="grey lighten-5">
      <v-row no-gutters>
        <v-col
          v-for="n in 3"
          :key="n"
          xs="12"
          sm="12"
          md="4"
        >
          <v-card
            class="pa-2"
            outlined
            tile
          >
            One of three columns
          </v-card>
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</div>

当屏幕尺寸为 XS 时,我希望列宽相同

Codepan sample

最佳答案

这是两件事的结合

  1. 没有可用于 v-col 的 XS Prop 。
  2. 列会自动占据其父容器内的全部可用空间,除非您事先指定了它应该占据的宽度。

Columns will automatically take up an equal amount of space within their parent container. This can be modified using the cols prop. You can also utilize the sm, md, lg, and xl props to further define how the column will be sized in different viewport sizes.

https://vuetifyjs.com/en/components/grids#auto-sizing-columns

为了解决这个问题,将 v-col 的“cols”属性设置为 12,以指示它应该在所有视口(viewport)中占用 12 列。您可以将其视为您尝试使用的“xs”属性。然后,任何更大的视口(viewport)将继承最后的有效尺寸。

<v-col
  v-for="n in 3"
  :key="n"
  cols="12"
  md="4"
>

关于html - vuetify v-col xs ="12"只填充一半的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57683550/

相关文章:

Html5 彩色下拉菜单不起作用

html - 在溢出前将不同长度的元素包裹 X 次

php - 为什么简单地将 PHP 变量用于动态样式表?

jquery - 调整窗口大小后交换类

vue.js - 如何修改vue-cli的vue-loader来更新transformAssetsUrl

java - 未捕获( promise )TypeError : Cannot convert undefined or null to object

html - Bootstrap 导航栏品牌标志在折叠时重叠

javascript - 交换两个水平对齐的 div

css - Chrome Zoom 作为媒体查询

vue.js - v-for 循环中的动态数组名