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

peach-cropper

v0.2.1

Published

基于cropperjs封装的图片裁剪Vue组件,增加圆形裁剪功能,适用于PC和移动端。A cropper component for Vue.js based on cropperjs, add round crop function, available for PC & mobile.

Downloads

2

Readme

peach-cropper

基于cropperjs封装的图片裁剪Vue组件,增加圆形裁剪功能,适用于PC和移动端。 A cropper component for Vue.js based on cropperjs, add round crop function, available for PC & mobile.

在线预览 | Preview demo

https://taoqi0813.github.io/#/peach-cropper

快速上手 | Getting started

安装 | Installation

npm install -S peach-cropper

在main.js引用 | In Main.js:

import PeachCropper from 'peach-cropper'
Vue.use(PeachCropper)

用法 | Usage

<peach-cropper ref="cropper" :options="options" />

配置 | Options

  • cropW

    • 输出图片的宽度 | output image width
    • 类型: Number | Type: Number
    • 默认值: 128 | Default: 128
  • cropH

    • 输出图片的高度 | output image height
    • 类型: Number | Type: Number
    • 默认值: 128 | Default: 128
  • type

    • 输出图片的类型 | output image type
    • 类型: String | Type: String
    • 默认值: 'jpeg' | Default: 'jpeg'
    • 可选值: 'jpeg/png/webp' | Options: 'jpeg/png/webp'
  • round

    • 是否启用圆形裁剪 | use round size
    • 类型: Boolean | Type: Boolean
    • 默认值: false | Default: false
    • 启用圆形裁剪时,会将cropW和cropH中的最小值作为直径形成裁剪框 | when round=true, use min(cropW,cropH) as diameter of the round image

其他的配置详见cropperjs文档,https://github.com/fengyuanchen/cropperjs | More options see cropperjs documents, https://github.com/fengyuanchen/cropperjs

cropperjs中aspectRatio和initialAspectRatio参数将不再有效,根据cropW和cropH自动计算比例 | aspectRatio & initialAspectRatio in cropperjs are unavailable any more, it'll calculate scale with cropW & cropH

方法 | Methods

getDataURL()

  • 返回值 | return value:
    • 类型: String | Type: String
    • 图片base64编码 | base64 code of image

其他的方法详见cropperjs文档,https://github.com/fengyuanchen/cropperjs | More options see cropperjs documents, https://github.com/fengyuanchen/cropperjs

例子 | Example

const base64 = this.$refs.cropper.getDataURL()

注意 | Notice

在组件外面放置容器,设置容器的宽高 | set a parent wrapper for this component to change size

更新日志 | Log

| 版本号 | 更新时间 | 更新内容 | | ---- | ---- | ---- | | 0.2.0 | 2020/6/15 | 扩展支持cropperjs所有方法 | 0.1.0 | 2020/6/8 | 封装getDataURL方法