我需要销毁台式机上的Vue-awesome-swiper,然后留在平板电脑屏幕上。完全销毁,而不是禁用滑动。但是我可以销毁刷卡吗?在指令:options中,我传递了params,并且在任何情况下都可以使用component-tag swiper。仅不通过参数
<template lang="pug">
.app
swiper(:options="swiperOptions")
swiper-slide(
v-for="(slide, idx) in slides"
:key="idx"
)
<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
name: 'MySlider',
components: {
swiper,
swiperSlide
},
data() {
return {
slides: [
{
title: 'Заголовок 1',
img: 'title.jpg',
},
{
title: 'title2',
img: 'slide2.jpg',
},
{
title: 'title3',
img: 'slide3.jpg',
}
],
swiperOptions: {
slidesPerView: 5,
spaceBetween: 21,
// allowTouchMove: false,
breakpoints: {
992: {
slidesPerView: 3,
spaceBetween: 25,
},
768: {
slidesPerView: 3.7,
spaceBetween: 22,
},
640: {
slidesPerView: 2.2,
spaceBetween: 15,
initialSlide: 0,
centeredSlides: false,
}
},
},
}
},
如何在swiper
元素上使用v-if以便在桌面上查看时不会呈现?
您将创建一种方法来检测客户端是台式机还是平板电脑,并将结果传递到v-if
属性。