ソースを参照

资源上传高度及上传按钮样式

natasha 2 ヶ月 前
コミット
9cc56abece

+ 0 - 1
src/views/personal_workbench/project/ProductionResourceManage.vue

@@ -428,7 +428,6 @@ export default {
   mounted() {
     this.height =
       document.getElementsByClassName('app-container')[0].clientHeight -
-      document.getElementsByClassName('menu')[0].clientHeight -
       document.getElementsByClassName('textbook-chapter__header')[0].clientHeight -
       document.getElementsByClassName('search-box')[0].clientHeight -
       document.getElementsByClassName('el-pagination')[0].clientHeight -

+ 9 - 1
src/views/personal_workbench/project/components/UploadFile.vue

@@ -4,6 +4,7 @@
       <span class="label-text">{{ labelText }}</span>
       <div class="upload-box">
         <el-upload
+          v-show="false"
           ref="upload"
           class="file-uploader"
           action="no"
@@ -18,7 +19,7 @@
         >
           <el-button>选取{{ labelText }}文件</el-button>
         </el-upload>
-        <el-button size="small" type="primary" @click="uploadFiles">本地上传</el-button>
+        <el-button size="small" type="primary" @click="selectAndUpload">本地上传</el-button>
       </div>
     </div>
     <el-divider />
@@ -142,6 +143,13 @@ export default {
     },
   },
   methods: {
+    selectAndUpload() {
+      const uploadInput = this.$refs.upload.$el.querySelector('input[type="file"]');
+      if (uploadInput) {
+        uploadInput.value = '';
+        uploadInput.click();
+      }
+    },
     // 显示自定义样式文件列表
     onFileChange(file, fileList) {
       this.afterSelectFile(file);