npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

xsd-swiper

v1.1.6

Published

xsd-swiper 是一个简单而强大的轮播图组件

Downloads

37

Readme

1. 组件介绍

  1. xsd-swiper 是一个基于 swiper 的 轮播图组件
  2. xsd-swiper 封装了 swiper 复杂的配置,只保留简单常用的接口,使用起来非常方便。
  3. 欢迎你的使用,如果对 xsd-swiper 有任何的意见和建议,请发送至 962454954@qq.com ,我们将进行快速迭代。

2. 组件使用

2.1 安装

  1. npm i xsd-swiper

2.2 引入

  1. 全局引入

   import Vue from 'vue'
   import xsdSwiper from 'xsd-swiper'
   Vue.use(xsdSwiper)
  1. 全局按需引入

   import {
       xsdSwiper
   } from 'xsd-swiper'
   Vue.component('xsd-swiper', xsdSwiper)
  1. 组件内引入

   import {
       xsdSwiper
   } from 'xsd-swiper'
   export default {
       components: {
           xsdSwiper
       }
   }

2.3 使用

2.3.1 组件的属性

  1. imgList

    1. imgList 是一个存储图片路径的数组
    2. 如果是本地图片路径,需要先 require, 这种情况可以看使用实例
    3. 网络路径直接填地址即可。
  2. width

    1. 用来设置轮播图的宽度,需要带单位
    2. 如果不设置,则默认为 父组件的宽度
  3. height

    1. 用来设置轮播图的高度,需要带单位
    2. 高度往往可以不用设置,可以根据图片的纵横比自动设置
  4. button

    1. 如果置为 true ,则会显示左右两个箭头,用来切换轮播图
    2. 如果置为 false, 则不会显示箭头 (默认)
  5. dot

    1. 如果置为 true ,则会显示分页器
    2. 如果置为 false ,则不会显示分页器 (默认)
  6. autoplay

    1. 如果置为 false, 则不会自动播放
    2. 如果置为 true, 则会自动播放(默认)
    3. 如果置为 数字, 则会自动播放,时间间隔为 设定的数字,单位为 毫秒
  7. canClick

    1. 如果置为 false,则图片不可以点击放大(默认)
    2. 如果置为 true,则图片可以点击放大

2.3.2 使用示例

<template>
  <div id="app">
    <xsd-swiper width="300px" :imgList="imgs" :button="true" :dot="true" :autoplay="2000"></xsd-swiper>
  </div>
</template>

<script>
import { xsdSwiper } from "xsd-swiper"

export default {
  name: 'App',
  components: {
    xsdSwiper
  },
  data() {
    return {
      imgs: [
        require('./components/jg.png'),
        require('./components/ld.png'),
        require('./components/qs.png'),
      ],
    }
  },
}
</script>

3. 样式类

  1. 分页器高亮时样式

   .swiper-pagination-bullet-active {
       background-color: red; // 设置高亮时的颜色
   }
  1. 分页器默认样式

   .swiper-pagination-bullet {
       width: 8px;
       height: 8px;
       display: inline-block;
       border-radius: 100%;
       background: #000;  // 默认为黑色
       opacity: 0.2;  // 默认透明度 为 0.2
   }
  1. 箭头样式

   .xsd-pre,
   .xsd-next {
       position: absolute;
       top: 50%;
       top: 50%;
       width: 15px;
       height: 15px;
       border: 2px solid #fff;
       border-right: none;
       border-bottom: none;
       z-index: 10;
       outline: none;
   }

   .xsd-pre {
       left: 20px;
       transform: translateY(-50%) rotate(-45deg);
   }

   .xsd-next {
       right: 20px;
       transform: translateY(-50%) rotate(135deg);
   }
  1. 图片样式

   .img-wrap {
       border-radius: 8px;
       overflow: hidden;
   }

   img {
       width: 100%;
       height: 100%;
       vertical-align: middle;
       object-fit: cover;
       border-radius: 8px;
       overflow: hidden;
   }