Skip to content

init 6.

Compare
Choose a tag to compare
@vinayakkulkarni vinayakkulkarni released this 22 Sep 06:54

V-Image πŸ“· github release npm version Build Status npm downloads

  • This is on GitHub so let me know if I've b0rked it somewhere, give me a star ⭐ if you like it 🍻
  • Demo here -> v-image

βœ… Install πŸ‘Œ

npm i v-image
// or 
yarn add v-image

βœ… Usage πŸŽ“

Register the component globally:

Vue.component('vImage', require('v-image'));

Or use locally

import vImage from 'v-image';

βœ… Example πŸ€

  <v-image alt="Alt Text for the Image" :name="'my-awesome-image'" :img-style="myStyle" @load-image="localVariable"></v-image>
import vImage from 'v-image';
export default {
  components: { vImage },
  methods: {
    localVariable(imageSentFromComponent) {
      this.image = imageSentFromComponent;
    },
  },
  data() {
    return {
      image: '',
      myStyle: {
        height: '200px',
        width: '200px',
      },
    };
  },
};

βœ… πŸ“– Props:

Name Type Required? Description
name String Yes For name attribute for the input field.
alt String No For alt attribute for the input field, mostly for proper SEO.
imgStyle Object No Styling for the img tag.
buttonStyle Object No Styling for the button & label tag.

βœ… πŸ‘‚ Events:

  • load-image (load the base64 to your custom component's variable (see example)) [default: ""]

NPM :octocat:

NPM