Element-ui Upload 上传

原文链接:https://note.noxussj.top/?source=sifo

通过点击或者拖拽上传文件


按需引入方式

如果是完整引入可跳过此步骤

import Vue from 'vue'
import { Upload } from 'element-ui'
import 'element-ui/lib/theme-chalk/base.css'
import 'element-ui/lib/theme-chalk/upload.css'
import 'element-ui/lib/theme-chalk/icon.css'

Vue.use(Upload)

拖拽上传

<template>
    <el-upload class="upload-demo" drag action="https://jsonplaceholder.typicode.com/posts/" multiple>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
    </el-upload>
</template>

Attributes

image.png


原文链接:https://note.noxussj.top/?source=sifo


菜园前端
19 声望2 粉丝