Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-upload-multiple-image

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-upload-multiple-image

A Vue.js project

  • 1.1.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-22.26%
Maintainers
1
Weekly downloads
 
Created
Source

vue-upload-multiple-image

A simple upload multiple image component for Vuejs NPM Package

Demo!

enter image description here

Development (NPM / Yarn)

npm run dev
yarn dev

Install

NPM / Yarn

Install the package:

npm install vue-upload-multiple-image
yarn add vue-upload-multiple-image

Then import it in your project

main.js

import VueLazyload from 'vue-lazyload'

Vue.use(VueLazyload)
import VueUploadMultipleImage from 'vue-upload-multiple-image'

export default {
  components: {
    VueUploadMultipleImage,
  },
}
Browser global
<script src="path/to/vue.js"></script>
<script src="path/to/dist/vue-upload-multiple-image.js"></script>

Usage

You can simply view App.vue to see how to use vue-upload-multiple-image

How to use:

<vue-upload-multiple-image
      @upload-success="uploadImageSuccess"
      @before-remove="beforeRemove"
      @edit-image="editImage"
      :data-images="images"
      ></vue-upload-multiple-image>

images has the structure:

[
  {
    path: 'http://example.com/image.jpg',
    default: 1,
    highlight: 1,
    caption: 'caption to display. receive', // Optional
  }
]

Example

<template>
  <div id="my-strictly-unique-vue-upload-multiple-image" style="display: flex; justify-content: center;">
    <vue-upload-multiple-image
      @upload-success="uploadImageSuccess"
      @before-remove="beforeRemove"
      @edit-image="editImage"
      :data-images="images"
      idUpload="myIdUpload"
      editUpload="myIdEdit"
      ></vue-upload-multiple-image>
  </div>
</template>

<script>
import VueUploadMultipleImage from 'vue-upload-multiple-image'
import axios from 'axios'
export default {
  name: 'app',
  data () {
    return {
      images: []
    }
  },
  components: {
    VueUploadMultipleImage
  },
  methods: {
    uploadImageSuccess(formData, index, fileList) {
      console.log('data', formData, index, fileList)
      // Upload image api
      // axios.post('http://your-url-upload', formData).then(response => {
      //   console.log(response)
      // })
    },
    beforeRemove (index, done, fileList) {
      console.log('index', index, fileList)
      var r = confirm("remove image")
      if (r == true) {
        done()
      } else {
      }
    },
    editImage (formData, index, fileList) {
      console.log('edit data', formData, index, fileList)
    }
  }
}
</script>

<style>
#my-strictly-unique-vue-upload-multiple-image {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}
</style>

Options

Props

nametypedefaultdescription
idUploadStringimage-uploadId of input upload
idEditStringimage-editId of input edit
dragTextStringKéo hình ảnh(nhiều)Drag Text
browseTextString(hoặc) ChọnBrowse Text
primaryTextStringMặc địnhPrimary Text
markIsPrimaryTextStringĐặt làm mặc địnhSet default image
popupTextStringHình ảnh này sẽ được hiển thị làm mặc địnhDescription default image
dropTextStringThả tệp của bạn ở đây ...Drag and drop
acceptStringimage/gif,image/jpeg,image/png,image/bmp,image/jpgAccept
dataImagesArray[]Array images
multipleBooleantrueSet upload multiple image
showPrimaryBooleantrueShow text default image
maxImageNumber5Maximum upload image
showEditBooleantrueShow action edit
showDeleteBooleantrueShow action delete
showAddBooleantrueShow action add
disabledBooleanfalseDisable upload image

Events

nameargumentsdescription
upload-success(formData, index, fileList)Upload image succcess
edit-image(formData, index, fileList)Edit image succcess
before-remove(index, done, fileList)Before delete image
mark-is-primary(index, fileList)Set default image
limit-exceededamountLimit exceeded images when drop

Dependencies

FAQs

Package last updated on 29 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc