Swiper:Cannot read properties of undefined (reading ‘parentNode’)问题

问题:将swiper封装成组件,父组件调用
产生原因:实例化swiper的时候使用的css类名与父组件的某个类名重复。
<template>
<div class="homeSwiper">
<div class="swiper-container crossHomeSwiper">
<!-- 轮播位置 -->
<div class="swiper-wrapper">
<!-- 轮播内容插槽 -->
<slot name="crossContent"></slot>
</div>
<!-- 轮播页数点点 -->
<slot name="paginationCrossHome"></slot>
</div>
</div>
</template>
mounted () {
const crossHomeSwiper = new Swiper('.crossHomeSwiper', Object.assign(this.options, this.crossHomeOptions))
return crossHomeSwiper
}
<div class="crossHomeSwiper">
<v-homeSwiper>
<template #crossContent>
<div class="swiper-slide">1</div>
<div class="swiper-slide">2</div>
<div class="swiper-slide">3</div>
<div class="swiper-slide">4</div>
<div class="swiper-slide">5</div>
</template>
<template #paginationCrossHome>
<div class="swiper-pagination paginationNews"></div>
</template>
</v-homeSwiper>
</div>
父组件与封装组件都有crossHomeSwiper类名,且用该类名实例化,所以报错