how to create vuetify icon slid console - vue.js

i am new for vuetify implementing vuetify icon slid console but im confuse.
below console code contained image slide show, using this code i what to implement example image
i want to show like this
<template>
<v-carousel
cycle
height="400"
hide-delimiter-background
show-arrows-on-hover
>
<v-carousel-item
v-for="(slide, i) in slides"
:key="i"
>
<v-sheet
:color="colors[i]"
height="100%"
>
<v-row
class="fill-height"
align="center"
justify="center"
>
<div class="display-3">{{ slide }} Slide</div>
</v-row>
</v-sheet>
</v-carousel-item>
</v-carousel>
</template>
<script>
export default {
data () {
return {
colors: [
'indigo',
'warning',
'pink darken-2',
'red lighten-1',
'deep-purple accent-4',
],
slides: [
'First',
'Second',
'Third',
'Fourth',
'Fifth',
],
}
},
}
</script>

You can define a <v-row/> inside the <v-carousel-item/> then fill it with <v-col/>. Each <v-col/> represents the image/icon and the caption.
<v-carousel
...
>
<v-carousel-item v-for="(slide, i) in 7" :key="i">
<v-row>
<v-col cols="3" v-for="(images, j) in 16" :key="j">
<div class="d-flex flex-column justify-center align-center">
<v-img src="https://via.placeholder.com/50" width="50"/> <!-- can also be `<v-icon/>` -->
<span class="mx-auto text-center caption">Caption</span>
</div>
</v-col>
</v-row>
</v-carousel-item>
</v-carousel>
Here's a sample demo.

Related

Vuetify Nuxt.js : how to add url link in image tag

i am new in Nuxt.js and Vuetifiy i want to add url link in image tag. if i press image it should open other page link
my page layout
i have specified urls each image have different url like i want to add this url to image
to="/AppMain/Support/Support"
and
to="/UserDash/Profile"
also
to="/AppMain/Entertainment"
how to add this urls in image
my code
<template>
<v-layout style="width: auto;" class="ma-auto">
<v-carousel cycle light height="309" hide-delimiter-background show-arrows-on-hover>
<v-carousel-item v-for="(slide, i) in slides" :key="i">
<v-row>
<v-col cols="3" v-for="(images, j) in slide.images" :key="j">
<div class="d-flex flex-column justify-center align-center">
<v-img :src="images.src" width="30"/>
<span class="mx-auto text-center caption">{{ images.caption }}</span>
</div>
</v-col>
</v-row>
</v-carousel-item>
</v-carousel>
</v-layout>
</template>
<script>
export default {
name: "playground",
data: () => ({
slides: [
{
images: [
{ src: "https://akam.cdn.jdmagicbox.com/images/icontent/newwap/newprotmore/hkm_allcategories.svg", caption: "All Categories"},
{ src: "https://akam.cdn.jdmagicbox.com/images/icontent/newwap/newprotmore/hkm_b2b.svg", caption: "B2B" },
{ src: "https://akam.cdn.jdmagicbox.com/images/icontent/newwap/newprotmore/hkm_shopping.svg", caption: "Shopping" }
]
},
Just wrap it:
Use <nuxt-link />:
<nuxt-link to="#">
<v-img :src="images.src" width="30"/>
</nuxt-link>
If you add the urls to the slide.images array, you can dynamically assign them:
<nuxt-link :to="images.url">

Dynamically assign urls to cards vuejs

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.

How to make v-skeleton-loader inside v-for in vuetify?

I am trying to show a v-skeleton-loader in Vuetify. I have used v-if and v-else. If the image is not loaded, then it should show the skeleton loader. Otherwise, it should should show the image. This is my code:
<template>
<v-col v-for="option in options" :key="option.id" cols="6">
<v-lazy :options="{ threshold: 0.5 }" min-height="130">
<v-hover v-slot="{ hover }">
<v-card id="options_card" link width="160">
<v-sheet v-if="!images" class="px-3 pt-3 pb-3">
<v-skeleton-loader max-width="300" type="image"></v-skeleton-loader>
</v-sheet>
<v-img
v-else
id="thumbnail"
width="100%"
height="130"
:src="option.thumbnail"
></v-img>
</v-card>
</v-hover>
</v-lazy>
</v-col>
</template>
<script>
export default {
data() {
return {
images: false,
}
},
mounted() {
this.images = true
},
}
</script>
But the v-skeleton-loader is not seen on the screen.
VImage has a placeholder slot that would be used for customizing the loader component to be shown while the image is loading:
<v-img>
<template v-slot:placeholder>
<v-sheet>
<v-skeleton-loader />
</v-sheet>
</template>
</v-img>
demo
<v-img>
<template v-slot:placeholder>
<v-sheet>
<v-skeleton-loader />
</v-sheet>
</template>
</v-img>

How to create equal height v-cols in Vuetify and vertically center image?

I can't seem to get two columns the same height with the image centered in Vuetify. I've tried everything and don't know what I'm doing wrong. I hope this image explains what I wan't to achieve.
Below is a snippet, but it doesn't look like what I'm seeing locally. I don't think it really matters as the cols aren't the same height neither.
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: () => ({
showPassword:false,
valid: false,
wachtwoord:'',
wachtwoordRules: [
v => !!v || 'Wachtwoord is vereist',
],
email: '',
emailRules: [
v => !!v || 'E-mail is vereist',
v => /.+#.+\..+/.test(v) || 'Voer een geldig e-mailadres in',
]
}),
methods: {
validate () {
this.$refs.form.validate()
},
},
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuetify/2.3.2/vuetify.min.js"></script>
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet"/>
<div id="app">
<v-app style="
background-color: #011c40;
background-image: linear-gradient(180deg, #011c40 50%, rgb(26, 65, 115) 100%);
background-size: cover;
">
<v-main>
<v-container fill-height>
<v-row justify="center"
align="center"
no-gutters
class="grey">
<v-col cols="4" class="grey lighten-5">
<v-img src="http://www.dpereira.nl/Er/img/banner.png"></v-img>
</v-col>
<v-col align="center" cols="4" class="grey lighten-5 pa-10">
<v-img class="mb-7" src="https://cdn.vuetifyjs.com/images/logos/vuetify-logo-dark.png" width="200px"></v-img>
<v-form ref="form"
v-model="valid"
>
<v-text-field
v-model="email"
:rules="emailRules"
label="E-mail"
required/>
<v-text-field
:type="showPassword ? 'text' : 'password'"
label="Wachtwoord"
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
#click:append="showPassword = !showPassword"
v-model="wachtwoord"
:rules="wachtwoordRules"
required
/>
<v-checkbox class="mt-0" dense label="Onthoud mij"></v-checkbox>
</v-form>
<v-btn height="50px" :disabled="!valid" tile ripple depressed block color="secondary" #click="validate">Inloggen</v-btn>
<div class="pt-3">
<v-divider></v-divider>
<div class="d-block caption text-center mt-3">Wachtwoord vergeten?</div>
<div class="d-block caption text-center">Nog geen account? Meld u hier aan.</div>
</div>
</v-col>
</v-row>
</v-container>
</v-main>
</v-app>
</div>
At first you need to remove align="center" from the row. Then add contain attribute to v-img tag and set the column to disply:flex. Example:
<v-col cols="4" class="grey d-flex lighten-5">
<v-img contain src="http://www.dpereira.nl/Er/img/banner.png"></v-img>
</v-col>

How to align v-cols horizontally in vuetify?

I would like to align all seven of those buttons centered. As you can see the last one is a bit off compared to the first one.
How do I achieve this?
I've already tried justify="center" and justify="space-around"
Here is my code:
<v-row no-gutters justify="space-around">
<v-col v-for="(item, index) in buttons" :key="index">
<toggle-button
:weekday="item.weekday"
:button="item.state"
></toggle-button>
</v-col>
</v-row>
Here is the toggle-button component:
<template>
<v-btn
outlined
depressed
:class="button ? 'primary white--text' : 'outlined'"
#click="button ? (button = false) : (button = true)"
v-model="button"
icon
>
{{ $t("roomservice.weekdays." + weekday) }}
</v-btn>
</template>
<script>
export default {
data() {
return {};
},
props: ["button", "weekday"]
};
</script>
v-col is not a flex and contents inside (toggle-button) are justified to start form left.
you can fix this by adding class="d-flex justify-center" on v-col
<v-row no-gutters justify="space-around">
<v-col
class="d-flex justify-center"
v-for="(item, index) in buttons"
:key="index">
<toggle-button
:weekday="item.weekday"
:button="item.state"
></toggle-button>
</v-col>
</v-row>