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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-easy-swiper

v1.0.3

Published

vue swiper on PC

Downloads

6

Readme

vue-easy-swiper

PC 端轮播图

功能:

  • 循环滚动
  • 自定义指示器

安装

npm install -S vue-easy-swiper

使用

<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" />
    <swiper :images="images" class="swiper" />
  </div>
</template>

<script>
import Swiper from 'vue-easy-swiper'

export default {
  name: 'App',
  components: {
    Swiper,
  },
  data() {
    return {
      images: [
        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.soumeitu.com%2Fwp-content%2Fuploads%2F2020%2F07%2F5efd4bc254c10.jpg&refer=http%3A%2F%2Fwww.soumeitu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629630925&t=608a56a47a9b890725fbf158dadfd4a6',
        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg3.ph.126.net%2Fp-RJ33HgAuhSQOMCsyQ0UA%3D%3D%2F3099883918532000103.jpg&refer=http%3A%2F%2Fimg3.ph.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629630925&t=39052dbea1dac7b90660e830c27c9e80',
      ],
    }
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.swiper {
  width: 100px;
  height: 300px;
}
</style>

screenshot-1

自定义指示器

<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" />
    <swiper :images="images" class="swiper" @change="change">
      <div slot="indicator">
        <div
          v-for="(i, index) in images.length"
          :key="index"
          class="indicator-item"
          :class="{ 'indicator-item-active': curIndex == i }"
        >
          {{ i }}
        </div>
      </div>
    </swiper>
  </div>
</template>

<script>
import Swiper from '../package/src/swiper'

export default {
  name: 'App',
  components: {
    Swiper,
  },
  data() {
    return {
      curIndex: 1,
      images: [
        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.soumeitu.com%2Fwp-content%2Fuploads%2F2020%2F07%2F5efd4bc254c10.jpg&refer=http%3A%2F%2Fwww.soumeitu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629630925&t=608a56a47a9b890725fbf158dadfd4a6',
        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg3.ph.126.net%2Fp-RJ33HgAuhSQOMCsyQ0UA%3D%3D%2F3099883918532000103.jpg&refer=http%3A%2F%2Fimg3.ph.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629630925&t=39052dbea1dac7b90660e830c27c9e80',
      ],
    }
  },
  methods: {
    change(index) {
      this.curIndex = index
      console.log(index)
    },
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.swiper {
  width: 100px;
  height: 300px;
}
.indicator-item {
  color: white;
  float: left;
  width: 40px;
  height: 40px;
  background: gray;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 20px;
  margin: 15px;
}
.indicator-item-active {
  background: white;
  color: black;
}
</style>

screenshot-2

Attributes

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | --- | --- | --- | --- | --- | | images | 要预览的图片地址除了字符串数组还支持对象数组,但对象中要有一个 src 属性是图片地址,例如:images = [{id: 1, src: "http://xxxx/xxx.jpg"}] | array | -- | [ ] | | interval | 轮播图间隔时间 | number | -- | 3000 | | animDuration | 轮播图动画时间 | number | -- | 1000 | | stopAnim | 鼠标悬停上去的时候停止动画 | boolean | true/false | false |

slot

| 参数 | 说明 | | --------- | ------------ | | indicator | 自定义指示器 |

Event

| 参数 | 说明 | 回调参数 | | ------ | ---------------------------------------------------- | -------- | | click | 轮播图被点击,如果images中是对象,则回调参数为对象 | item | | change | 图片切换时的回调 | index |