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

img-swipe

v1.0.5

Published

A touch slider for vue.js.

Downloads

1

Readme

img-swipe

A flexible, excellent and smart img swipe component for pc and mobile.

based on vue2.x

基于 Vue2.x 开发的图片轮播组件。支持手机版PC版。 完美支持 自动轮播、无限轮播、手势切换轮播、自适应高度、上一页下一页切换、索引指示、小圆点分页指示等常用功能。

在线演示

说明文档

Example

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

and then browse to http://localhost:8080

Import

Import components to your project:

Registe global component in main.js:

import {ImgSwipe,ImgSwipeItem} from 'img-swipe'

Vue.component('img-swipe', ImgSwipe);
Vue.component('img-swipe-item', ImgSwipeItem);

Registe component in page:

import {ImgSwipe,ImgSwipeItem} from 'img-swipe'

export default {
  components: { ImgSwipe, ImgSwipeItem }
}

Usage

//基本用法,切换时默认会根据图片自动计算高度

<img-swipe>
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>
// 自定义高度,需配置:auto-height="false"

<img-swipe :auto-height="false" style="height: 100px">
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>
// 自动播放 :auto-play="true"

<img-swipe :auto-play="true">
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>
//显示上下页切换按钮 :nav="true"

<img-swipe :nav="true">
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>
// 隐藏分页小原点 :pagination="false"

<img-swipe :pagination="false">
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>
// 显示页号  :indexNum="true"

<img-swipe :indexNum="true">
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>

//切换时回调事件 @on-index="showInfo"

<img-swipe @on-index="showInfo">
    <img-swipe-item><img src="./img/1.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/2.jpg"></img-swipe-item>
    <img-swipe-item><img src="./img/3.jpg"></img-swipe-item>
</img-swipe>

//js
export default {
    methods: {
        showInfo(info){
            this.info = info
        }
    }
}

Options

Props

| Option | Type | Description | Default | | ----- | ----- | ----- | ----- | | speed | Number | 图片切换速度 | 300 | | autoPlay | Boolean | 是否自动播放 | false | | autoPlayTimeout | Number | 自动播放时间间隔 | 3000 | | autoHeight | Boolean | 切换时是否根据图片高度自动更新组件高度 | true | | continuous | Boolean | 无限循环播放 | true | | pagination | Boolean | 显示小圆点 pagination| true | | nav | Boolean | 是否显示上一张,下一张按钮 | false | | indexNum | Boolean | 是否显示 1/5 | false | | prevent | Boolean | preventDefault 触摸事件开始时阻止默认事件 | false |

Events

| Option | Description | 回调参数 | | ----- | ----- |----- | | on-index | 图片切换时候触发 | {index:1,total:5} index:当前索引 total:图片数量 |

Thanks

License

The plugin is open-sourced software licensed under the MIT license.

Contact

Author:ck

Email:[email protected]

安装失败解决方法

# 卸载本地安装的webpack-cli,全局安装webpack-cli:
npm uninstall webpack-cli
npm install -g webpack-cli

npm i