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-pictring

v1.1.1

Published

A picture upload component about VUE

Downloads

7

Readme

vue-pictring

一个基于vue的移动端图片上传插件

  • 多选/拍照
  • 图片预览/删除

image text

npm安装

npm install vue-pictring

使用插件:

  • 引入
import pictring form 'vue-pictring'
Vue.use(pictring, {
  type: 'base', // 上传文件的类型,如果选择'img'插件会将图片以blob储存到FormData里。 默认为'base'(图片数据为base64格式)
  max: 9,  // 允许上传图片的最大张数。  默认为9
  size: 80, // 容器尺寸,可选'px'固定数值,若填入数字则为屏幕百分比
  compress: 0.8, // 图片压缩质量, 0~1 , 默认为0.8
})
  • 声明组件
<div id='app'>
  <!--组件使用时需要添加$refs标记用来调用组件内的方法-->
  <vue-pictring ref='$demo'></vue-pictring>
</div>
  • 图片上传

由于上传图片方式的多样性,插件中上传方法只是将图片数据返回成数组或是FormData对象,再由用户自定义上传。

 let files = this.$refs.$demo.up() // 根据用户使用插件时所选的type来返回FormData或是base64数组
 $.ajax({
    type : "POST",
    url : "test.aspx",
    data : files,
    success : function(data) {
        alert('上传成功!')
    },
    error : function(){
        alert("错误")
    }
 });
  • 清空图片
this.$refs.$demo.empty() // 清空图片

DEMO(Mobile)

  • 朋友圈: [http://www.toofook.com/vue-fileup/index.html]