vue实现左右滑动切换年份

        <!-- 日期选择 -->
    <div class="date_picker" :disabled="preDisabled">
    <van-button @click="preYear()">
      <van-icon name="arrow-left" />
    </van-button>
      <span>{
   {
    selectYear }}</span>
    <van-button @click="nextYear()" :disabled="disabled">
      <van-icon name="arrow" />
    </van-button>
  </div>
定义数据

selectYear: day().year(),
disabled: true,
preDisabled:false,

查询数据
startTime: "",
endTime: ""
import day from "dayjs";
created() {
   
     this.getTime()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
可以使用vue-awesome-swiper插件来实现左右滑动切换分页。下面是一个简单的例子: 1. 安装vue-awesome-swiper插件 ```bash npm install vue-awesome-swiper --save ``` 2. 在Vue组件中引入vue-awesome-swiper插件 ```javascript import Vue from 'vue' import 'swiper/dist/css/swiper.css' import VueAwesomeSwiper from 'vue-awesome-swiper' Vue.use(VueAwesomeSwiper) ``` 3. 在Vue组件中使用vue-awesome-swiper插件 ```html <template> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide">Page 1</div> <div class="swiper-slide">Page 2</div> <div class="swiper-slide">Page 3</div> </div> <div class="swiper-pagination"></div> </div> </template> <script> export default { data() { return { swiperOption: { pagination: '.swiper-pagination', paginationClickable: true, spaceBetween: 30, centeredSlides: true, autoplay: 2500, autoplayDisableOnInteraction: false } } } } </script> <style> .swiper-slide { text-align: center; font-size: 18px; background: #fff; /* Center slide text vertically */ display: flex; justify-content: center; align-items: center; } </style> ``` 4. 样式调整 可以根据实际需求调整样式,例如: ```css /* 设置容器宽度和高度 */ .swiper-container { width: 100%; height: 400px; } /* 设置分页器位置和颜色 */ .swiper-pagination { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); } .swiper-pagination-bullet-active { background-color: #007aff; } ``` 这样,就可以通过左右滑动切换分页了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

都挺好,刚刚好

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值