Vuetify v-card 適合 v-col 中可能的所有高度
P粉692052513
P粉692052513 2024-04-06 10:29:26
0
1
387

我正在使用 vue 和 vuetify 建立一個登入/註冊頁面。 我將程式碼放在下面(文字是義大利語,因為我是義大利語,但你可以明白這一點):

<v-row 
      align="center"
      justify="center"
      class="prova"
    >
        <v-col
        cols="10"
        lg="3"
        md="4"
        sm="5"
        >
          <v-card
          >
            <v-card-title class="center">
              Login
            </v-card-title>

            <v-card-text
              class="center"
            >
              <v-container>
                <v-form>
                  <v-text-field
                    label="Email"
                    required
                  ></v-text-field>

                  <v-text-field
                    :append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
                    :type="showPassword ? 'text' : 'password'"
                    label="Password"
                    counter
                    @click:append="showPassword = !showPassword"
                  ></v-text-field>

                  <v-btn
                    color="primary"
                  >
                    Accedi
                  </v-btn>
                </v-form>
              </v-container>
            </v-card-text>
          </v-card>
        </v-col>
        <v-col
        cols="10"
        lg="3"
        md="4"
        sm="5"
        fill-height
        >
          <v-card
          >
            <v-card-title class="center">
              Registrazione
            </v-card-title>

            <v-card-text class="center">
            <v-container >
              <div
              >Vuoi accedere al sito 
                ma non sei registrato? 
                Clicca qui sotto 
                per farlo subito!</div>
              <br>
              <v-btn
                color="primary"
              >
                Registrati
              </v-btn>
            </v-container>
            </v-card-text>
          </v-card>
        </v-col>
    </v-row>

如果您嘗試此操作,您將看到「註冊」(註冊)卡的高度比登入卡低。有沒有辦法(最好使用CSS,但如果沒有JS)使高度與登入卡相同,以便它們看起來更好?

謝謝!祝你有美好的一天!

P粉692052513
P粉692052513

全部回覆(1)
P粉908138620

檢查我製作的這個codesandbox:https: //codesandbox.io/s/stack-70836234-11sck?file=/src/components/CardHeight.vue

#從 v-row 中刪除 align="center"。然後只需將 css height:100% 新增到您的 v-card

更新: 要僅在移動視圖上為v-card 設定固定高度,可以使用vuetify 的顯示斷點,在本例中,我將它們套用到style 屬性,但您可以將其與任何html 屬性和任何帶有js 的地方一起使用。



...




...

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!