【问题标题】:Make buttons in v-card-actions responsive响应V-Card-Actions中的按钮
【发布时间】:2020-04-12 20:59:00
【问题描述】:

我在v-card-actions 中有一个带有三个按钮(v-btn)的v-card,每个按钮上都有一个长文本。这基本上没问题,但是当在小屏幕上查看时,这些按钮没有响应,它们仍然从左到右而不是从上到下对齐,因此最右边的按钮被剪切:

HTML:

<div id="app">
  <v-app>
    <v-card>
      <v-card-title>
        Foo!
      </v-card-title>
      <v-card-text>
        Bar!
      </v-card-text>
      <v-card-actions>
        <v-btn>VeryLongText</v-btn>
        <v-btn>SpamSpamSpam</v-btn>
        <v-btn>Wrzlbrnft</v-btn>
      </v-card-actions>
    </v-card>
  </v-app>
</div>

JS:

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data: () => ({
  })
})

Codepen example

在我目前的情况下,我可以使用small 来规避这个问题,例如&lt;v-btn small&gt;Verylongtext&lt;/v-btn&gt;,但我想知道如何让它完全响应。

Vue 版本:2.6.10 Vuetify:2.1.14

【问题讨论】:

    标签: vue.js vuetify.js


    【解决方案1】:

    如何使用网格?

    <div id="app">
      <v-app>
        <v-card>
          <v-card-title>
            Foo!
          </v-card-title>
          <v-card-text>
            Bar!
          </v-card-text>
          <v-card-actions>
            <v-container>
              <v-row dense>
                <v-col><v-btn class="button__full">VeryLongText</v-btn></v-col>
                <v-col><v-btn class="button__full">SpamSpamSpam</v-btn></v-col>
                <v-col><v-btn class="button__full">Wrzlbrnft</v-btn></v-col>
              </v-row>
            </v-container>
          </v-card-actions>
        </v-card>
      </v-app>
    </div>
    

    CodePen

    【讨论】:

    • 这在 xs 显示器上看起来不错,谢谢!对于更大的显示器(sm 及以上),我必须添加一些条件显示属性(class="d-none d-sm-flex"class="d-sm-none")。但我仍然想知道为什么 vuetify 不能开箱即用地处理它。
    猜你喜欢
    • 2019-11-10
    • 1970-01-01
    • 1970-01-01
    • 2020-12-17
    • 2021-01-23
    • 1970-01-01
    • 2018-08-31
    • 2019-04-02
    • 2020-09-27
    相关资源
    最近更新 更多