Giter Site home page Giter Site logo

miniprogram-cropper-component's Introduction

miniprogram-cropper-component

小程序裁剪组件,支持等比例裁剪,使用简单。

使用方式

1、�首先在�page.json文件中引入组件 page.json

{
    ...,
    "usingComponents": {
        "cropper":"cropper的路径/index"
    }
}

2、在页面中使用

<cropper imageSrc="{{imgSrc}}" enableScale="{{true}}" ratio="{{2/1}}" bind:cropperDone="cropperDone" bind:cropperCancel="cropperCancel" bind:cropperFail="cropperFail"></cropper>

组件的props

imageScale(String) : 要裁剪的图片地址,基本上市本地图片地址

enablseScale(Boolean): 是否开启等比例裁剪 �可选参数

ratio(Number): 裁剪比例 默认为1 可选参数

cropperDone(Function):裁剪成功的回调

cropperCancel(Function): 裁剪取消的回调

cropperFail(Function):裁剪失败回调

isCircleCrop(Boolean) 是否是圆形裁剪 圆形裁剪ratio 强制为1

回调

    Page({
        cropperDone(e){
            const{src,cropperData} = e.detail;
            //src 最终裁剪图片地址
            // cropperData 裁剪�起点、大小信息
        },

        cropperCancel(){
            // do something
        },

        cropperFail(e){
            const err = e.detail;
            console.log(err);
        }

    })

更新日志:

1.1  等比例裁剪等

1.2  支持圆形裁剪

参考:传送门

miniprogram-cropper-component's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jaiyuen

miniprogram-cropper-component's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.