Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error details: TypeError: Cannot read properties of undefined (reading 'unobserve') Go back to home #257

Open
NguyenThao1912 opened this issue Aug 16, 2022 · 1 comment

Comments

@NguyenThao1912
Copy link

Im getting this errror when use this library can someone help me fix this
Here is my code and script

`

<body>
    <section id="banner">
        <vue-slick-carousel v-bind="settings">
            <div>
                <img class="w-full h-full" src="~/assets/uploads/images/banner_1.jpg" alt="" />
            </div>
        </vue-slick-carousel>
    </section>

    <div class="container mx-auto px-6 rounded-md shadow-2xl bg-red-100 mt-5 p-5">
        <section class="block relative">
            <div class="_heading_container p-1 font-semibold text-xl">
                <h2>acbxyz</h2>
            </div>

            <div class="_home_list_popular relative pr-2 pl-2 pt-3">
                <vue-slick-carousel v-bind="settings_banner">
                    <div v-for="item in info.data" :key="item.id">
                        <div class="_item_container flex relative h-52 w-40 rounded-md overflow-hidden">
                            <div class="_item_background_image h-full w-full rounded-md"
                                :style="{ backgroundImage: `url(${item.thumbnail})` }"></div>
                            <div
                                class="_item_name_container absolute w-full h-full flex justify-center items-end pb-1 pr-1 pl-1">
                                <span class="_item_name text-base p-1 font-medium"> {{ item.name }}</span>
                            </div>
                        </div>
                    </div>
                </vue-slick-carousel>
            </div>

        </section>
        <section></section>
    </div>
</body>

`

`<script>
import VueSlickCarousel from 'vue-slick-carousel'
import 'vue-slick-carousel/dist/vue-slick-carousel.css'
// optional style for arrows & dots
import 'vue-slick-carousel/dist/vue-slick-carousel-theme.css'
export default {
components: {
VueSlickCarousel
},
data() {
return {
info: [],
errored: null,
settings: {
accessibility: true,
dots: false,
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
adaptiveHeight: true,
autoplay: true,
speed: 1000,
autoplaySpeed: 3000,
}, settings_banner: {
accessibility: true,
dots: false,
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
adaptiveHeight: true,
autoplay: true,
speed: 1000,
autoplaySpeed: 3000,
}
}
},
head: {
title: 'xxx',
},
async created() {
try {
this.info = await this.$axios.$get('test.json')
} catch (error) {
console.log('Error', error)
}
},
mounted() { },
}
</script>

<style> .slick-arrow { color: black; } </style> <style lang="sass" scoped> @import "~/assets/scss/components/Item/ItemHomePage/item.sass" //Here i add extra "./"(current directory) </style>`
@ghaithar
Copy link

Hey,

I faced the same problem.

The solution was to never call the component twice in same page

Hope that help

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants