| | |
| | | :options="options"
|
| | | :file-status-text="statusText"
|
| | | class="uploader-single"
|
| | | :sourceType="sourceType"
|
| | | @file-added="onFileAdded"
|
| | | @complete="onComplete"
|
| | | >
|
| | | <!-- <uploader-drop v-if="isDrag == true">
|
| | | <div class="drag-txt">拖拽文件到这里</div>
|
| | | <span class="icon iconfont" @click.stop="showUpload = false"
|
| | | ></span
|
| | | >
|
| | | <uploader-btn>选择文件</uploader-btn>
|
| | | </uploader-drop> -->
|
| | |
|
| | | <div class="up-bar" v-if="isDrag == true">
|
| | | <div class="name">{{ fileName || uploadPlaceholder }}</div>
|
| | | <uploader-btn slot="suffix">
|
| | | <uploader-btn slot="suffix" :attrs="attrs">
|
| | | <el-tooltip :content="tipWords" placement="top" v-if="tip">
|
| | | <div class="open-file-btn">
|
| | | <span class="icon iconfont"></span>
|
| | | </div>
|
| | | </el-tooltip>
|
| | | </uploader-btn>
|
| | | <!-- <div class="open-file-btn">
|
| | | <span class="icon iconfont"></span>
|
| | | </div> -->
|
| | | </div>
|
| | | <el-input
|
| | | :placeholder="uploadPlaceholder"
|
| | |
| | | :readonly="true"
|
| | | v-model="fileName"
|
| | | >
|
| | | <uploader-btn slot="suffix">
|
| | | <uploader-btn slot="suffix" :attrs="attrs">
|
| | | <el-tooltip :content="tipWords" placement="top" v-if="tip">
|
| | | <i
|
| | | class="el-icon-upload2"
|
| | |
| | | },
|
| | | data() {
|
| | | return {
|
| | | fileName: "",
|
| | | fileName: "",shouldStop:false,
|
| | | fileMd5: "",
|
| | | statusText: {
|
| | | success: "上传成功",
|
| | |
| | | },
|
| | | methods: {
|
| | | onFileAdded(file) {
|
| | | // if (this.sourceType == 3) {
|
| | | // if (
|
| | | // !file.name.endsWith(".tar") ||
|
| | | // !file.name.endsWith(".gz") ||
|
| | | // !file.name.endsWith(".tar.gz")
|
| | | // ) {
|
| | | // this.shouldStop = true
|
| | | // this.$notify.warning("仅支持.tar/.gz/.tar.gz三种格式文件");
|
| | | // return
|
| | | // }
|
| | | // }
|
| | | if (this.single) {
|
| | | this.uploader.fileList = this.uploader.fileList.slice([-1]);
|
| | | this.$emit("file-added");
|
| | |
| | | this.statusText.paused = "暂停中";
|
| | | },
|
| | | onComplete() {
|
| | | if (this.shouldStop) {
|
| | | return
|
| | | }
|
| | | this.$emit("complete", {
|
| | | filename: this.fileName,
|
| | | identifier: this.fileMd5,
|