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

v-picview

v1.0.24

Published

A pictures view program

Downloads

175

Readme

v-picview GitHub package.json version Build Status vue

v-picview is a component of picture viewer.

Demo

How to use

npm i v-picview -S
import Vue from 'vue'
import 'v-picview/lib/v-picview.css'
import vPicview from 'v-picview'
import { vImage } from 'v-picview'
Vue.component(vImage)
Vue.use(vPicview,{
    escClose:true,
    arrowShortcuts:true,
    zoom:true,
    footer:true,
    animation:'fadein',
    popperClass:'my-picview-box',
    onDownload(item:any){
        console.log(item)
    },
    onNext(index:number, item:object, oldItem:object){
        console.log('下一页',index,item,oldItem)
    },
    onPrev(index:number, item:object, oldItem:object){
        console.log('上一页',index,item,oldItem)
    },
    onChange(index:number, item:object, oldItem:object){
        console.log('页数改变',index,item,oldItem)
    },
    onImgLoaded(e:any){
        console.log('图片加载完成',e)
    },
    onZoomIned(e:any){
        console.log('图片放大',e)
    },
    onZoomOuted(e:any){
        console.log('图片缩小',e)
    },
    onDragStart(e:any){
        console.log('拖拽开始',e)
    },
    onDragMove(e:any){
        console.log('拖拽中',e)
    },
    onDragEnd(e:any){
        console.log('拖拽结束',e)
    }
})
<!-- Component mode initialization -->
<v-image 
    class="inline-block" 
    describe="group set-1" 
    :src="require('@/assets/pic1.png')" 
    mode="aspectFit" 
    group="set-1" 
/>

<!-- Directive mode initialization -->
<img 
    src="~@/assets/logo.png" 
    v-picview="{group:'set-2',describe:'group set-2'}" 
/>

API

v-picview directive attributes:

| Attr. Name | Description | Required | Default Value | |-----|-----|-----|-----| | describe | 图片的描述,如果打开了vPicview的footer会显示在底部 | N | | | group | 图片的分组,如果是同一分组的图片,在图片查看器里面可以进行左右切换查看 | N | - |

vImage component attributes:

| Attr. Name | Description | Required | Default Value | |-----|-----|-----|-----| | width | 图片的宽度 | N | 350px | | height | 图片的高度 | N | 350px | | src | 图片的地址路径 | Y | | | describe | 图片的描述,如果打开了vPicview的footer会显示在底部 | N | | | viewSrc | 图片查看器的图片地址路径,如果不填写,则默认取src | N | | | group | 图片的分组,如果是同一分组的图片,在图片查看器里面可以进行左右切换查看 | N | - | | noView | 点击是否打开图片查看器,默认是点击后打开查看器 | N | false | | mode | scaleToFill:不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素。 aspectFit:缩放模式,保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来。 aspectFill:缩放模式,保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取。 widthFix:缩放模式,宽度不变,高度自动变化,保持原图宽高比不变。 | N | scaleToFill |

vPicview component attributes:

| Attr. Name | Description | Required | Default Value | |-----|-----|-----|-----| | arrowShortcuts | 是否启用左右箭头键切换图片页数 | N | true | | zoom | 是否需要放大功能 | N | true | | footer | 是否启用底部栏显示描述 | N | true | | animation | 打开的动画:fadein,flyin | N | fadein | | popperClass | 图片查看器的class | N | - | | onDownload | 点击下载图标的回调函数 | N | - | | onNext | 触发下一页图片时的回调函数 | N | - | | onPrev | 触发上一页图片时的回调函数 | N | - | | onChange | 页数改变时的回调函数 | N | - | | onImgLoaded | 图片查看器在图片加载完成后的回调函数 | N | - | | onZoomIned | 图片放大时的回调函数 | N | - | | onZoomOuted | 图片缩小时的回调函数 | N | - | | onDragStart | 图片放大后拖动开始时的回调函数 | N | - | | onDragMove | 图片放大后拖动进行中的回调函数 | N | - | | onDragEnd | 图片放大后拖动结束时的回调函数 | N | - |

vPicview vm instance methods:

window.$picview可直接获取vPicview的实例

  • download() 下载查看器当前显示的图片
  • close() 关闭查看器
  • next() 下一页图片
  • prev() 上一页图片