如何在对话框工具栏下截取导航抽屉Vuetifyjs + Vuejs

时间:2018-04-24 21:16:45

标签: javascript html vue.js vue-component vuetify.js

我试图将导航抽屉剪切到对话框工具栏下方。 vuetify manual显示了如何在普通工具栏下使用clipped但不使用对话框。重新发布的问题:Code pen as well

我尝试使用fixed属性或将其从卡片中取出,但它不起作用。

想知道如何让它发挥作用。

  

Vuetifyjs:1.0.5   Vuejs:2.5.9



new Vue({
  el: '#app',
  data () {
      return {
        dialog: null,
        notifications: false,
        sound: true,
        widgets: false
      }
    }
})

<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet"/>

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vuetify/dist/vuetify.min.js"></script>
<div id="app">
  <v-app id="inspire">
    <v-btn primary dark v-on:click.stop="dialog = true">Open Dialog</v-btn>
    {{dialog}}
    <v-dialog v-model="dialog"  transition="dialog-bottom-transition" width="80%">
      <v-card>
        <v-toolbar dark class="primary">
          <v-btn icon @click.native="dialog = false" dark>
            <v-icon>close</v-icon>
          </v-btn>
          <v-toolbar-title>Settings</v-toolbar-title>
          <v-spacer></v-spacer>
          <v-toolbar-items>
            <v-btn dark flat @click.native="dialog = false">Save</v-btn>
          </v-toolbar-items>
        </v-toolbar>
         <v-navigation-drawer
                                        temporary
                                        absolute
                                        clipped
                                        right
                                        width=""
                                        height=""

                                >
                                    <v-list light one-line class="grey pa-1">
                                        <v-list-tile>
                                            <v-list-tile-content>
                                                <v-list-tile-title class="white--text subheading">
                                                    HEADER
                                                </v-list-tile-title>
                                            </v-list-tile-content>
                                        </v-list-tile>
                                    </v-list>
                                    <v-list class="pt-0" dense>
                                        <v-divider></v-divider>
                                        <v-list-tile >
                                                <v-icon color="grey">remove</v-icon> Lorem ipsum lorem ipsum
                                        </v-list-tile>
                                    </v-list>
                                </v-navigation-drawer>
        <v-card-media src="https://vuetifyjs.com/static/doc-images/cards/desert.jpg" height="200px">
        </v-card-media>
        <v-card-title primary-title>
          <div>
            <h3 class="headline mb-0">Kangaroo Valley Safari</h3>
            <div>Located two hours south of Sydney in the <br>Southern Highlands of New South Wales, ...</div>
          </div>
        </v-card-title>
        <v-card-actions>
          <v-btn flat class="orange--text">Share</v-btn>
          <v-btn flat class="orange--text">Explore</v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  </v-app>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

Clipped无效,但可以在对话框工具栏下剪切一些内联样式。应用class ='mt-5'style='top: 16px'来获得所需的结果。

Codepen

new Vue({
  el: '#app',
  data () {
      return {
        dialog: null,
        notifications: false,
        sound: true,
        widgets: false
      }
    }
})
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet"/>

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vuetify/dist/vuetify.min.js"></script>
<div id="app">
  <v-app id="inspire">
    <v-btn primary dark v-on:click.stop="dialog = true">Open Dialog</v-btn>
    {{dialog}}
    <v-dialog v-model="dialog"  transition="dialog-bottom-transition" width="80%">
      <v-card>
        <v-toolbar dark class="primary">
          <v-btn icon @click.native="dialog = false" dark>
            <v-icon>close</v-icon>
          </v-btn>
          <v-toolbar-title>Settings</v-toolbar-title>
          <v-spacer></v-spacer>
          <v-toolbar-items>
            <v-btn dark flat @click.native="dialog = false">Save</v-btn>
          </v-toolbar-items>
        </v-toolbar>
         <v-navigation-drawer
                                        temporary
                                        absolute
                                        right
                                        width=""
                                        height=""
                                        class='mt-5'
                                        style='top: 16px'

                                >
                                    <v-list light one-line class="grey pa-1">
                                        <v-list-tile>
                                            <v-list-tile-content>
                                                <v-list-tile-title class="white--text subheading">
                                                    HEADER
                                                </v-list-tile-title>
                                            </v-list-tile-content>
                                        </v-list-tile>
                                    </v-list>
                                    <v-list class="pt-0" dense>
                                        <v-divider></v-divider>
                                        <v-list-tile >
                                                <v-icon color="grey">remove</v-icon> Lorem ipsum lorem ipsum
                                        </v-list-tile>
                                    </v-list>
                                </v-navigation-drawer>
        <v-card-media src="https://vuetifyjs.com/static/doc-images/cards/desert.jpg" height="200px">
        </v-card-media>
        <v-card-title primary-title>
          <div>
            <h3 class="headline mb-0">Kangaroo Valley Safari</h3>
            <div>Located two hours south of Sydney in the <br>Southern Highlands of New South Wales, ...</div>
          </div>
        </v-card-title>
        <v-card-actions>
          <v-btn flat class="orange--text">Share</v-btn>
          <v-btn flat class="orange--text">Explore</v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  </v-app>
</div>