From 5e16a06fc90a67907ba1afdf648a13ebb2ae1d59 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 31 一月 2023 08:28:10 +0800
Subject: [PATCH] 1.新增页面刷新功能

---
 /dev/null                        |   16 --------
 src/layout/components/Navbar.vue |   39 ++++++++++++-------
 src/App.vue                      |   22 ++++++++++-
 3 files changed, 44 insertions(+), 33 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index b281de5..ba3db65 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,13 +1,31 @@
 <template>
   <div id="app">
     <!--    <keep-alive>-->
-    <router-view />
+    <router-view v-if="isShow" />
     <!--    </keep-alive>-->
   </div>
 </template>
 
 <script>
 export default {
-  name: 'App'
+  name: 'App',
+  provide() {
+    return {
+      reload: this.reload
+    }
+  },
+  data() {
+    return {
+      isShow: true
+    }
+  },
+  methods: {
+    reload() {
+      this.isShow = false
+      this.$nextTick(() => {
+        this.isShow = true
+      })
+    }
+  }
 }
 </script>
diff --git a/src/components/PageRefresh/PageRefresh.vue b/src/components/PageRefresh/PageRefresh.vue
deleted file mode 100644
index 9e06760..0000000
--- a/src/components/PageRefresh/PageRefresh.vue
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--椤甸潰鍒锋柊鍔熻兘缁勪欢  鏆備笉寮�鍙�   鏈夐渶姹備簡鍐嶅紑鍙�-->
-<template>
-  <div>
-    <i class="el-icon-refresh-right" style="font-size: 20px;cursor: pointer;line-height:50px" />
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'PageRefresh'
-}
-</script>
-
-<style scoped>
-
-</style>
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 3f7e36f..7d7320f 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -12,22 +12,26 @@
         @toggleClick="toggleSideBar"
       />
       <!--      :style="{marginLeft:$store.state.settings.menuIsHorizontal?'50px':'40px'}"-->
+      <!--      :style="{marginLeft:$store.state.settings.menuIsHorizontal?'20px':''}"-->
+
       <breadcrumb
         class="breadcrumb-container"
-        :style="{marginLeft:$store.state.settings.menuIsHorizontal?'20px':''}"
+        :style="{marginLeft:$store.state.settings.menuIsHorizontal?'60px':'40px'}"
       />
 
-      <!--椤甸潰鍒锋柊鍔熻兘  鏆備笉寮�鍙�   鏈夐渶姹備簡鍐嶅紑鍙�-->
-      <!--      <el-tooltip class="item" effect="dark" content="鍒锋柊椤甸潰" placement="bottom">-->
-      <!--                <PageRefresh-->
-      <!--                  :style="{-->
-      <!--                    color:$store.state.settings.headBackgroundColorValue?'#fff':'#000',-->
-      <!--                    marginLeft:$store.state.settings.menuIsHorizontal?'20px':'50px'-->
-      <!--                  }"-->
-      <!--                  style="position: absolute;"-->
-      <!--                  @click="pageRefreshClick"-->
-      <!--                />-->
-      <!--      </el-tooltip>-->
+      <el-tooltip class="item" effect="dark" content="鍒锋柊椤甸潰" placement="bottom">
+        <div
+          :style="{
+            color:$store.state.settings.headBackgroundColorValue?'#fff':'#000',
+            marginLeft:$store.state.settings.menuIsHorizontal?'10px':'44px',
+            position:'absolute',
+          }"
+          style="padding:0 8px"
+          @click="pageRefreshClick"
+        >
+          <i class="el-icon-refresh-right" style="font-size: 20px;cursor: pointer;line-height:50px" />
+        </div>
+      </el-tooltip>
 
       <el-menu
         v-if="$store.state.settings.menuIsHorizontal"
@@ -147,7 +151,6 @@
 import Search from '@/components/HeaderSearch'
 import Screenfull from '@/components/Screenfull'
 import variables from '@/styles/variables.scss'
-import PageRefresh from '@/components/PageRefresh/PageRefresh'
 
 export default {
   components: {
@@ -155,8 +158,7 @@
     Breadcrumb,
     Hamburger,
     Search,
-    Screenfull,
-    PageRefresh
+    Screenfull
   },
   directives: { elDragDialog },
   data() {
@@ -200,6 +202,9 @@
       }
     }
   },
+  inject: [
+    'reload'
+  ],
   created() {
     this.usercode = getCookie('navTabId')
     this.username = getCookie('username')
@@ -234,6 +239,10 @@
     }
   },
   methods: {
+    pageRefreshClick() {
+      console.log('鐐瑰嚮浜嗭紒')
+      this.reload()
+    },
     handleSelect(key, keyPath) {
       // console.log(key, keyPath)
     },

--
Gitblit v1.9.3