npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-img-input

v1.2.1

Published

# Demo and docs https://vue3-img-input-exmaples.vercel.app/ https://vue3-img-input-docs.vercel.app/guide/

Downloads

16

Readme

vue3-img-input

Demo and docs

https://vue3-img-input-exmaples.vercel.app/ https://vue3-img-input-docs.vercel.app/guide/

Getting Started

Installation

Install the component using the preferred package manager

    npm i vue3-img-input

Then import and register component

Note: css file is imported separately

Global

In the main.js file

    // main.js
    import VImageInput from 'vue3-img-input'
    app.component('v-image-input', VImageInput)

Local

In the component.vue file

    // Coomponent.vue <script>
    import VImageInput from "@/components/VImageInput";
    
    export default {
        components: {
            ...
            VImageInput,
            ...
        }
    }

props

v-model is required

    modelValue: {
        type: [Object, String, null],
    }

Removable - show remove icon

    removable: {
        type: Boolean, 
        required: false,
        default: false,
    }

File size in MByte

if the uploaded file large then maxFileSize +> emit `error:fileSize'

    maxFileSize: {
        type: Number,
        required: false,
        default: 10,
    }

AcceptedTypes: Array<String>

if the uploaded file not includes in +> emit `error:fileSize'

    acceptedTypes: {
        type: Array,
        required: false,
        default: () => {
            return ["png", "svg", "jpg", "jpeg"];
        }
    }

events

general

v-model update

    // update:modelValue
    <v-image-input v-model="image1" />

errors:

File type error emits when the type of uploaded file not includes in acceptedTypes:Array<string> props

    <v-image-input @error:fileType="errorHandler" />

File size error emits when the size of uploaded file is larger then maxFileSize:Number props

    <v-image-input @error:fileSize="errorHandler" />

slot

#empty-layout

change this for update empty-layout image|text

#remove-icon

change this for update remove-icon

SCSS Variables

$v-image-input-color: #2c3e50 !default;
$v-image-input-color-hover: #4689cd !default;
$v-image-input-background: #fff !default;
$v-image-input-background-hover: #eee !default;

$v-image-input-width: 100% !default;
$v-image-input-height: 100% !default;

$v-image-input-empty-layout-padding: 20px !default;
$v-image-input-empty-layout-border: 1px solid #2c3e50 !default;
$v-image-input-border-radius: 20px !default;
$v-image-input-object-fit: fill !default;

$v-image-input-rm-icon-color: #fff !default;
$v-image-input-rm-icon-size: 24px !default;
$v-image-input-rm-icon-indent: -10px !default;
$v-image-input-rm-icon-position: absolute !default;
$v-image-input-rm-icon-border-radius: 50% !default;
$v-image-input-rm-icon-transition: 0.3s !default;
$v-image-input-rm-icon-color-hover: #000 !default;
$v-image-input-rm-icon-background: #2c3e50 !default;
$v-image-input-rm-icon-background-hover: #4689cd !default;

Usage example

<template>
  <div id="app">
    <h1>vue3-img-input</h1>
    <div class="img-container">
      <v-image-input
          v-model="image1"
          :max-file-size="0.002"
          @error:fileSize="logErrorFileSize"
          @error:fileType="logErrorFileType"
      />
    </div>
    <h2>Removable</h2>
    <div class="img-container">
      <v-image-input v-model="image2" removable />
    </div>
  </div>
</template>

<script>
import VImageInput from "@/components/VImageInput";

const ex1 = require("@/assets/ex1.jpg");
export default {
  name: "HelloWorld",
  components: { VImageInput },
  data() {
    return {
      image1: ex1,
      image2: null,
    };
  },
  methods: {
    logErrorFileSize() {
      console.log("error:fileSize");
    },
    logErrorFileType() {
      console.log("error:fileType");
    },
  },
};
</script>

<style lang="scss">
@import "@/styles/override.scss";
@import "@/styles/style.scss";
.img-container {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 240px;
  height: 240px;
}
</style>