CraydelImageCropper
Installation
Get the latest version by NPM:
$ npm i @craydel/craydel-image-cropper
Register Plugin
If you use the plugin API, the component will be registered as a global component just like when
including it with the script tag, but you won't need to re-register it through the components
property in your own
components.
Create the plugin file e.g craydel-components.js
file.
// craydel-components.js
import Vue from 'vue'
import CraydelImageCropper from '@craydel/craydel-image-cropper/src/CraydelImageCropper.vue'
const Components = {
CraydelImageCropper,
};
Object.keys(Components).forEach(name => {
Vue.component(name, Components[name]);
});
export default Components;
Next reference the plugin file in your nuxt.config.js
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'~/plugins/craydel-components.js'
]
Props
Name | Type | Default | Description |
---|---|---|---|
id | string | random ID | Sets the DOM id on the component. |
src | string | undefined | Sets the initial image URL. |
max-width | number | string | 350 | Sets the maximum width for the cropper canvas in pixels. |
stencil-width | number | string | 280 | Sets the width of the stencil in pixels. |
stencil-height | number | string | 280 | Sets the height of the stencil in pixels. |
Usage
An example showing an image cropper.
<craydel-image-cropper
stencil-width="132"
stencil-height="170"
></craydel-image-cropper>