最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue-element-admin配置小結(jié)

 更新時(shí)間:2022年04月28日 09:22:44   作者:盲流子開(kāi)發(fā)  
本文主要介紹了vue-element-admin配置小結(jié),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

1. 項(xiàng)目初始化

git clone https://github.com/PanJiaChen/vue-element-admin
cd vue-element-admin
npm install 
npm run dev  

2. 項(xiàng)目精簡(jiǎn)

刪除scr/views下的源碼, 保留:

  • dashboard:首頁(yè)
  • error-page:異常頁(yè)面
  • login:登錄
  • redirect:重定向

對(duì)src/router/index 進(jìn)行相應(yīng)修改

import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
      }
    ]
  }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router

刪除 src/router/modules 文件夾

刪除 src/vendor文件夾

3. 項(xiàng)目配置

進(jìn)入src目錄下的settings.js配置文件

module.exports = {
  title: 'Project Title',
  showSettings: true,
  tagsView: true,
  fixedHeader: false,
  sidebarLogo: false,
  errorLog: 'production'
}

3.1 項(xiàng)目標(biāo)題

在src/settings.js 配置項(xiàng)目標(biāo)題

在這里插入圖片描述

在這里插入圖片描述

3.2 showSettings

showSettings用來(lái)設(shè)置是否顯示控制面板,設(shè)置為false則不顯示

在這里插入圖片描述

3.3 tagsView

tagsView是我們打開(kāi)某個(gè)頁(yè)面是否有頁(yè)面標(biāo)簽

3.4 fixedHeader

fixedHeader是內(nèi)容頁(yè)面向下滑動(dòng)時(shí)頭部是否固定,false是不固定, true是固定

在這里插入圖片描述

3.5 sidebarLogo

sidebarLogo控制菜單欄上方是否顯示圖標(biāo)

在這里插入圖片描述

3.6 源碼調(diào)試

打開(kāi)vue.config.js文件

找到如下圖的位置

在這里插入圖片描述

cheap-source-map調(diào)試模式?jīng)]有完全編譯展示我們的源代碼

我們改成source-map調(diào)試模式,這時(shí)候再來(lái)看Sources的App.vue文件,已經(jīng)和源代碼顯示的一樣,在這樣的環(huán)境下調(diào)試我們會(huì)更加方便
但是source-map有一個(gè)缺點(diǎn),每當(dāng)我們程序有改動(dòng)時(shí),也需要同步生成source-map文件,這樣會(huì)使我們構(gòu)建變慢,在實(shí)際開(kāi)發(fā)過(guò)程中推薦使用eval,以增加構(gòu)建速度 在需要調(diào)試的時(shí)候使用source-map

在這里插入圖片描述

4. 項(xiàng)目結(jié)構(gòu)分析

在這里插入圖片描述

  • api :接口請(qǐng)求
  • assets :一些靜態(tài)文件
  • components : 封裝組件
  • direcetive :自定義指令
  • filters :過(guò)濾器
  • icons :圖標(biāo)
  • layout :全局框架組件(非常重要)
  • router :路由
  • store :配置vuex
  • styles :全局樣式文件
  • utils :工具類
  • views :頁(yè)面組件
  • App.vue :父組件,其他的組件都是嵌套在App.vue里
  • main.js :全局入口文件,將App.vue設(shè)置為全局父組件進(jìn)行渲染
  • permissions.js :登錄的校驗(yàn)和登錄之后的路由跳轉(zhuǎn)
  • setting.js :配置文件

到此這篇關(guān)于vue-element-admin配置小結(jié)的文章就介紹到這了,更多相關(guān)vue-element-admin配置內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue如何移動(dòng)到指定位置(scrollIntoView)親測(cè)避坑

    vue如何移動(dòng)到指定位置(scrollIntoView)親測(cè)避坑

    這篇文章主要介紹了vue如何移動(dòng)到指定位置(scrollIntoView)親測(cè)避坑,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-05-05
  • vue項(xiàng)目如何讀取本地json文件數(shù)據(jù)實(shí)例

    vue項(xiàng)目如何讀取本地json文件數(shù)據(jù)實(shí)例

    很多時(shí)候我們需要從本地讀取JSON文件里面的內(nèi)容,這篇文章主要給大家介紹了關(guān)于vue項(xiàng)目如何讀取本地json文件數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下
    2023-06-06
  • vue.js表單驗(yàn)證插件(vee-validate)的使用教程詳解

    vue.js表單驗(yàn)證插件(vee-validate)的使用教程詳解

    這篇文章主要介紹了vue.js表單驗(yàn)證插件(vee-validate)的使用,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-05-05
  • vue移動(dòng)端實(shí)現(xiàn)紅包雨效果

    vue移動(dòng)端實(shí)現(xiàn)紅包雨效果

    這篇文章主要為大家詳細(xì)介紹了vue移動(dòng)端實(shí)現(xiàn)紅包雨效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-07-07
  • vue實(shí)現(xiàn)樹狀表格效果

    vue實(shí)現(xiàn)樹狀表格效果

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)樹狀表格效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • 關(guān)于vant的時(shí)間選擇器使用方式

    關(guān)于vant的時(shí)間選擇器使用方式

    這篇文章主要介紹了關(guān)于vant的時(shí)間選擇器使用方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-03-03
  • Vue項(xiàng)目服務(wù)器部署刷新頁(yè)面404問(wèn)題及解決

    Vue項(xiàng)目服務(wù)器部署刷新頁(yè)面404問(wèn)題及解決

    這篇文章主要介紹了Vue項(xiàng)目服務(wù)器部署刷新頁(yè)面404問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • 在移動(dòng)端使用vue-router和keep-alive的方法示例

    在移動(dòng)端使用vue-router和keep-alive的方法示例

    這篇文章主要介紹了在移動(dòng)端使用vue-router和keep-alive的方法示例,vue-router與keep-alive提供的路由體驗(yàn)與移動(dòng)端是有一定差別的,感興趣的小伙伴們可以參考一下
    2018-12-12
  • VUE中的v-if與v-show區(qū)別介紹

    VUE中的v-if與v-show區(qū)別介紹

    這篇文章介紹了VUE中v-if與v-show的區(qū)別,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-03-03
  • ubuntu中利用nginx部署vue項(xiàng)目的完整步驟

    ubuntu中利用nginx部署vue項(xiàng)目的完整步驟

    Nginx是一款輕量級(jí)的Web服務(wù)器/反向代理服務(wù)器及電子郵件(IMAP/POP3)代理服務(wù)器,在BSD-like 協(xié)議下發(fā)行,下面這篇文章主要給大家介紹了關(guān)于ubuntu中利用nginx部署vue項(xiàng)目的相關(guān)資料,需要的朋友可以參考下
    2022-02-02

最新評(píng)論

重庆市| 灵石县| 张家界市| 宁远县| 广德县| 临西县| 香格里拉县| 洛扎县| 黔南| 霍城县| 定南县| 左云县| 宝兴县| 航空| 南木林县| 琼中| 兴文县| 汕尾市| 永安市| 毕节市| 五指山市| 葫芦岛市| 南昌县| 汤原县| 仙桃市| 新巴尔虎右旗| 雷山县| 双城市| 福贡县| 迁安市| 玉林市| 利川市| 肇庆市| 澳门| 临汾市| 陇川县| 鄯善县| 广宁县| 汝南县| 平武县| 宁国市|