Use error report 'Can't find variable: Dom7' after npm install swiper

vue using swiper

import Swiper from "swiper";




methods: {
    __init_swiper: function () {
        let swiper = new Swiper("-sharpswiper_container", {
            autoplay: {
                disableOnInteraction: false,
                delay: 1000
            },
            pagination: {
                el: ".swiper-pagination",
                clickable: true
            },
        });
    }
},
mounted: function () {
    this.__init_swiper();
}

package.jsondom7

I tried to introduce this package,


    import Dom7 from "dom7";
    import Swiper from "swiper";

but without any effect, the same mistake was reported.

I know that I can introduce swiper, in index.html with < script >, but now I want to introduce it only in this component.

could you please help me to solve this problem? Or maybe there are any other way which can include the Swiper into the project? THANK Q.

Mar.24,2021
The reason why

cannot be used by a single file component is often that it is not encapsulated in the form of a Vue plug-in. I think you can consider using this- vue-awesome-swiper


has it been solved?


there are plenty of incomplete uninstall of the package and then try uninstall again

.
Menu