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

photoswipe-package

v1.0.1

Published

对photoswipe的高度封装

Downloads

1

Readme

vue-preview-deleter

基于vue2.0的图片预览与删除组件

可以自定义删除图片的回调函数,在点击删除图片的操作时,回调函数将根据removeInside的值来返回不同的参数,参数包括操作结果 result 和 具体数据 data

  1. removeInsidetrue 时:data将返回所删元素的索引index,所删元素removeTarget,和删除元素后的列表fileList,此时应在回调函数内将返回的新的数组赋值到imgs上;
  2. removeInsidefalse 时:data将返回所删元素的索引index,所删元素removeTarget,和原始列表fileList,此时应在回调函数内进行删除操作,并重新对imgs赋值;

Install

npm install vue-preview-deleter --save

Usage

// main.js
import VuePreviewer from 'vue-preview-deleter'
Vue.use(VuePreviewer)
<!-- component.vue -->
<template>
  <div id="app">
    <vue-previewer :imgs="imgs" @onRemove="handleRemove" @onClose="closeHandler"></vue-previewer>
  </div>
</template>

<script>
export default {
  data() {
    return {
      imgs: [
        {
          src: 'https://farm4.staticflickr.com/3894/15008518202_b016d7d289_b.jpg',
          author: 'Folkert Gorter',
          desc: 'This is dummy caption.'
        },
        {
          src: 'https://farm6.staticflickr.com/5584/14985868676_4b802b932a_b.jpg'
        },
        {
          src: 'https://farm4.staticflickr.com/3920/15008465772_383e697089_b.jpg',
          author: 'Folkert Gorter2',
          desc: 'It\'s a dummy caption. He who searches for meaning here will be sorely disappointed.'
        }
      ]
    }
  },
  methods: {
    closeHandler () {
      console.log('cloooooose')
    },
    handleRemove (index, fileList, target) {
      this.imgs = fileList
    }
  }
}
</script>

options

  1. imgs - 图片文件或链接列表,可传入File,url,base64
    • type: Array
    • required : true
  2. width - 每个图片单元的宽高(为保证图片呈现为方形,高度等于宽度),单位是px
    • type: Number
    • required : false
    • default : 80
  3. margin - 每个图片单元的上外边距和右外边距,单位是px
    • type: Number
    • required : false
    • default : 10
  4. radius - 每个图片单元的圆角值,单位是px
    • type: Number
    • required : false
    • default : 5
  5. removeEnable - 是否可进行删除图片操作,假如为false,则点击图片直接查看大图
    • type: Boolean
    • required : false
    • default : true
  6. removeInside - 删除图片的操作实际是在组件外处理还是组件内处理
    • type: Boolean
    • required : false
    • default : true
  7. deleteBtnColor - 删除按钮的颜色
    • type: String
    • required : false
    • default : '#e12e2e'
  8. previewBtnColor - 预览按钮的颜色
    • type: String
    • required : false
    • default : '#3caaff'
  9. type - 传入的列表值类型,分为两个值:fileurl (base64也用url)
    • type: String
    • required : false
    • default : 'url'
  10. srcName - 传入的链接字段名
    • type: String
    • required : false
    • default : 'src'

callBack

  1. onRemove - 删除之后的回调函数
    • type: Function
    • required : false