Version: 0.9.0
Slides has wrong width on first init.
It looks like reason of this is calculating slides width right after component init, when fonts are not loaded yet.
UPDATE: Here is my repository with demo page.
demo page.After it all resources would be cached already and you need to clear cache with Ctrl + F5 to reproduce bug again.
Slides fix its width only after all resources are loaded.
Slides fix its width right after initialization.
Hey @Ohar, great reporting! I'll mark this as a bug report and see if we can get someone to submit a fix! We're currently working on the way slide/carousel width is calculated, so if this is effected by the changes I'll make sure to report here :~)
same issue
use ready (jquery)
For example
<template>
<carousel :per-page-custom="[[320, 1], [425, 1], [768, 2], [1024, 3]]" :paginationActiveColor="'#00bddc'" :paginationColor="'#99e8ff'">
<slide v-for="item in items" :key="item.id">
<div class="item">
<div class="img">
<img :src="'/storage/app/' + item.image" alt="">
</div>
<div class="description">
<div class="created">
<img src="images/edit.png" alt="">
<div class="text">{{ item.created_at }}</div>
</div>
<div class="title">{{ item.title }}</div>
<div class="text">{{ item.short_text }}</div>
<div class="button">
<a :href="item.more" class="btn">more</a>
</div>
</div>
</div>
</slide>
</carousel>
</template>
import { Carousel, Slide } from 'vue-carousel';
export default {
name: "publications",
components: {
Carousel,
Slide
},
data(){
return {
items: [],
}
},
props: ['data'],
mounted(){
let el = this;
$(document).ready(function() {
el.items = el.data;
});
}
}
^ you can do the same in plain javascript without having to load in jQuery
document.addEventListener("DOMContentLoaded", function(event) {
// do something
});
@dmitr11 Could you possibly elaborate on what exactly el.data is?
You pass in the data prop but use it for nothing else except, el.items = el.data.
So could you possibly elaborate on what this data actually is?
^ you can do the same in plain javascript without having to load in jQuery
document.addEventListener("DOMContentLoaded", function(event) { // do something });
Hey @quinnlangille
I tried this but it didn't work. It never got triggered in Vue for some reason. :/
Tried both es5 and es6 syntax.
mounted() {
document.addEventListener('load', function(event) {
console.log('event listener');
});
document.addEventListener('DOMContentLoaded', event => {
console.log('event listener');
});
},
@marbuser are you getting any JS errors in your console?
Most helpful comment
same issue