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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-pic-preview-yk

v1.1.1

Published

"基于photoswipe的vue轻量版图片预览组件"

Readme

vue-pic-preview-yk

"基于photoswipe的vue图片预览插件"

说明

1.简化了photoswipe的默认设置
2.取消了图片需设定尺寸的要求
3.默认关闭了分享按钮
4.简化了html结构

使用

# 安装
npm install vue-pic-preview-yk --save
# 引入
import preview from 'vue-pic-preview-yk'
import 'vue-pic-preview-yk/dist/skin.css'
Vue.use(preview)
//或者 
//Vue.use(preview,option)


import preview from 'vue-pic-preview-yk'
import 'vue-pic-preview-yk/dist/skin.css'
var options = {
    // index: ,
    escKey: false,//控制键盘的左右方向键切换图片
    fullscreenEl:false, //关闭全屏按钮
    showHideOpacity:false,
    // ui option
    timeToIdle: 4000,
    showAnimationDuration:333,
    maxSpreadZoom:5,

    // Buttons/elements
	closeEl:true,//显示关闭按钮
	captionEl: true, //显示底部描述文字板块
	fullscreenEl: true,//显示全屏按钮
	zoomEl: true,//显示放大缩小按钮
	 shareEl: true,//显示分享按钮
	counterEl: true,//控制上边第几个2/2
	arrowEl:true,//控制左右点击滑动按钮
	//preloaderEl: false,
	indexIndicatorSep: ' / ',// Separator for "1 of X" counter
	shareButtons: [
	    {id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'},
	    {id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},
	    {id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}'},
	    {id:'download', label:'Download image', url:'{{raw_image_url}}', download:true}
	],
};
Vue.use(preview,options)



# umd
<link rel="stylesheet" type="text/css" href="路径/dist/skin.css"/>

<script src="路径/dist/vue-photo-preview.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var options={
		fullscreenEl:false //关闭全屏按钮
	}
	
	Vue.use(vuePhotoPreview,options)
	
	new Vue({
		el:'#app'
	})
</script>
# html
//在img标签添加preview属性 preview值相同即表示为同一组
<img src="xxx.jpg" preview="0" preview-text="描述文字">

//分组
<img src="xxx.jpg" preview="1" preview-text="描述文字">
<img src="xxx.jpg" preview="1" preview-text="描述文字">

<img src="xxx.jpg" preview="2" preview-text="描述文字">
<img src="xxx.jpg" preview="2" preview-text="描述文字">

<img src="xxx.jpg" large="xxx_3x.jpg" preview="2" preview-text="缩略图与大图模式">

2018-09-03 更新

//添加对原插件photoswipe的事件响应,示例:

this.$preview.on('close',())=>{//close只是众多事件名的其中一个,更多请查看文档
	console.log('图片查看器被关闭')
})

//添加图片查看器实例--this.$preview.self 注意:此实例仅在图片查看器被打开时生效

this.$preview.on('imageLoadComplete',(e,item)=>{
	console.log(this.$preview.self)  //此时this.$preview.self拥有原插件photoswipe文档中的所有方法和属性
})

//demo文件夹中index.html可以供参考写法 //本次更新后继承了原插件的所有事件、方法和属性,如需复杂使用请多多查看原插件文档

//应性能要求 新增大图查看 large标签填写大图路径 (插件的思路是 img的src默认为缩略图),如不填写large,则展示src

<img src="xxx.jpg" large="xxx_3x.jpg" preview="2" preview-text="描述文字">

//如果图片是异步生成的,在图片数据更新后调用:

this.$previewRefresh()

Options

插件配置文档

DEMO