zhaoke 2 жил өмнө
parent
commit
716af3fbdb

BIN
public/国航行李整合及应用项目-用户使用手册V2.1.pdf


+ 33 - 0
src/layout/components/Navbar.vue

@@ -26,6 +26,7 @@
             </el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
+        <el-button @click="downFile" class="btn-help" plain>帮助</el-button>
         <!-- <div class="seting">
           <span @click="toSystem" class="img-icon"></span>
         </div> -->
@@ -108,6 +109,23 @@ export default {
     exitDialog () {
       this.$store.dispatch("app/toggleOutflag", true);
     },
+    //下载
+    downFile () {
+      const a = document.createElement('a');
+      // 给a标签的href属性值加上地址,注意:这里是绝对路径,不用加 点.
+      a.href = './国航行李整合及应用项目-用户使用手册V2.1.pdf';
+      // 设置下载文件文件名,这里加上.xlsx指定文件类型,pdf文件就指定.fpd即可
+      a.download = '国航行李整合及应用项目-用户使用手册V2.1.pdf';
+      // 障眼法藏起来a标签
+      a.style.display = 'none';
+      // 将a标签追加到文档对象中
+      document.body.appendChild(a);
+      // 模拟点击了<a>标签,会触发<a>标签的href的读取,浏览器就会自动下载了
+      a.click();
+      // 一次性的,用完就删除a标签
+      a.remove();
+      // window.location.href = './国航行李整合及应用项目-用户使用手册V2.1.pdf'
+    }
   },
 };
 </script>
@@ -234,6 +252,21 @@ export default {
           }
         }
       }
+      .btn-help {
+        height: 20px;
+        line-height: 20px;
+        padding: 0;
+        width: 38px;
+        margin-top: 14px;
+        border: 1px solid #fff;
+        background: none;
+        color: #fff;
+        transition: all 0.3s;
+        &:hover {
+          background: #fff;
+          color: #2d67e3;
+        }
+      }
       .user {
         img {
           position: relative;