Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

😍 Vue.js 💪 awesome-avatar

NotificationsYou must be signed in to change notification settings

NarHakobyan/awesome-vue-avatar

Repository files navigation

Facebook like, avatar / profile picture component.

Resize, rotate and crop your uploaded image using a clear user interface.

Demo athttps://narhakobyan.github.io/awesome-vue-avatar/

Installation

This is aNode.js module available through thenpm registry.

Before installing,download and install Node.js.Node.js 4.0 or higher is required.

Installation is done using thenpm install command:

$ npm install awesome-vue-avatar

Usage

<divid="app"><vue-avatar:width=400:height=400:rotation="rotation"placeholder: "base64Image"      :scale="scale"ref="vueavatar"@image-ready="onImageReady"></vue-avatar><br><inputtype="range"min=1max=3step=0.02v-model.number='scale'/><inputtype="range"min=1max=3step=0.02v-model.number='rotation'/><br><buttonv-on:click="saveClicked">Click</button><br><imgref="image"></div>
importVuefrom'vue'import{VueAvatar}from'awesome-vue-avatar'letvm=newVue({el:'#app',components:{    VueAvatar,    VueAvatarScale},data(){return{rotation:0,scale:1};},methods:{saveClicked(){varimg=this.$refs.vueavatar.getImageScaled()this.$refs.image.src=img.toDataURL()},onImageReady(){this.scale=1this.rotation=0}}})

Props

PropTypeDescription
widthNumberThe total width of the editor
heightNumberThe total width of the editor
borderNumberThe cropping border. Image will be visible through the border, but cut off in the resulting image.
colorNumber[]The color of the cropping border, in the form: [red (0-255), green (0-255), blue (0-255), alpha (0.0-1.0)]
styleObjectStyles for the canvas element
scaleNumberThe scale of the image. You can use this to add your own resizing slider.
rotationNumberThe rotation in degrees of the image. You can use this to add your own rotating slider.
placeholderStringPlaceholder url (base64)

Accessing the resulting image

will returnnull if image is not selected

this.$refs.vueavatar.toDataUrl()

The resulting image will have the same resolution as the original image, regardless of the editor's size.If you want the image sized in the dimensions of the canvas you can usegetImageScaled.

this.$refs.vueavatar.getImageScaled()

Contributing

For development you can use following build tools:

  • yarn install: Install required dependencies.
  • yarn serve: Start development server.
  • Commit and push your changes
  • Open pull-request

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp