I'm trying to prevent two scroll bars appearing when using Vuetify's sheet and calendar.
Here is my code:
<template>
<v-app>
<v-main>
<v-container fluid class="fill-height">
<v-row justify="center" class="fill-height">
<v-col cols="12" class="fill-height">
<v-sheet class="fill-height">
<v-calendar type="week" />
</v-sheet>
</v-col>
</v-row>
</v-container>
</v-main>
</v-app>
</template>
Just override the CSS of Vuetify Calendar Component to remove a redundant scroll-bar:
.v-calendar-daily__scroll-area {
overflow-y: hidden !important;
}
Also remove the class="fill-height" from the v-sheet , it make a bit overlap for calendar. I don't know why you added it.
Check it out here:
https://codepen.io/nmdatit/pen/OJpdwox
Related
I'm building an app in Vuejs 3 w/ Vuetifyjs 3 and I'm running into the problem where the density="compact" row size between a v-checkbox and v-radio has a huge difference. Look at the image below, it is from two different v-cards, using v-lists. All the code is exactly the same, with the only difference that one uses v-radio and the other v-checkbox. How can I make force the v-checkbox to have the exact same lineheight as the v-radio? CSS hacks are acceptable.
I read in another post that I should wrap them in a v-layout but that has no effect.
Radio button code:
<v-card>
<v-card-title>
CARD TITLE GOES HERE
</v-card-title>
<v-list density="compact">
<v-list-item>
<v-sheet>
<v-row>
<v-col cols="2">
<v-layout>
<v-radio density="compact" dense inline></v-radio>
</v-layout>
</v-col>
<v-col cols="6">
{{ model.productName }
</v-col>
<v-col cols="4" class="center-content text-h7 text-red font-weight-bold">
€ {{ model.price }}
</v-col>
</v-row>
</v-sheet>
</v-list-item>
</v-list>
</v-card>
Checkbox code:
<v-card>
<v-list density="compact">
<v-list-item>
<v-sheet>
<v-row>
<v-col cols="2">
<v-layout>
<v-checkbox-btn density="compact" hide-details="true" inline></v-checkbox-btn>
</v-layout>
</v-col>
<v-col cols="6">
{{ model.productName }}
</v-col>
<v-col cols="4" class="center-content text-h7 text-red font-weight-bold">
€ {{ model.price }}
</v-col>
</v-row>
</v-sheet>
</v-list-item>
</v-list>
</v-card>
Uh, I have struggled with that too.
You can try <v-checkbox hide-details/>. A lot of the space is taken up by the message area from v-input, and setting the hide-details attribute will hide the area when there are no messages. Checkboxes will not align with inputs anymore though.
If that is not enough, you can unset the min-height from the element. This will align with v-radio (If you change css in scoped styles, you need to use the deep selector to target nested elements):
<style scoped>
.container-class :deep(.v-checkbox .v-selection-control) {
min-height: unset;
}
</style>
Here is an overview (the red bars are message areas):
I have an app with a navbar which should remain static on the left side of the screen.
On the rest of the screen there is a list of items, which can be unlimited for all I care.
The issue is, the navbar is growing to match that list and is scrolling along. I want it to be static regardless of the list's size.
App.vue file template:
<template>
<div id="app">
<v-app>
<v-row>
<navbar/>
<v-main>
<v-container class="main-container">
<my-item-list/>
</v-container>
</v-main>
</v-row>
</v-app>
</div>
</template>
This is what my Navbar component looks like:
<template>
<v-navigation-drawer v-model="drawer" :mini-variant.sync="mini" permanent>
<v-layout justify-space-between column fill-height>
<v-list>
<v-list-item class="px-2">
<v-list-item-avatar>
<v-img src="http://placekitten.com/200/300"></v-img>
</v-list-item-avatar>
</v-list-item>
<v-divider></v-divider>
<v-list-item
v-for="setting in settings.top"
:key="setting.id"
/>
</v-list>
<v-list>
<v-list-item
v-for="setting in settings.bottom"
:key="setting.id"
/>
</v-list>
</v-layout>
</v-navigation-drawer>
</template>
Here are also some screenshots of what is going on:
As you can see here I have all the item of my navbar nicely fitting in my screen, which is how I want it.
However, in the next image:
We now have so many items that it causes the screen to scroll, which is fine btw. The issue is, you can see that the navbar also stretches out to match the scrolling of the items. I would like the navbar to stay just the same as in the first image regardless of how many items are added.
The problem is using v-row to wrap the entire layout. v-row makes the layout flexbox and therefore both child items (the navbar and the main content) become the same height. Remove the v-row and instead use v-content around the main container list. Finally, use the app prop on the v-navigation-drawer...
<v-app>
<v-navigation-drawer
v-model="mainSidebarDrawer"
permanent
app
expand-on-hover
#transitionend="collapseSubItems"
>
<v-layout justify-space-between column fill-height>
<v-list>
..
</v-list>
<v-list>
..
</v-list>
</v-layout>
</v-navigation-drawer>
<v-content>
<v-main>
</v-main>
</v-content>
</v-app>
Demo
I'm using Vuetify.js as UI framework of Nuxt.js,
I want to change the color of checkbox when check box disabled value change "false".
I thought if I change the value of the part corresponding to the checkbox with CSS, I could change the color of checkbox. But it didn't work.
Could anyone advise me?
My code is following code.
<template>
<v-card>
<v-card-text>
<v-container>
<v-row>
<v-col cols="4">
<v-checkbox
:label="`Checkbox A:${checkboxA}`"
v-model="checkboxA"></v-checkbox>
</v-col>
<v-col cols="4">
<v-checkbox
:label="`Checkbox B:${checkboxB}`"
:disabled="!checkboxA"></v-checkbox>
</v-col>
</v-row>
</v-container>
</v-card-text>
</v-card>
</template>
<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
#Component({})
export default class extends Vue{
checkboxA:boolean = false
checkboxB:boolean = false
checkboxC:boolean = false
}
</script>
<style lang="scss" scoped>
.div ::v-deep .v-input--selection-controls__input{
background: gray;
}
</style>
In case anyone still has this issue. Instead of using disabled prop, you can use the readonly prop and still be able to set colour="success" or any other colour you want.
Using scoped in style is a bit tricky. With scoped, the parent component's styles will not leak into child components. You can use the deep selector >>> (like explained here) but I think this solution is not the best. Css is better using the BEM notation. In your case, I would do :
<template>
<v-card>
<v-card-text>
<v-container class="Card__container">
<v-row>
<v-col cols="4">
<v-checkbox
:label="`Checkbox A:${checkboxA}`"
v-model="checkboxA"></v-checkbox>
</v-col>
<v-col cols="4">
<v-checkbox
:label="`Checkbox B:${checkboxB}`"
:disabled="!checkboxA"></v-checkbox>
</v-col>
</v-row>
</v-container>
</v-card-text>
</v-card>
</template>
<script lang="ts">
...
</script>
<style lang="scss">
.Card__container {
.v-input--selection-controls__input{
background: gray;
}
}
</style>
Thanks to that, no risk of conflict with the other components.
I am using v-container > v-layout > v-row of Vuetify.js, and contents of v-row keep exceeding width of the viewport. I tried the "overflow-x-hidden" class but that was not what I expected.
I will really appreciate it if you let me know to make v-row fill the viewport's width without exceeding it.
Thanks
<template>
<div id="app" class="back">
<v-container fluid>
<v-layout row wrap>
<v-row >
<br><br><br><br>asdf
</v-row>
</v-layout>
</v-container>
</div>
</template>
The v-row component is not designed to contain your content directly. Inside v-row, each section of your content should be wrapped in a v-col component, like this:
<template>
<div id="app" class="back">
<v-container fluid>
<v-row >
<v-col cols="12"> <!-- You can change the COLS attribute to make columns display side-by-side -->
<br><br><br><br>asdf
</v-col>
</v-row>
</v-container>
</div>
</template>
You can read more about Vuetify's grid system here.
EDIT:
Also, you should not use v-layout and v-row in combination. v-layout is for Vuetify 1.x. v-row is for Vuetify 2.x. If you use v-layout, its child component should be v-flex instead of v-col.
My vue page have a photo gallery, and when a photo is selected, the dialog will jump out by setting the selectedCard.
While the image is not fitting the size of the screen.
I tried to set css with max height or width with 100% anywhere I can, but none of them are working.
How can I fix my css so that the whole image can be view on the screen without scrolling?
Screen cap: only half of the image can be shown
//Dialog component
<template>
<v-dialog :value="selectedCard" scrollable fullscreen hide-overlay>
<v-card v-if="selectedCard">
<v-container grid-list-sm fluid>
<v-layout align-space-around row fill-height>
<v-flex id="mainCardPanel">
<v-layout align-space-around column fill-height>
<v-flex xs12>
<MyCard class="mainCard" :card="selectedCard"></MyCard>
</v-flex>
<v-flex xs12>
<v-btn> SomeButton </v-btn>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-container>
</v-card>
</v-dialog>
</template>
// MyCard component
<template>
<v-card flat tile class="d-flex justify-center" >
<v-img :contain="true" :src=card.imageUrlHiRes
:lazy-src=card.imageUrl class="grey lighten-2 Card">
<template v-slot:placeholder>
<v-layout fill-height align-center justify-center ma-0>
<v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
</v-layout>
</template>
</v-img>
</v-card>
</template>
Try using vh for your image height.
Perhaps this may work:
img {
height:100vh;
}
add css width and hieght to 100%
img {
width:100%;
height:100%;
}
If you want to appear full image use :cover="true" in <v-img>.
If you you want to appear the whole image, you can put follow CSS.
.v-image__image{
background-size:100% 100%;
}
This is not recommended way.Because image's ratio will be wrong.
Using pure HTML appears to even be simpler and better for me. The vuetify just complicate simple things sometimes. Use v-col, div, any block...
<v-row class="fill-height"
justify="center"
align="center"
style="background-image: url('card.imageUrlHiRes');
background-size: cover;" >
</v-row>