Swiper CDN

如果你不想将Swiper文件放在你的项目中,可以使用Swiper的CDN服务。
风险提示:CDN由于不稳定性,在生产环境中请谨慎使用。

Swiper7
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css">  
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">    
<script src="https://unpkg.com/swiper/swiper-bundle.js"> </script>  
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"> </script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js.map"> </script>
ES 模块
<script type="module">
  import Swiper from 'https://unpkg.com/swiper/swiper-bundle.esm.browser.min.js'
  const swiper = new Swiper(...)
</script>

Swiper6
<link rel="stylesheet" href="https://unpkg.com/swiper@6.8.4/swiper-bundle.css">  
<link rel="stylesheet" href="https://unpkg.com/swiper@6.8.4/swiper-bundle.min.css">    
<script src="https://unpkg.com/swiper@6.8.4/swiper-bundle.js"> </script>  
<script src="https://unpkg.com/swiper@6.8.4/swiper-bundle.min.js"> </script>
<script src="https://unpkg.com/swiper@6.8.4/swiper-bundle.min.js.map"> </script>

Swiper5/Swiper4,要将5.x.x改成相应的版本,如5.4.5或4.5.1版本(4无esm的CDN)
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.x.x/css/swiper.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.x.x/css/swiper.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.x.x/js/swiper.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.x.x/js/swiper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.x.x/js/swiper.esm.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.x.x/js/swiper.esm.bundle.js"></script>


请勿直接引入Swiper中文网的文件

x <script src="http://www.swiper.com.cn/dist/js/swiper.min.js"></script>

x <link href="http://www.swiper.com.cn/dist/css/swiper.min.css" />