Code Monkey home page Code Monkey logo

vue3-swiper8-demo's Introduction

Vue3整合Swiper8示例

2022-03-12

本项目是Vue3整合Swiper8的尝试,看了不少网上的文章,并不都好用。官方文档是英文的,本人英语阅读能力也有限,读了很久文档才写出来这个示例,老笨比了。

在基本能用的基础上自定义了分页器,分页器左侧显示文字链接可以点击跳转,右侧显示页码。

由于Swiper的自定义分页器渲染函数拿不到组件实例中数据,所以在加载组件时把数据注入window对象中,组件销毁时移除。

不过这方法也有局限性,如果在同一页面上使用多个就GG了。

2022-03-14

突然发现可以在<script setup>中定义函数传进去customRender,根据作用域链查找的规则,函数是可以访问到props的,因此上面说的问题得到了解决。

vue3-swiper8-demo's People

Contributors

kirazz1 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

strongq-sudo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.