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-pic-preview

v1.0.2

Published

A Vue2 image preview plugin based on vue-preview

Downloads

10

Readme

Vue preview plugin

一个Vue集成PhotoSwipe图片预览插件

此插件并没有提供新的功能, 只是在原vue-preview插件基础之上简化了操作, 无需使用vue-preview组件, 直接使用img标签绑定点击事件即可

Requirements

PhotoSwipe

Based on

vue-preview

Installation

npm i vue-pic-preview -S

Usage

使用须知:

  • 插件目前仅支持vue2.0以上版本
  • img标签上的class不能去掉

如果你是使用vue-cli生成的项目,可能需要你修改webpack.base.conf.js文件中的loaders,添加一个loader。 原因:插件编写中使用了es6的语法,需要进行代码编译

{
    test: /vue-preview.src.*?js$/,
    loader: 'babel'
}

Install plugin

import VuePreview from 'vue-pic-preview'
Vue.use(VuePreview)

Examples

<template>
  <img class="preview-img" v-for="(item, index) in list" :src="item.src" height="100" @click="$preview.open(index, list)">
</template>

<script>
export default {
    data () {
      return {
        list: [{
          src: 'https://placekitten.com/600/400',
          w: 600,
          h: 400
        }, {
          src: 'https://placekitten.com/1200/900',
          w: 1200,
          h: 900
        }]
      }
    }
  }
</script>

Mothods

插件提供以下两个方法,vm代表组件实例

vm.$preview.open(index, list, options)

参数说明:

| 参数 | 说明 | 类型 | 必需 | :--: | :--: | :--: | :--: | index |当前图片的索引值| Number | 是 | list |图片列表 | Array | 是 | options |预览插件的配置选项(参考PhotoSwipe配置) | Object | 否

vm.$preview.close()

License