Vuetify card expand overlap error in Masonry.js - vuetify.js

I have created a card in which I added a expand button at the bottom. It works perfectly fine in normal mode but when I integrate Masonry.js then the card is working fine and when I expand the bottom of the card it overlaps with the bottom element
image 1
image 2
<v-row class="masonry">
<v-col
class="pa-3"
cols="12"
md="4"
sm="6"
v-for="program in allPrograms"
:key="program._id"
>
<single-card :content="program"></single-card> </v-col
></v-row>
<script>
mounted: function () {
var msnry = new Masonry( '.masonry', {
itemSelector: "[class*='col-']",
});
</script>
Card expansion code
<v-card-actions>
<v-btn color="orange" text #click="openLink(content.timeline)">
Timeline
</v-btn>
<v-spacer></v-spacer>
<v-btn icon #click="show = !show">
<v-icon>{{ show ? "mdi-chevron-up" : "mdi-chevron-down" }}</v-icon>
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-show="show">
<v-divider></v-divider>
<v-card-text class="text-justify">
{{ content.description }}
</v-card-text>
</div>
</v-expand-transition>

after doing a lot of research I found a way to solve it for this I am using https://www.npmjs.com/package/vue-masonry instead of masonry.js
so after every click, we need to redraw our masonry for this we have to use a function this.$redrawVueMasonry('containerId')
for more detail head over to https://www.npmjs.com/package/vue-masonry

Related

Make vuetify app bar items align with <v-container> body content

The stock app bar component aligns items hard left, and if using the v-spacer component will the push items to the hard right.
I have tried wrapping the button items with v-container inside the v-app-bar but it breaks the layout once other components are added.
Ideally, the button on the left would align with hello and likewise with the buttons on the right, they should align with the right side of the v-container of the body.
I tried wrapping v-app-bar with v-container:
This is essentially the layout I want but obviously not with the background colour pushed in, it should fill out the width like in the first image.
Is there a native way to do this or will I need to get creative?
<template>
<v-container>
<v-app-bar
color="indigo accent-4"
dense
flat
dark
>
<v-btn icon>
<v-icon>mdi-home-outline</v-icon>
</v-btn>
<v-divider inset vertical></v-divider>
<v-btn text :key="item.id" v-for="item in items" v-text="item.text"></v-btn>
<v-spacer></v-spacer>
<v-btn text v-text="'Sign In'"></v-btn>
<v-btn text v-text="'Register'"></v-btn>
</v-app-bar>
</v-container>
</template>
Similar question but no answers. Problem with placing v-app-bar content in container?
Found a workaround in the interim, not sure how clean it is:
My solution looks like so:
The colors show the nav bar width adjusted to match the body. The code looks like so:
<template>
<v-sheet color="red">
<v-container class="pa-0">
<v-app-bar
dense
flat
color="blue accent-4"
>
<v-btn icon>
<v-icon>mdi-home-outline</v-icon>
</v-btn>
<v-divider inset vertical></v-divider>
<v-btn text :key="item.id" v-for="item in quickLinks" v-text="item.text"></v-btn>
<v-spacer></v-spacer>
<v-btn text v-text="'Sign In'"></v-btn>
<v-btn text v-text="'Register'"></v-btn>
</v-app-bar>
</v-container>
</v-sheet>
</template>
In case you want the v-app-bar to be fixed to the top of the page, I solved this by wrapping a v-app-bar inside a v-container inside another v-app-bar:
<template>
<v-app-bar app fixed dense color="grey lighten-4" elevation="1">
<v-container>
<v-app-bar dense elevation="0">
<v-app-bar-title nuxt href="/">
My Title
</v-app-bar-title>
</v-app-bar>
</v-container>
</v-app-bar>
</template>

How can you use a v-text-field inside of a v-tooltip?

I want to have a v-text-field inside of a v-tooltip so when a user is shown a tooltip they can enter information inside of the tooltip, but no clicks or input seem to register for the elements inside of the tooltip
<v-tooltip top :open-on-click="true" :open-on-hover="false">
<template v-slot:activator="{ on }">
<v-list-item-content v-on="on">
<v-list-item-title>Title</v-list-item-title>
<v-list-item-subtitle>Subtitle</v-list-item-subtitle>
</v-list-item-content>
</template>
<v-text-field></v-text-field>
</v-tooltip>
Actually tool-tips are used only for show some tips, so the all pointer events will be blocked by css pointer-events: none;, We need to override this style with our CSS.
see my working example here
Template
<v-tooltip v-model="show" top>
<template v-slot:activator="{ on }">
<v-btn icon v-on="on">
<v-icon color="grey lighten-1">mdi-cart</v-icon>
</v-btn>
</template>
<span>Programmatic tooltip</span>
<v-text-field
label="Regular"
></v-text-field>
</v-tooltip>
CSS
.v-tooltip__content{
pointer-events: all;
}
The v-tooltip shows a disabled item when you hover, and the addition of events to this item will not work. You can achieve a similar effect v-menu.
<v-menu bottom right
:close-on-content-click="false">
<template v-slot:activator="{ on }">
<v-list-item-content v-on="on">
<v-list-item-title>Title</v-list-item-title>
<v-list-item-subtitle>Subtitle</v-list-item-subtitle>
</v-list-item-content>
</template>
<v-card class="pa-3">
<v-text-field hide-details v-model="textVal" #change="update"></v-text-field>
</v-card>
</v-menu>
methods: {
update(){
console.log(this.textVal)
}
}

when i run this code on browser ,toolbar appears at the bottom how can i make it on top of browser

<style scoped>
.toolb{
position:absolute
top:0px;
}
</style>
<script>
export default {
data () {
return {
sideNav: false
}
}
}
</script>
<template>
<v-app>
<v-navigation-drawer v-model="sideNav">
<v-list>
<v-list-tile>
<v-list-tile-action>
<v-icon>supervisor_account</v-icon>
</v-list-tile-action>
<v-list-tile-content>View Meetups</v-list-tile-content>
</v-list-tile>
</v-list>
</v-navigation-drawer>
<v-toolbar dark class="primary toolb">
<v-toolbar-side-icon
#click.stop="sideNav = !sideNav"
class="hidden-sm-and-up "></v-toolbar-side-icon>
<v-toolbar-title>DevMeetup</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items class="hidden-xs-only">
<v-btn flat>
<v-icon left dark>supervisor_account</v-icon>
View Meetups
</v-btn>
</v-toolbar-items>
</v-toolbar>
<main>
</main>
</v-app>
</template>
to make toolbar on top i have to use css style ' position
:absloute ; top:0px;' that affect my all other components because i have to use again in all components style ' position
:absloute ; top:50px or 40 px;' and those components are not behaving like they should so please tell how can i fix it ? without using css style only vuetify
.where i study vuetify ,my teacher was using as it is code and its working fine without css ??? only using vuetify in this component .
but if i use v-content to parent of my v-container than i am getting another problem that is navigation-drawer is on top after that toolbar is appearing

Vuetify Dialog with Card and fixed Toolbar

As the title states, I have a component that opens a dialog. The dialog contains a card with a toolbar at the top and a form within the card. I am trying to make the toolbar fixed such that it does not disappear when scrolling. I have tried to add the "fixed" attribute to my toolbar but doesnt seem to give me the results I expect. Below is my code and thanks in advance...
<template>
<v-dialog :value="createToggle" #input="onCancel" persistent :fullscreen="$vuetify.breakpoint.xsOnly" :max-width="dialogWidth">
<v-card>
<v-toolbar fixed flat>
<v-toolbar-title>Title</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon>
<v-icon class="heading grey--text text--darken-4">close</v-icon>
</v-btn>
</v-toolbar>
<v-divider></v-divider>
<v-card-text>
<v-form ref="form">
<v-container>
<v-layout row wrap>
<v-subheader class="">
Section
</v-subheader>
<v-flex xs12 v-for="n in 20">
<v-text-field
label="Field Name"
outline
>
</v-text-field>
</v-flex>
</v-layout>
</v-container>
</v-form>
</v-card-text>
<v-card-actions>
<v-btn>Cancel</v-btn>
<v-btn>Save</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
For me this is work (Vuetify version 2)
Add scrollable prop in <v-dialog>
inside <v-card> use <v-card-title> instead of <v-toolbar>
then your <v-toolbar> put inside <v-card> and remove fixed prop in <v-toolbar>
Last, add class="pa-0" in <v-card-title> for removing the padding in v-card-title element
<template>
<!-- Add Scrollable Prop -->
<v-dialog scrollable :value="createToggle" #input="onCancel" persistent :fullscreen="$vuetify.breakpoint.xsOnly" :max-width="dialogWidth">
<v-card>
<v-card-title class="pa-0">
<v-toolbar flat>
<v-toolbar-title>Title</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon>
<v-icon class="heading grey--text text--darken-4">close</v-icon>
</v-btn>
</v-toolbar>
</v-card-title>
...
<v-card-actions>
<v-btn>Cancel</v-btn>
<v-btn>Save</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
For browsers that support position: sticky (https://caniuse.com/css-sticky), you can use pure CSS to set the toolbar to be sticky positioned at the top:
.v-dialog > .v-card > .v-toolbar {
position: sticky;
top: 0;
z-index: 999;
}
You could write this selector differently if you didn't want this applying to all situations where this occurs in your application - add a specific class to your toolbar, for example.
In my case, fixed title was not working until I did not wrap my div in v-card-text
<template>
<v-dialog v-model="modal" scrollable fullscreen>
<v-card>
<v-card-title>
<span>Title text</span>
</v-card-title>
<!-- VCardText after VCardTitle -->
<v-card-text>
<div>
...
</div>
</v-card-text>
</v-card>
</v-dialog>
</template>
PS. the Vuetify semantic is very important for correct working all of features (ex. using v-card-actions in v-card instead of custom div)

Vuetify, closing Snackbar without closing dialog

I am trying to combine the use of a dialog and a snackbar with VueJS. The problem is the following:
Expected Behaviour:
I should be able to close the snackbar without closing the dialog
What happens now:
The dialog is being closed when the snackbar is clicked
Here is a JSFiddle to reproduce: https://jsfiddle.net/q6m2j4ae/5/
Here is the markup for the problem:
<v-container>
<v-dialog v-model="displayDialog" max-width="300px">
<v-card flat>
This is the dialog content
</v-card>
</v-dialog>
<v-snackbar
v-model="displaySnackbar"
:top="true"
:right="true"
:vertical="true"
color="success"
>
Some Content
<v-btn flat #click.stop="displaySnackbar = false">Close</v-btn>
</v-snackbar>
</v-container>
As you can see, the v-snackbar is at the same level of the dialog. I am not allowed to nest the snackbar into the dialog. But even if I try the snackbar is not even displayed.
What I tried:
I thought that the stop modifier on the click event #click.stop="displaySnackbar = false" would be enough to not close the dialog.
I checked the z-index applied to the elements. The snackbar has a z-index: 1000 and the dialog has a z-index:200. So I'm not able to adjust that value.
Is it a bug? How could I solve the problem on my hand?
A workaround (if the "dismiss on clicking outside the dialog" function is not needed) is to add the property persistent to the dialog.
The click outside the dialog (when clicking the close in the snackbar) is the reason your dialog gets dismissed
For anyone still looking for a good solution: add <div class="v-menu__content--active" style="display:none; z-index:1000;"></div> as a child of your v-snackbar. This tricks v-dialog to think it was not the active component when click outside happened and prevents closing.
I had the same problem. I have produced a solution :
https://codepen.io/alignnc/pen/OdWvJd
<template>
<div id="app">
<v-app id="inspire">
<v-layout row justify-center>
<v-btn
color="primary"
dark
#click.native.stop="dialog = true">
Open Dialog
</v-btn>
<!-- dialog -->
<v-dialog
v-model="dialog"
max-width="290"
:transition="false"
:persistent="snack">
<v-card>
<v-card-text>
Click "agree" to set <br>
this.dialog to false,<br>
and this.snack to true
</v-card-text>
<v-btn
#click.prevent ="snack = true">
Agree
</v-btn>
</v-card>
</v-dialog>
<v-snackbar
v-model='snack'
color='error'
:top='true'>
Hello
<v-btn
color="accent"
flat
#click="snack = false">
Close
</v-btn>
</v-snackbar>
</v-layout>
</v-app>
</div>
</template>
<script>
new Vue({
el: '#app',
data () {
return {
dialog: false,
snack: false
}
}
})
</script>

Resources