vuetify.js 如何获取 v-container 的全宽
vuetify.js how to get full width of v-container
我是 vuetify.js
的新手并开始使用它。
这是我的代码。
管理员-panel.vue
<v-content class="yellow">
<v-container>
<v-layout>
<router-view></router-view>
</v-layout>
</v-container>
</v-content>
创建-user.vue
<template>
<v-container class="red">
<v-layout class="blue">
<v-flex md12>
form
</v-flex>
</v-layout>
</v-container>
</template>
在这里我可以看到 v-container
元素获得了可用的全宽。
我想要的是 create-user 组件中的 v-container
以获得相同的宽度。 (黄色会消失,红色会填满屏幕)
如何实现?
你可以这样试试
master.vue
<v-app id="app">
<v-navigation-drawer
v-model="drawer"
temporary
absolute
>
<sidebar></sidebar>
</v-navigation-drawer>
<v-toolbar dark color="primary" fixed app>
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
<v-toolbar-title class="white--text">MyBlog</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-text-field
color="purple"
id="globalSearch"
name="globalSearch"
label="Search"
v-model="globalSearch"
v-validate="'required'"
></v-text-field>
<v-btn to="dashboard" flat>Dashboard</v-btn>
<v-btn to="login" flat>Login</v-btn>
<v-btn flat>Register</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-content>
<v-container fluid>
<router-view></router-view>
</v-container>
</v-content>
<v-footer height="auto">
<v-card
flat
tile
class="indigo lighten-1 white--text text-xs-center"
>
<v-card-text>
<v-btn
v-for="icon in icons"
:key="icon"
icon
class="mx-3 white--text"
>
<v-icon size="24px">@{{ icon }}</v-icon>
</v-btn>
</v-card-text>
<v-card-text class="white--text">
©2018 — <strong>Eliyas Hossain</strong>
</v-card-text>
</v-card>
</v-footer>
</v-app>
category.vue
<template>
<v-card>
<v-card-title>
<div>
<h2 class="pl-2">Categories</h2>
<v-btn @click="dialog = !dialog" color="primary" dark>New Category</v-btn>
</div>
<v-spacer></v-spacer>
<v-text-field
v-model="search"
append-icon="search"
label="Search"
single-line
hide-details
></v-text-field>
</v-card-title>
</v-card>
</template>
所以右边会占满 space。
您是否尝试过使用边距和填充 classes/props?
<v-container class="red ma-0">
或
<v-container class="red" :ma-0="$vuetify.breakpoint.mdAndDown">
只为移动设备提供全屏?
使用 fluid
道具:
<v-container
fluid
/>
我遇到了同样的问题。
我意识到在我的实例中,parent 和 child 页面上都有一个 <v-content>
。 <v-content>
用于使应用程序看起来漂亮并管理导航栏和标题栏上的间距。
请确保您的应用中只声明了一个。
@Billial Begueradj 发布的答案是完美的。但是,问题可能仍然存在 如果在层次结构 .
上有一个未经检查的 v-container 标记
这行不通
<v-container>
<v-container fluid>This will not work</v-container>
<v-container>
在上面的代码中,内部的 v-container 标签不会实现全角,因为还有另一个 v-container 标签在未设置为全角布局的层次结构中,它会有效地限制内部
这行得通
<v-container fluid>
<v-container fluid> This will work </v-container>
</v-container>
将内部和外部 v-container 标签都设置为占满宽度即可解决。
使用流体并移除填充物(如果有的话)
<v-container fluid class="py-0 px-0"></v-container>
我是 vuetify.js
的新手并开始使用它。
这是我的代码。
管理员-panel.vue
<v-content class="yellow">
<v-container>
<v-layout>
<router-view></router-view>
</v-layout>
</v-container>
</v-content>
创建-user.vue
<template>
<v-container class="red">
<v-layout class="blue">
<v-flex md12>
form
</v-flex>
</v-layout>
</v-container>
</template>
在这里我可以看到 v-container
元素获得了可用的全宽。
我想要的是 create-user 组件中的 v-container
以获得相同的宽度。 (黄色会消失,红色会填满屏幕)
如何实现?
你可以这样试试
master.vue
<v-app id="app">
<v-navigation-drawer
v-model="drawer"
temporary
absolute
>
<sidebar></sidebar>
</v-navigation-drawer>
<v-toolbar dark color="primary" fixed app>
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
<v-toolbar-title class="white--text">MyBlog</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-text-field
color="purple"
id="globalSearch"
name="globalSearch"
label="Search"
v-model="globalSearch"
v-validate="'required'"
></v-text-field>
<v-btn to="dashboard" flat>Dashboard</v-btn>
<v-btn to="login" flat>Login</v-btn>
<v-btn flat>Register</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-content>
<v-container fluid>
<router-view></router-view>
</v-container>
</v-content>
<v-footer height="auto">
<v-card
flat
tile
class="indigo lighten-1 white--text text-xs-center"
>
<v-card-text>
<v-btn
v-for="icon in icons"
:key="icon"
icon
class="mx-3 white--text"
>
<v-icon size="24px">@{{ icon }}</v-icon>
</v-btn>
</v-card-text>
<v-card-text class="white--text">
©2018 — <strong>Eliyas Hossain</strong>
</v-card-text>
</v-card>
</v-footer>
</v-app>
category.vue
<template>
<v-card>
<v-card-title>
<div>
<h2 class="pl-2">Categories</h2>
<v-btn @click="dialog = !dialog" color="primary" dark>New Category</v-btn>
</div>
<v-spacer></v-spacer>
<v-text-field
v-model="search"
append-icon="search"
label="Search"
single-line
hide-details
></v-text-field>
</v-card-title>
</v-card>
</template>
所以右边会占满 space。
您是否尝试过使用边距和填充 classes/props?
<v-container class="red ma-0">
或
<v-container class="red" :ma-0="$vuetify.breakpoint.mdAndDown">
只为移动设备提供全屏?
使用 fluid
道具:
<v-container
fluid
/>
我遇到了同样的问题。
我意识到在我的实例中,parent 和 child 页面上都有一个 <v-content>
。 <v-content>
用于使应用程序看起来漂亮并管理导航栏和标题栏上的间距。
请确保您的应用中只声明了一个。
@Billial Begueradj 发布的答案是完美的。但是,问题可能仍然存在 如果在层次结构 .
上有一个未经检查的 v-container 标记这行不通
<v-container>
<v-container fluid>This will not work</v-container>
<v-container>
在上面的代码中,内部的 v-container 标签不会实现全角,因为还有另一个 v-container 标签在未设置为全角布局的层次结构中,它会有效地限制内部
这行得通
<v-container fluid>
<v-container fluid> This will work </v-container>
</v-container>
将内部和外部 v-container 标签都设置为占满宽度即可解决。
使用流体并移除填充物(如果有的话)
<v-container fluid class="py-0 px-0"></v-container>