国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

這篇具有很好參考價值的文章主要介紹了尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

目錄

一、程序入口

(一)入口頁面 index.html

(二)?入口js腳本:src/main.js

(三)頂層組件:src/App.vue

(四)路由:src/router/index.js?


一、程序入口

(一)入口頁面 index.html

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

查看源代碼

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

這正是srb-admin/public/index.html

?尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

?我們進入積分等級列表,查看源代碼會發(fā)現(xiàn)仍然是index.html中的代碼

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理?那么它是怎么實現(xiàn)頁面的不同加載的呢?答案:通過腳本

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

(二)?入口js腳本:src/main.js

上面的腳本中的路徑/static/js/app.js我們在文件目錄中找不到,因為它是根據(jù)我們的vue文件、html文件、js文件等動態(tài)生成的,真正的文件是src/main.js

查看代碼我們發(fā)現(xiàn)其導入了很多模塊,就像我們后端創(chuàng)建springboot項目,使用某些功能需要導入對于的starter一樣,即導入依賴

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

?這里掛載element-ui可以像我們前面做例子那樣直接使用<script src="https://unpkg.com/element-ui/lib/index.js"></script>導入,但是這樣只能使用簡單的template定義

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

而無法使用vue文件式的template定義?

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

創(chuàng)建Vue對象,指定渲染的是入口index.html中id為app的div

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

(三)頂層組件:src/App.vue

?既然創(chuàng)建的Vue對象將我們的app組件進行渲染,我們就去看一下App.vue

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

(四)路由:src/router/index.js?

有一個router-view路由出口,是進行模板template展示的 ,在router/index.js中定義了大量的路由,當我們訪問對應path就會跳到對應的組件同時顯示到id為app的div中

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'/'el-icon-x' the icon show in the sidebar
    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: '/login',
    component: () => import('@/views/login/index'),
    hidden: true,
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true,
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index'),
        meta: { title: '首頁', icon: 'dashboard' },
      },
    ],
  },

  {
    path: '/core/integral-grade',
    component: Layout,
    redirect: '/core/integral-grade/list',
    name: 'coreIntegralGrade',
    meta: { title: '積分等級管理', icon: 'el-icon-s-marketing' },
    //false(默認):當父節(jié)點下只有一個子節(jié)點時,不顯示父節(jié)點,直接顯示子節(jié)點
    //true:任何時候都顯示父節(jié)點和子節(jié)點
    alwaysShow: true,
    children: [
      {
        path: 'list',
        name: 'coreIntegralGradeList', // 每個路由的name不能相同
        component: () => import('@/views/core/integral-grade/list'), // 指向的template模板
        meta: { title: '積分等級列表' }, // 定義導航的標題
      },
      {
        path: 'create',
        name: 'coreIntegralGradeCreate',
        component: () => import('@/views/core/integral-grade/form'),
        meta: { title: '新增積分等級' },
      },
      {
        path: 'edit/:id', // :id表示一個占位符,表示這一部分url會是任何一個id,是動態(tài)的
        name: 'coreIntegralGradeEdit',
        component: () => import('@/views/core/integral-grade/form'),
        meta: { title: '編輯積分等級' },
        hidden: true,
      },
    ],
  },

  {
    path: '/core',
    component: Layout,
    redirect: '/core/dict/list',
    name: 'coreDict',
    meta: { title: '系統(tǒng)設置', icon: 'el-icon-setting' },
    alwaysShow: true,
    children: [
      {
        path: 'dict/list',
        name: '數(shù)據(jù)字典',
        component: () => import('@/views/core/dict/list'),
        meta: { title: '數(shù)據(jù)字典' },
      },
    ],
  },

  {
    path: '/example',
    component: Layout,
    redirect: '/example/table',
    name: 'Example',
    meta: { title: '例子', icon: 'el-icon-s-help' },
    children: [
      {
        path: 'table',
        name: 'Table',
        component: () => import('@/views/table/index'),
        meta: { title: '表格', icon: 'table' },
      },
      {
        path: 'tree',
        name: 'Tree',
        component: () => import('@/views/tree/index'),
        meta: { title: '樹', icon: 'tree' },
      },
    ],
  },

  {
    path: '/form',
    component: Layout,
    children: [
      {
        path: 'index',
        name: 'Form',
        component: () => import('@/views/form/index'),
        meta: { title: '表單', icon: 'form' },
      },
    ],
  },
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  {
    path: '/nested',
    component: Layout,
    redirect: '/nested/menu1',
    name: 'Nested',
    meta: {
      title: 'Nested',
      icon: 'nested',
    },
    children: [
      {
        path: 'menu1',
        component: () => import('@/views/nested/menu1/index'), // Parent router-view
        name: 'Menu1',
        meta: { title: 'Menu1' },
        children: [
          {
            path: 'menu1-1',
            component: () => import('@/views/nested/menu1/menu1-1'),
            name: 'Menu1-1',
            meta: { title: 'Menu1-1' },
          },
          {
            path: 'menu1-2',
            component: () => import('@/views/nested/menu1/menu1-2'),
            name: 'Menu1-2',
            meta: { title: 'Menu1-2' },
            children: [
              {
                path: 'menu1-2-1',
                component: () =>
                  import('@/views/nested/menu1/menu1-2/menu1-2-1'),
                name: 'Menu1-2-1',
                meta: { title: 'Menu1-2-1' },
              },
              {
                path: 'menu1-2-2',
                component: () =>
                  import('@/views/nested/menu1/menu1-2/menu1-2-2'),
                name: 'Menu1-2-2',
                meta: { title: 'Menu1-2-2' },
              },
            ],
          },
          {
            path: 'menu1-3',
            component: () => import('@/views/nested/menu1/menu1-3'),
            name: 'Menu1-3',
            meta: { title: 'Menu1-3' },
          },
        ],
      },
      {
        path: 'menu2',
        component: () => import('@/views/nested/menu2/index'),
        meta: { title: 'menu2' },
      },
    ],
  },

  {
    path: 'external-link',
    component: Layout,
    children: [
      {
        path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
        meta: { title: 'External Link', icon: 'link' },
      },
    ],
  },

  // 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

?以下面為例,?當我們訪問http://localhost:9528/login,會找到/views/login/index.vue頁面進行展示

  // 路由列表
  {
    //
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true,
  },

梳理到這里,我們可以知道最外層組件是App,在App中嵌套了其他組件,當我們訪問不同頁面,App中的組件會變換,比如我們在登錄頁面,App下是login組件

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

那么這些 側(cè)邊欄、導航欄和主頁面是如何組成的呢?

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

?查看src/layout/index.vue我們可以發(fā)現(xiàn)是在這里組裝起來的

<template>
  <div :class="classObj" class="app-wrapper">
    <div
      v-if="device === 'mobile' && sidebar.opened"
      class="drawer-bg"
      @click="handleClickOutside"
    />
    <!--側(cè)邊欄-->
    <sidebar class="sidebar-container" />
    <!-- <Sidebar/> 同理 -->
    <div class="main-container">
      <div :class="{ 'fixed-header': fixedHeader }">
        <!--導航欄-->
        <navbar />
        <!-- <Navbar />  實際上是這樣寫,直接使用組件,但是小寫也支持,所以寫成上一行的寫法 -->
      </div>
      <!--主內(nèi)容區(qū)-->
      <app-main />
      <!-- <AppMain/> 同理 -->
    </div>
  </div>
</template>

<script>
// 導入子組件
import { Navbar, Sidebar, AppMain } from './components'
import ResizeMixin from './mixin/ResizeHandler'

export default {
  name: 'Layout',
  components: {
    //注冊子組件
    Navbar,
    Sidebar,
    AppMain,
  },
  mixins: [ResizeMixin],
  computed: {
    sidebar() {
      return this.$store.state.app.sidebar
    },
    device() {
      return this.$store.state.app.device
    },
    fixedHeader() {
      return this.$store.state.settings.fixedHeader
    },
    classObj() {
      return {
        hideSidebar: !this.sidebar.opened,
        openSidebar: this.sidebar.opened,
        withoutAnimation: this.sidebar.withoutAnimation,
        mobile: this.device === 'mobile',
      }
    },
  },
  methods: {
    handleClickOutside() {
      this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
    },
  },
}
</script>

<style lang="scss" scoped>
@import '~@/styles/mixin.scss';
@import '~@/styles/variables.scss';

.app-wrapper {
  @include clearfix;
  position: relative;
  height: 100%;
  width: 100%;
  &.mobile.openSidebar {
    position: fixed;
    top: 0;
  }
}
.drawer-bg {
  background: #000;
  opacity: 0.3;
  width: 100%;
  top: 0;
  height: 100%;
  position: absolute;
  z-index: 999;
}

.fixed-header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9;
  width: calc(100% - #{$sideBarWidth});
  transition: width 0.28s;
}

.hideSidebar .fixed-header {
  width: calc(100% - 54px);
}

.mobile .fixed-header {
  width: 100%;
}
</style>

總結(jié):App組件下面有l(wèi)ayout組件、layout組件下有Sidebar、Navbar、AppMain組件

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

?尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

?Appmain是怎么實現(xiàn)內(nèi)容的變換的,又是一個子路由?

尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理

?總結(jié):入口index.html中有一個id為app的div,App.vue里導入需要的模塊,創(chuàng)建一個根組件App,App中有一個路由出口,根據(jù)router/index.html中定義的路由進行跳轉(zhuǎn)。在主頁面也就是layout/index.html中將側(cè)邊欄Sidebar,導航欄Navbar和主內(nèi)容區(qū)AppMain結(jié)合,這三個也是組件,AppMain中有子路由出口,對應router中index.html中的children。文章來源地址http://www.zghlxwxcb.cn/news/detail-410754.html

到了這里,關(guān)于尚融寶13-后臺管理系統(tǒng)前端架構(gòu)梳理的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領支付寶紅包贊助服務器費用

相關(guān)文章

  • 前端使用elementui開發(fā)后臺管理系統(tǒng)的常用功能(持續(xù)更新)

    前端使用elementui開發(fā)后臺管理系統(tǒng)的常用功能(持續(xù)更新)

    前言:本次的文章完全是自己開發(fā)中遇到的一些問題,經(jīng)過不斷的修改終于完成的一些功能,當個快捷的查看手冊吧~ 功能描述:數(shù)據(jù)使用的若依的字典,或者是自定義數(shù)據(jù),可以點擊每個選項進行選擇,取消選擇,也可以在已選擇進行清除和單個刪除 使用: @selection-change

    2024年02月09日
    瀏覽(19)
  • Vite-Admin后臺管理系統(tǒng)|vite4+vue3+pinia前端后臺框架實例

    Vite-Admin后臺管理系統(tǒng)|vite4+vue3+pinia前端后臺框架實例

    基于 vite4.x+vue3+pinia 前端后臺管理系統(tǒng)解決方案 ViteAdmin 。 前段時間分享了一篇vue3自研pc端UI組件庫VEPlus。這次帶來最新開發(fā)的基于 vite4+vue3+pinia 技術(shù)棧搭配ve-plus組件庫構(gòu)建的中后臺權(quán)限管理系統(tǒng)框架。 支持vue-i18n國際化多語言、動態(tài)路由鑒權(quán)、4種布局模板及tab頁面緩存 等功

    2023年04月13日
    瀏覽(26)
  • 【前端】Vue+Element UI案例:通用后臺管理系統(tǒng)-面包屑、tag欄

    【前端】Vue+Element UI案例:通用后臺管理系統(tǒng)-面包屑、tag欄

    參考視頻: VUE項目,VUE項目實戰(zhàn),vue后臺管理系統(tǒng),前端面試,前端面試項目 案例 鏈接 【前端】Vue+Element UI案例:通用后臺管理系統(tǒng)-導航欄(視頻p1-16) https://blog.csdn.net/karshey/article/details/127640658 【前端】Vue+Element UI案例:通用后臺管理系統(tǒng)-Header+導航欄折疊(p17-19) http

    2024年02月09日
    瀏覽(62)
  • VUE通用后臺管理系統(tǒng)(四)前端導出文件(CSV、XML、HTML、PDF、EXCEL)

    VUE通用后臺管理系統(tǒng)(四)前端導出文件(CSV、XML、HTML、PDF、EXCEL)

    常見的導出格式:CSV、XML、HTML、PDF、EXCEL 1)準備工作 安裝所需相關(guān)依賴 前兩個是PDF格式需要的依賴,后兩個是excel格式所需,如果沒有需求這兩種格式的可以忽略這一步 然后畫頁面 ? 頁面效果 2)導出CSV格式的文件 新建src/utils/utils.js文件 寫入exportCsv方法,columns為表頭,

    2024年02月05日
    瀏覽(56)
  • 尚融寶28-投資列表展示

    目錄 一、管理員端顯示投資記錄 (一)后端 (二)前端 二、網(wǎng)站端顯示投資記錄 (一)后端 (二)前端 三、管理員端顯示還款計劃 (一)后端 (二)前端 四、網(wǎng)站端顯示還款計劃 (一)后端 (二)前端 五、網(wǎng)站端顯示回款計劃 (一)后端 (二)前端 controller 創(chuàng)建

    2024年02月02日
    瀏覽(26)
  • 尚融寶21-整合springcloud

    尚融寶21-整合springcloud

    目錄 ? 一、整合注冊中心nacos 二、整合openFeign (一)準備工作 (二)導入依賴? (三)接口的遠程調(diào)用 (四)配置超時控制和日志打印 三、整合Sentinel 四、整合gateway服務網(wǎng)關(guān) 使用nacos1.4.1,下載地址:Releases · alibaba/nacos · GitHub 詳細可以看這篇文章:SpringCloud AlibabaNacos服

    2023年04月25日
    瀏覽(18)
  • 基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)(前端篇)七:工作臺界面實現(xiàn)

    基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)(前端篇)七:工作臺界面實現(xiàn)

    ??本章實現(xiàn)工作臺界面相關(guān)內(nèi)容,包括echart框架引入,mock框架引入等,實現(xiàn)工作臺界面框架搭建,數(shù)據(jù)加載。 1. 詳細課程地址: https://edu.csdn.net/course/detail/38183 2. 源碼下載地址: 點擊下載 基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)合集-工作臺界面布局實現(xiàn) echart官網(wǎng):https

    2024年02月14日
    瀏覽(26)
  • 基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)(前端篇)十一:通用表單組件封裝實現(xiàn)

    基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)(前端篇)十一:通用表單組件封裝實現(xiàn)

    ??本章實現(xiàn)通用表單組件,根據(jù)實體配置識別實體屬性,并自動生成編輯組件,實現(xiàn)對應數(shù)據(jù)填充、校驗及保存等邏輯。 1. 詳細課程地址: https://edu.csdn.net/course/detail/38183 2. 源碼下載地址: 點擊下載

    2024年02月10日
    瀏覽(29)
  • 基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)(前端篇)八:自定義組件封裝上

    基于VUE3+Layui從頭搭建通用后臺管理系統(tǒng)(前端篇)八:自定義組件封裝上

    ??本章實現(xiàn)一些自定義組件的封裝,包括數(shù)據(jù)字典組件的封裝、下拉列表組件封裝、復選框單選框組件封裝、單選框組件封裝、文件上傳組件封裝、級聯(lián)選擇組件封裝、富文本組件封裝等。 1. 詳細課程地址: https://edu.csdn.net/course/detail/38183 2. 源碼下載地址: 點擊下載

    2024年02月12日
    瀏覽(26)
  • 尚融寶14-集成redis緩存

    尚融寶14-集成redis緩存

    目錄 一、簡介 1、場景 2、RedisTemplate 二、引入Redis 1、項目中集成Redis 2、添加Redis連接配置 3、啟動Redis服務 三、測試RedisTemplate 1、存值測試 2、Redis配置文件 3、取值測試 四、將數(shù)據(jù)字典存入redis 由于數(shù)據(jù)字典的變化不是很頻繁,而且系統(tǒng)對數(shù)據(jù)字典的訪問較頻繁,所以我們

    2023年04月08日
    瀏覽(18)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包