Vuetify: fixing component to top of v-layout?

时光毁灭记忆、已成空白 提交于 2019-12-08 05:04:35

问题


I'm trying to build a webpage with vuetify and nuxt. I'm trying to set the max-width property of the expansion panel ui component (https://vuetifyjs.com/en/components/expansion-panels). I have:

<template>
  <v-app id="inspire">
    <v-layout align-center justify-center row fill-height>
    <!-- <v-layout align-center > -->

    <v-expansion-panel style="maxWidth: 1200px" >   

      <v-expansion-panel-content v-for="(item,i) in items" :key="i">
        <div slot="header">{{item.header}}</div>
        <v-card >
          <v-card-text>{{item.text}}</v-card-text>
        </v-card>
      </v-expansion-panel-content>
    </v-expansion-panel>
    </v-layout>
  </v-app>
</template>

This is centering the expansion panel but I'd like to push the expansion panel up to the top of the v-layout so there is less space. Right now there is a big gap .Please see screenshot. How do I make this happen?


回答1:


Try to remove the following props from your layout component :

align-center justify-center

new Vue({
  el: '#app',

})
<script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@1.4.0/dist/vuetify.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/vuetify@1.4.0/dist/vuetify.min.css">
<div id="app" data-app>
  <v-app id="inspire">
    <v-layout row fill-height>
      <!-- <v-layout align-center > -->

      <v-expansion-panel style="max-width: 1200px">

        <v-expansion-panel-content v-for="item in 5" :key="item">
          <div slot="header">{{item}}</div>
          <v-card>
            <v-card-text>some content</v-card-text>
          </v-card>
        </v-expansion-panel-content>
      </v-expansion-panel>
    </v-layout>
  </v-app>
</div>


来源:https://stackoverflow.com/questions/54295405/vuetify-fixing-component-to-top-of-v-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!