tangjinzhou 6 years ago
parent
commit
581ee71684
2 changed files with 8 additions and 1 deletions
  1. 4 1
      src/layouts/BasicLayout.vue
  2. 4 0
      src/main.js

+ 4 - 1
src/layouts/BasicLayout.vue

@@ -15,6 +15,7 @@
       <a-layout>
         <a-layout-header style="background: #fff; padding: 0">
           <a-icon
+            v-auth="['admin']"
             class="trigger"
             :type="collapsed ? 'menu-unfold' : 'menu-fold'"
             @click="collapsed = !collapsed"
@@ -29,7 +30,9 @@
         </a-layout-footer>
       </a-layout>
     </a-layout>
-    <SettingDrawer />
+    <Authorized :authority="['admin']">
+      <SettingDrawer />
+    </Authorized>
   </div>
 </template>
 

+ 4 - 0
src/main.js

@@ -3,6 +3,8 @@ import App from "./App.vue";
 import router from "./router";
 import store from "./store";
 import { Button, Layout, Icon, Drawer, Radio, Menu } from "ant-design-vue";
+import Authorized from "./components/Authorized";
+import Auth from "./directives/auth";
 
 Vue.config.productionTip = false;
 
@@ -12,6 +14,8 @@ Vue.use(Icon);
 Vue.use(Drawer);
 Vue.use(Radio);
 Vue.use(Menu);
+Vue.component("Authorized", Authorized);
+Vue.use(Auth);
 
 new Vue({
   router,