vue-element-admin configuration
阿新 • • 發佈:2020-12-03
1. 專案精簡刪除scr/views下的原始碼, 保留:
-
- dashboard:首頁
- error-page:異常頁面
- login:登入
- redirect:重定向
-
對src/router/index 進行相應修改
1 import Vue from 'vue' 2 import Router from 'vue-router' 3 4 Vue.use(Router) 5 6 /* Layout */ 7 import Layout from '@/layout' 8 9 /** 10 * Note: sub-menu only appear when route children.length >= 1
2.刪除 src/router/modules 資料夾
-
刪除 src/vendor資料夾
2. 專案配置
進入src目錄下的settings.js配置檔案
1 module.exports = { 2 title: 'Project Title', 3 showSettings: true, 4 tagsView: true, 5 fixedHeader: false, 6 sidebarLogo: false, 7 errorLog: 'production' 8 }
3.1 專案標題
在src/settings.js 配置專案標題
3.2 showSettings
showSettings用來設定是否顯示控制面板,設定為false則不顯示
3.3 tagsView
tagsView是我們開啟某個頁面是否有頁面標籤
3.4 fixedHeader
fixedHeader是內容頁面向下滑動時頭部是否固定,false是不固定, true是固定
3.5 sidebarLogo
sidebarLogo控制選單欄上方是否顯示圖示
3.6 原始碼除錯
開啟vue.config.js檔案
找到如下圖的位置
cheap-source-map除錯模式沒有完全編譯展示我們的原始碼
我們改成source-map除錯模式,這時候再來看Sources的App.vue檔案,已經和原始碼顯示的一樣,在這樣的環境下除錯我們會更加方便
但是source-map有一個缺點,每當我們程式有改動時,也需要同步生成source-map檔案,這樣會使我們構建變慢,在實際開發過程中推薦使用eval,以增加構建速度 在需要除錯的時候使用source-map
3. 專案結構分析
- api :介面請求
- assets :一些靜態檔案
- components : 封裝元件
- direcetive :自定義指令
- filters :過濾器
- icons :圖示
- layout :全域性框架元件(非常重要)
- router :路由
- store :配置vuex
- styles :全域性樣式檔案
- utils :工具類
- views :頁面元件
- App.vue :父元件,其他的元件都是巢狀在App.vue裡
- main.js :全域性入口檔案,將App.vue設定為全域性父元件進行渲染
- permissions.js :登入的校驗和登入之後的路由跳轉
- setting.js :配置檔案
轉自:https://blog.csdn.net/pjsdsg/article/details/104918098/