其他分享
首页 > 其他分享> > 一个文件上传界面(带有进度条)

一个文件上传界面(带有进度条)

作者:互联网

因为项目需要上传文件,所以写了一个文件上传的控件。
下面是代码:

<template>
<div>
  <uploader :options="options" class="uploader-example">
    <uploader-unsupport></uploader-unsupport>
    <uploader-drop>
      <p>Drop files here to upload or</p>
      <uploader-btn>select files</uploader-btn>
    </uploader-drop>
    <uploader-list></uploader-list>
    <el-button type="success"  @click="returns()" >返回</el-button>
  </uploader>

</div>
</template>
 
<script>

  import router from "@/router";

  export default {
    data () {
      return {
        options: {
          // 可通过 https://github.com/simple-uploader/Uploader/tree/develop/samples/Node.js 示例启动服务
          target: '//47.107.40.143:8080/upload',
          testChunks: false,
          query:{
            uid:sessionStorage.getItem("uid"),
            sid:this.$route.query.sid,
            aid:this.$route.query.aid
          //form data里的参数 根据实际需要
        },
        },
       
      }
    },
    methods:{
      returns(){
        this.$router.push({
          name:"ClassDetail",
          query:{
            sid:this.$route.query.sid
          }
        })
      }

    }
  }
</script>
 
<style>
  .uploader-example {
    width: 880px;
    padding: 15px;
    margin: 40px auto 0;
    font-size: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, .4);
  }
  .uploader-example .uploader-btn {
    margin-right: 4px;
  }
  .uploader-example .uploader-list {
    max-height: 440px;
    overflow: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

</style>

以后会对该界面进行美化。

标签:界面,进度条,auto,route,router,uploader,sid,query,上传
来源: https://blog.csdn.net/qq_29709359/article/details/118825839