vue 文件上传插件_一个Vue2插件

上载器 (v-uploader)

A Vue2 plugin to make files upload simple and easier, you can drag files or select file in dialog to upload.

一个Vue2插件可以使文件上传变得简单而轻松,您可以拖动文件或在对话框中选择文件进行上传。

View demo 查看演示 Download Source 下载源

安装 (Install)

npm i v-uploader --save

main.js文件中包含插件。

import Vue from 'vue'
import vUploader from 'v-uploader';
 
/**
 * v-uploader plugin global config
 */
const uploaderConfig = () => {
    return {
        uploadFileUrl: 'http://xxx/upload',
        deleteFileUrl: 'http://xxx/delete',
        showMessage: (vue, message) => {
            //using v-dialogs to show message
            vue.$vDialog.alert(message, null, {messageType: 'error'});
        }
    }
};
 
//install plugin with params
Vue.use(vUploader, uploaderConfig);

there is using v-dialogs to show message in example

在示例中有使用v-dialogs显示消息

插件预览 (Plugin preview)

single file upload mode

单文件上传模式

 

multiple files upload mode

多个文件上传模式

 

Guess you like

Origin blog.csdn.net/qq_30007885/article/details/121383408