Neither establish a space immediately before or within a link nor any kind of link works fine while using links within the label attribute - It only checks the box. Using mousewheel works. How to target a new tab with simple leftclick?
<v-checkbox
v-model="checkbox"
:rules="[v => !!v || 'Its required!']"
label=""
required
>
<template v-slot:label>
URL_A
<v-btn href="/#/URL" target="_blank" > URL_B </v-btn>
<navigation-link url="/#/URL" target="_blank">
URL_C
</navigation-link>
</template>
</v-checkbox>
This will not work. When you associate a <label> element with a checkbox <input> (which is what Vuetify is doing behind the scenes), clicking on the label is supposed to toggle the value of the checkbox. It cannot also be a link because then the click action would be ambiguous. If someone clicks the link, should it open the link or toggle the checkbox? It appears that toggling the checkbox wins in this case.
If you need link text to go next to your checkbox, it has to be its own separate element. You can use CSS to get the two elements to line up:
<v-row>
<v-col cols="12">
<v-checkbox
v-model="checkbox1"
color="primary"
:rules="[v => !!v || 'Its required!']"
required
>
<template #label>
This link cannot be clicked
</template>
</v-checkbox>
</v-col>
<v-col cols="12">
<v-checkbox
v-model="checkbox1"
class="pa-0 ma-0"
color="primary"
:rules="[v => !!v || 'Its required!']"
required
style="float: left;"
></v-checkbox>
This link CAN be clicked
</v-col>
</v-row>
There's a working demo in this codeply.
Just use #click.stop on the link:
<v-checkbox v-model="checkbox">
<template v-slot:label>
<a href="/#/URL" target="_blank" #click.stop> URL_A </a>
</template>
</v-checkbox>
It´s done by using a modal:
<v-container v-if="showModal" class="modal-mask white--text">
<transition name="modal">
<v-container >
<v-container class="modal-wrapper">
<v-container class="modal-dialog">
<v-container class="modal-content">
<v-container class="modal-header">
<h4 class="modal-title">Title</h4>
</v-container>
<v-container class="modal-body">
Lorem ipsum
</v-container>
<v-container two-line>
<v-btn color="primary" class="close" #click="showModal=false">
<span>Close</span>
</v-btn>
</v-container>
</v-container>
</v-container>
</v-container>
</v-container>
</transition>
</v-container>
<script>
export default {
data: () => {
return {
showModal: false
}
}
}
</script>
<style>
.modal-mask {
position: fixed;
z-index: 9998;
top: 0%;
left: -10px;
height: 100%;
max-width: none;
background-color: rgba(0, 0, 0, .8);
display: table;
transition: opacity .3s ease;
}
.modal-wrapper {
display: table-cell;
vertical-align: top;
}
.modal-dialog{
overflow-y: initial !important
}
.modal-body{
height: 500px;
overflow-y: auto;
}
</style>
Related
I'm having trouble solving one of the problems I've been given.
I can't see my index page in the pages folder, where could the problem come from?
index.vue
<template>
<h1>
Hello world
</h1>
</template>
I made another page with about address but it still had this problem.
Update
default.vue
<template>
<v-app :dark="setTheme" class="d-print-none" :rtl="true">
<v-toolbar
dense
flat
color="#fafafa00"
style="position: fixed; top: 0px; right: 0px; z-index: 5;"
>
<v-menu offset-y transition="slide-y-transition">
<template #activator="{ on }">
<v-btn class="ma-2 d-print-none" small text icon v-on="on">
<v-icon>mdi-apps</v-icon>
</v-btn>
<template>
<my-menu-app/>
</template>
</template>
<menuCard/>
</v-menu>
</v-toolbar>
</v-app>
</template>
Your problem is your layout.
add Nuxt tag for render your page.
<template>
<v-app :dark="setTheme" class="d-print-none" :rtl="true">
<v-toolbar
dense
flat
color="#fafafa00"
style="position: fixed; top: 0px; right: 0px; z-index: 5;"
>
<v-menu offset-y transition="slide-y-transition">
<template #activator="{ on }">
<v-btn class="ma-2 d-print-none" small text icon v-on="on">
<v-icon>mdi-apps</v-icon>
</v-btn>
<template>
<my-menu-app/>
</template>
</template>
<menuCard/>
</v-menu>
</v-toolbar>
<Nuxt/> // add Nuxt tag in your layout
</v-app>
</template>
I can't figure out why my v-list won't update the color whatever i do.
here is my code
<template>
<v-app>
<v-navigation-drawer app>
<div style="background-color: grey;" class="d-flex justify-center pa-4 ">
Fichiers chargés
</div>
<div class="d-flex flex-column ">
<v-btn prepend-icon="mdi-folder" class="mt-4 mb-2 mx-auto text-black bg-green hidden-sm-and-down"
plain>Parcourir
..</v-btn>
<v-checkbox class="mx-auto" label="Ajout auto. en base"></v-checkbox>
</div>
<v-divider></v-divider>
<v-list class="my-list" color="primary" >
<v-list-tile v-for=" f in fichiers">
<v-card-text class=" mx-5 px-5 bg-red">
{{ f.nom }}
</v-card-text>
</v-list-tile>
<v-divider></v-divider>
<v-list-item style="width: 0100%;">
<div style="text-align: center;">
{{ fichiers.length }} Fichiers Chargés
</div>
</v-list-item>
</v-list>
</v-navigation-drawer>
</v-app>
</template>
<style>
.my-list {
background-color: red;
}
</style>
<script setup>
let fichiers = [
{
nom: "Fichier1",
taille: "2ko",
contenu: "jhbjm",
etat: [],
}
]
</script>
in my devtools i can see that the v-list took the bg-transparent. I tried everything to force it but nothing happened
sorry for my bad english XD
The Solution :
Don't forget to give a feedback.
Use "!important" in your "background-color" value
.my-list {
background-color: red !important;
}
Use the "id" selector if you don't want to use "!important"
#the-list {
background-color: red;
}
<v-list id="the-list" color="primary" >
<v-list-tile v-for=" f in fichiers">
...
</v-list-item>
</v-list>
The reason of your problem :
If you look at the browser developer tool, you'll find that the class "v-list" is written before your custom class "my-list". That means, the priority is not for your custom class.
I have the next carousel made with vuetify and I need to move both arrows up, in order to do that I need to have a top:0 in both v-window__next and v-window__prev class but I don't know how to give the property to the component
This is a piece of the code
<v-carousel
hide-delimiters
height="100%"
>
<v-carousel-item
v-for="(item,i) in yearsMonthsUsed"
:key="i"
>
<v-row
class="ma-0"
align="center"
justify="center"
>
<v-col
cols="12"
sm="12"
align="center"
justify="center"
>
<div class="text-h6">
{{ item.annio }}
</div>
</v-col>
<v-col
cols="12"
sm="1"
v-for="mes in meses"
:key="mes.mes"
>
<v-btn
fab
depressed
x-small
:color="pickColor(item.annio,mes.cod)"
:class="{'disable-events': true}"
>
<v-icon>
{{ mdiCalendar }}
</v-icon>
</v-btn>
{{ mes.mes.substr(0, 3) }}
</v-col>
</v-row>
</v-carousel-item>
</v-carousel>
I tried adding Slots inside v-carousel like this
<template v-slot:next="{ on, attrs }" :class="myClas" />
<style lang="scss" scoped>
.myClas {
top: 0;
}
</style>
but it didn't work
You can assign a class to v-carousel and set the style of the arrows from there.
<v-carousel class="myCarousel"><!-- content --></v-carousel>
<style>
.myCarousel .v-window__prev, .myCarousel .v-window__next {
top: 0;
}
</style>
You can enter like this onto or into style.scss.
.v-window__prev{
position: absolute;
left:-95px;
top: 0px;
}
Ok so I created a grid with cards inside that I want to dynamically href and it's working but it's giving me an "undefined" URL path when clicking on any of the cards that showed on the page.
Ive tried using the <template v-slot:item.years="{ item }"> way but its clashing with the <v-hover v-slot:default="{ hover }">
Any help would be appreciated
<template>
<v-container>
<v-row v-for="n in 1" :key="n" no-gutters class="pa-7">
<v-col v-for="n in 6" :key="n" :cols="n === 1 ? 4 : 4">
<v-hover v-slot:default="{ hover }">
## here I am trying to dynamically href the cards so that I can assign URLs outside of the website to them
<a class="text-decoration-none" target="blank" :href="`${years.href}`">
<v-card flat tile class="d-flex">
<v-img
:src="`https://picsum.photos/500/500?image=${n * 5 + 10}`"
:lazy-src="`https://picsum.photos/10/6?image=${n * 5 + 10}`"
class="grey lighten-5"
:aspect-ratio="12/8.5"
>
<v-expand-transition>
<div
v-if="hover"
class="d-flex transition-fast-in-fast-out black darken-2 v-card--reveal display-3 white--text"
style="height: 100%;"
>View Card</div>
</v-expand-transition>
<template v-slot:placeholder>
<v-row class="fill-height ma-0" align="center" justify="center">
<v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
</v-row>
</template>
</v-img>
</v-card>
</a>
</v-hover>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
data: () => ({
years: [
{
href: "https://www.google.com",
text: "me",
},
{
text: "me",
href: "https://www.bing.com",
},
{
text: "twice",
href: "https://www.facebook.com",
},
],
}),
};
</script>
<style>
.v-card--reveal {
align-items: center;
bottom: 0;
justify-content: center;
opacity: 0.5;
position: absolute;
width: 100%;
}
</style>
You attempted to access years's href property here: :href="years.href", which gives you undefined since years is an array.
Also, you can properly layout your data to something like this:
years: [
{
text: "me",
href: "https://www.google.com",
src: "https://picsum.photos/500/500?image=1",
lazySrc: "https://picsum.photos/10/6?image=1"
},
...
]
and use it like on your html like this:
<v-row no-gutters class="pa-7">
<v-col v-for="(year, i) in years" :key="i" :cols="i === 1 ? 4 : 4">
<v-hover v-slot:default="{ hover }">
<a class="text-decoration-none" target="blank" :href="`${year.href}`">
<v-card flat tile class="d-flex">
<v-img
:src="year.src"
:lazy-src="year.lazySrc"
class="grey lighten-5"
:aspect-ratio="12/8.5"
>
<v-expand-transition>
<div
v-if="hover"
class="d-flex transition-fast-in-fast-out black darken-2 v-card--reveal display-3 white--text"
style="height: 100%;"
>View Card</div>
</v-expand-transition>
<template v-slot:placeholder>
<v-row class="fill-height ma-0" align="center" justify="center">
<v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
</v-row>
</template>
</v-img>
</v-card>
</a>
</v-hover>
</v-col>
</v-row>
Here is a sample demo.
Sorry but undefined is what you're going to get. years is an array and you're trying to access the href property of that object in the array. So in order to get the href property, you will need to iterate through the array to access those properties of the object using a v-for.
Good day,
This way I have the template in one component.
<template>
<v-card fluid>
<div class="text-xs-center">
<v-btn outline small fab color="indigo" #click="abrirmodalBusqueda()">
<v-icon>search</v-icon>
</v-btn>
</div>
<div id="map">
<l-map style="height: 500px; width: 100%" :zoom="zoom" :center="center" #update:center="centerUpdate">
<l-tile-layer :url="url"></l-tile-layer>
<l-marker :lat-lng="marker" >
<l-popup>Estoy en estas coordenadas asadsad {{latitud}}</l-popup>
</l-marker>
<l-marker v-for="marker in markers" :lat-lng="marker">
<l-popup>Estoy en estas coordenadas asadsad {{marker.lat}}
<v-flex xs12 sm4 text-xs-center>
<div>
<v-btn small color="primary" #click="dialogParqueos = true">Seleccionar</v-btn>
</div>
</v-flex>
</l-popup>
</l-marker>
</l-map>
</div>
</v-card>
</template>
When using the property of height in px and not in% I can already visualize the map l-map style = "height: 500px" since if I use 100% the map can not be seen. The problem that when making use of v-navigation-drawer the map is assembled in the following way:
As you notice, it overlaps the left panel. For the map I am using the Vue2Leaflet library. Thank you in advance.
SOLUCION:
<v-container>
<v-card
class="pa-3"
flat
height="550px"
width="100%"
>
<l-map style="height: 100%; width: 100%; position: sticky !important;" :zoom="zoom" :center="center">
<l-tile-layer :url="url"></l-tile-layer>
<l-marker :lat-lng="markerLatLng" ></l-marker>
</l-map>
</v-card>
</v-container>
add position:sticky !important; in the style.