将v-row放在v-tab-item的末尾位置。

huangapple go评论65阅读模式
英文:

How to position a v-row at the end of a v-tab-item

问题

I currently have a v-tab vuetify and inside it a v-tab-item containing three v-rows. I'm trying to align the last v-row to the end of the container as shown in the attached image.

将v-row放在v-tab-item的末尾位置。

Below is the code example:

    <v-container class="pa-0">
        <v-card flat>
          <v-tabs fixed-tabs>
            <v-tab>
              tab 1
            </v-tab>
    
            <v-tab>
              tab 2
            </v-tab>
    
            <v-tab-item>
              <v-row
                style="border: 2px solid red;"
                no-gutters
              >
                <v-col>
                  Lorem ipsum...
                </v-col>
              </v-row>
    
              <v-row
                style="border: 2px solid purple;"
                no-gutters
              >
                <v-col>
                  Lorem ipsum...
                </v-col>
              </v-row>
    
              <v-row
                style="border: 2px solid orange;"
                no-gutters
              >
                <v-col>
                  Lorem ipsum...
                </v-col>
              </v-row>
            </v-tab-item>
          </v-tabs>
        </v-card>
    </v-container>
英文:

I currently have a v-tab vuetify and inside it a v-tab-item containing three v-rows. I'm trying to align the last v-row to the end of the container as shown in the attached image.

将v-row放在v-tab-item的末尾位置。

Below is the code example

    &lt;v-container class=&quot;pa-0&quot;&gt;
        &lt;v-card flat&gt;
          &lt;v-tabs fixed-tabs&gt;
            &lt;v-tab&gt;
              tab 1
            &lt;/v-tab&gt;
    
            &lt;v-tab&gt;
              tab 2
            &lt;/v-tab&gt;
    
            &lt;v-tab-item&gt;
              &lt;v-row
                style=&quot;border: 2px solid red;&quot;
                no-gutters
              &gt;
                &lt;v-col&gt;
                  Lorem ipsum...
                &lt;/v-col&gt;
              &lt;/v-row&gt;
    
              &lt;v-row
                style=&quot;border: 2px solid purple;&quot;
                no-gutters
              &gt;
                &lt;v-col&gt;
                  Lorem ipsum...
                &lt;/v-col&gt;
              &lt;/v-row&gt;
    
              &lt;v-row
                style=&quot;border: 2px solid orange;&quot;
                no-gutters
              &gt;
                &lt;v-col&gt;
                  Lorem ipsum...
                &lt;/v-col&gt;
              &lt;/v-row&gt;
            &lt;/v-tab-item&gt;
          &lt;/v-tabs&gt;
        &lt;/v-card&gt;
    &lt;/v-container&gt;

答案1

得分: 1

将属于顶部和底部的行分别包装在不同的div中,然后将父元素设置为flex列布局,并使用justify space-between。

```css
.row-container {
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
英文:

Wrap the rows that belong at the top and at the bottom in different divs, then make the parent a flex column with justify space-between

&lt;v-tab-item class=&quot;row-container&quot;&gt;
  &lt;div class=&quot;top-rows&quot;&gt;
    &lt;v-row style=&quot;border: 2px solid red&quot; no-gutters&gt;
      &lt;v-col&gt; Lorem ipsum... &lt;/v-col&gt;
    &lt;/v-row&gt;
    &lt;v-row style=&quot;border: 2px solid purple&quot; no-gutters&gt;
      &lt;v-col&gt; Lorem ipsum... &lt;/v-col&gt;
    &lt;/v-row&gt;
  &lt;/div&gt;

  &lt;div class=&quot;bottom-rows&quot;&gt;
    &lt;v-row style=&quot;border: 2px solid orange&quot; no-gutters&gt;
      &lt;v-col&gt; Lorem ipsum... &lt;/v-col&gt;
    &lt;/v-row&gt;
  &lt;/div&gt;
&lt;/v-tab-item&gt;
.row-container {
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

codepen example

huangapple
  • 本文由 发表于 2023年5月11日 03:17:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76221898.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定