1.0.2 • Published 2 years ago

@craydel/craydel-image-uploader v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

CraydelImageUploader

Installation

Get the latest version by NPM:

$ npm i @craydel/craydel-image-uploader

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 CraydelImageUploader from '@craydel/craydel-image-uploader/src/CraydelImageUploader.vue'

const Components = {
  CraydelImageUploader,
};

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

NameTypeDefaultDescription
idstringrandom IDSets the DOM id on the component.
heightnumber | stringundefinedSets the height for the image preview.
widthnumber | stringundefinedSets the width for the image preview.
max-heightnumber | stringundefinedSets the maximum height for the image preview.
max-widthnumber | stringundefinedSets the maximum width for the image preview.
min-heightnumber | stringundefinedSets the minimum height for the image preview.
min-widthnumber | stringundefinedSets the minimum width for the image preview.
aspect-rationumber | stringundefinedCalculated as width/height, so for a 1920x1080px image this will be 1.7778. Will be calculated automatically if omitted.
containbooleanfalsePrevents the image from being cropped if it doesn’t fit.

Usage

An example showing an image uploader.

<craydel-image-uploader></craydel-image-uploader>
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago