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

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

這篇具有很好參考價值的文章主要介紹了React-Admin后臺管理模板|react18+arco+zustand后臺解決方案。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

基于react18.x+vite4+arco-design自研中后臺管理系統(tǒng)解決方案ReactAdmin

react-vite-admin 基于vite4搭建react18.x后臺管理項目。使用了react18 hooks+arco.design+zustand+bizcharts等技術(shù)實現(xiàn)權(quán)限管理模板框架。支持暗黑/亮色主題、i18n國際化、動態(tài)權(quán)限鑒定、3種布局模板、tab路由標(biāo)簽欄等功能。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React18Admin管理系統(tǒng)是首創(chuàng)自研的輕量級中后臺框架,構(gòu)建運行速度快,支持dark/light主題模式。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

技術(shù)棧

  • 編輯器:Vscode
  • 框架技術(shù):react18+vite4+react-router+zustand+axios
  • 組件庫:arco-design (字節(jié)前端react組件庫)
  • 路由管理:react-router-dom^6.16.0
  • 狀態(tài)管理:zustand^4.4.1
  • 模擬數(shù)據(jù):mockjs^1.1.0
  • 模擬請求:axios^1.5.1
  • 圖表庫:bizcharts^4.1.22
  • 編輯器組件:@wangeditor/editor-for-react^1.0.6
  • markdown編輯器:@uiw/react-md-editor^3.23.6
  • 請求進度插件:nprogress^0.2.0

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

react-admin采用字節(jié)出品的react桌面端組件庫arco.design。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

特性

  1. 基于vite4.x構(gòu)建react18后臺,輕/快/小
  2. 使用最新前端技術(shù)棧react18、zustand、bizcharts、react-router、axios
  3. 搭配清新react組件庫arco.design
  4. 支持中英文/繁體國際化語言
  5. 支持動態(tài)路由權(quán)限驗證
  6. 支持動態(tài)tabs標(biāo)簽欄控制
  7. 內(nèi)置多種模板布局樣式

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

項目結(jié)構(gòu)目錄

采用標(biāo)準化的react目錄結(jié)構(gòu),整個項目使用react18 function語法編碼開發(fā)。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

構(gòu)建預(yù)覽圖

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

wangeditor-react圖文編輯器使用的是wangeditor的react版本,支持dark/light主題。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

react-md-editor基于react的markdown編輯器,支持dark/light主題。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

react18-scrollbar項目中使用的虛擬滾動條基于react18自定義組件實現(xiàn)功能。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

// 引入滾動條組件
import RScroll from '@/components/rscroll'

<RScroll autohide maxHeight={100}>
    包裹需要滾動的內(nèi)容塊。。。
</RScroll>

React18-Admin布局模板

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

如上圖:支持分欄+垂直+水平3種通用布局模板。也可以定制化模板樣式。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

/**
 * 主布局模板
 * @author Hs Q:282310962
*/

import { useMemo } from 'react'
import { appStore } from '@/store/app'

import Columns from './template/columns'
import Vertical from './template/vertical'
import Transverse from './template/transverse'

function Layout() {
    const { config: { skin, layout } } = appStore()

    // 布局模板
    const LayoutComponent = useMemo(() => {
        switch(layout) {
            case 'columns':
                return Columns
            case 'vertical':
                return Vertical
            case 'transverse':
                return Transverse
            default:
                return Columns
        }
    }, [layout])
    
    return (
        <div className="radmin__container">
            <LayoutComponent />
        </div>
    )
}

export default Layout

主模板Main.jsx動態(tài)Permission鑒權(quán)驗證。

import './index.scss'
import { Outlet } from 'react-router-dom'
import RScroll from '@/components/rscroll'
import Permission from '@/components/Permission'
import Forbidden from '@/views/error/forbidden'
import { useRoute } from '@/hooks/useRoutes'

export default function Main() {
    const route = useRoute()

    return (
        <>
            <RScroll>
                <div className="ra__layout-main__wrapper">
                    {/* 鑒權(quán)組件 */}
                    <Permission
                        roles={route?.meta?.roles}
                        content={<Forbidden />}
                    >
                        <Outlet />
                    </Permission>
                </div>
            </RScroll>
        </>
    )
}

react-router路由配置

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

/**
 * @title    react-router-dom v6路由配置管理
 * @author    andy
*/

import { useRoutes, Navigate } from 'react-router-dom'

import Error from '@views/error/404'

// 批量導(dǎo)入modules路由
const modules = import.meta.glob('./modules/*.jsx', { eager: true })
const patchRoutes = Object.keys(modules).map(key => modules[key].default).flat()

// useRoutes集中式路由配置
export const routes = [
    {
        path: '/',
        element: <Navigate to="/home" replace={true} />,
        meta: {
            isWhite: true // 路由白名單
        }
    },
    ...patchRoutes,
    // 404模塊 path="*"不能省略
    {
        path: '*',
        element: <Error />,
        meta: {
            isWhite: true
        }
    }
]

const Router = () => useRoutes(routes)

export default Router

lazyload.jsx配置

/**
 * 延遲加載提示
*/

import { Suspense } from 'react'
import { Spin } from '@arco-design/web-react'
import NprogressLoading from './nprogress'

// 加載提示
const SpinLoading = () => {
    return (
        <Spin
            tip='loading...'
            style={{
                width: '100%'
            }}
        />
    )
}

// 延遲加載
const lazyload = LazyComponent => {
    // React 16.6 新增了<Suspense>組件,懶加載的模式需要我們給他加上一層 Loading的提示加載組件
    // return <Suspense fallback={<SpinLoading />}><LazyComponent /></Suspense>
    return <Suspense fallback={<NprogressLoading />}><LazyComponent /></Suspense>
}

export default lazyload

NProgress.jsx配置

/**
 * 加載進度條NProgress
*/

import { Component } from 'react'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

export default class NprogressLoading extends Component {
    constructor(props) {
        super(props)
        NProgress.set(.4)
        NProgress.start()
    }

    componentDidMount() {
        NProgress.done()
    }

    render() {
        return <div />
    }
}

主路由main.jsx配置

/**
 * 主路由配置
 * @author Hs
*/

import { lazy } from 'react'
import {
    IconHome, IconDashboard, IconLink, IconCommand, IconUserGroup, IconLock,
    IconMenu, IconSafe, IconBug, IconHighlight, IconUnorderedList, IconStop
} from '@arco-design/web-react/icon'
import Layout from '@/layouts'
import Blank from '@/layouts/blank'
import lazyload from '../lazyload'

export default [
    /*首頁模塊*/
    {
        path: '/home',
        key: '/home', // 用于Menu組件跳轉(zhuǎn)路由地址
        element: <Layout />,
        meta: {
            // icon: 've-icon-home', // 菜單圖標(biāo)
            icon: <IconHome />,
            name: 'layout__main-menu__home', // i18n國際化標(biāo)題
            title: '主頁',
            isAuth: true, // 需要鑒權(quán)
            isHidden: false, // 是否隱藏菜單
            isAffix: true // 固定tabview標(biāo)簽欄(不可關(guān)閉)
        },
        children: [
            {
                key: '/home',
                index: true,
                element: lazyload(lazy(() => import('@views/home'))),
                meta: {
                    // icon: 've-icon-home',
                    icon: <IconHome />,
                    name: 'layout__main-menu__home-index',
                    title: '首頁',
                    isAuth: true
                }
            },
            // 工作臺
            {
                path: 'dashboard',
                key: '/home/dashboard',
                element: lazyload(lazy(() => import('@views/home/dashboard'))),
                meta: {
                    // icon: 've-icon-computer',
                    icon: <IconDashboard />,
                    name: 'layout__main-menu__home-workplace',
                    title: '工作臺',
                    isAuth: true
                }
            },
            // 外部鏈接
            {
                path: 'https://react.dev/',
                key: 'https://react.dev/',
                meta: {
                    // icon: 've-icon-clip',
                    icon: <IconLink />,
                    name: 'layout__main-menu__home-apidocs',
                    title: 'react.js官方文檔',
                    rootRoute: '/home'
                }
            }
        ]
    },

    /*組件模塊*/
    {
        ...
    },

    /*用戶管理模塊*/
    {
        ...
    },

    /*權(quán)限模塊*/
    {
        ...
    },

    /*錯誤模塊*/
    {
        ...
    }
]

備注:路由菜單參數(shù)配置說明。

/**
 * @description 路由參數(shù)說明
 * @param path ==> 路由地址標(biāo)識
 * @param key ==> 用于Menu組件跳轉(zhuǎn)路由地址
 * @param redirect ==> 重定向地址
 * @param element ==> 視圖頁面路徑
 * 菜單信息(meta)
 *         @param meta.icon ==> 菜單圖標(biāo)
 *         @param meta.title ==> 菜單標(biāo)題
 *         @param meta.name ==> i18n國際化標(biāo)題
 *         @param meta.roles ==> 頁面權(quán)限 ['admin', 'dev', 'test']
 *         @param meta.isAuth ==> 是否需要驗證
 *         @param meta.isHidden ==> 是否隱藏頁面
 *         @param meta.isAffix ==> 是否固定標(biāo)簽(tabs標(biāo)簽欄不能關(guān)閉)
 * */

react自定義路由菜單Menu

基于arco.design組件庫提供的Menu組件封裝三種不同的路由菜單。

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案??React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

<RouteMenu />

<RouteMenu rootRouteEnable />

<RouteMenu rootRouteEnable mode="horizontal" />

RouteMenu路由菜單模板

/**
 * 路由菜單模板
*/

import './index.scss'
import { useState, useMemo, useEffect } from 'react'
import { useNavigate, useLocation } from 'react-router-dom'
import { Menu } from '@arco-design/web-react'
import Icon from '@components/Icon'
import RouteSubMenu from './submenu'
import { routes } from '@/routers'
import { getCurrentRootRoute, findParentRoute } from '@/hooks/useRoutes'
import Locales from '@/locales'

export default function RouteMenu(props) {
    const {
        // 菜單類型(垂直vertical 水平菜單horizontal 彈出pop)
        mode = 'vertical',
        // 菜單風(fēng)格('light' | 'dark')
        theme = 'light',
        // 是否開啟一級路由菜單
        rootRouteEnable = false,

        style = {}
    } = props

    const navigate = useNavigate()
    const { pathname } = useLocation()
    const t = Locales()
    const [openKeys, setOpenKeys] = useState([])
    const rootRoute = getCurrentRootRoute()
    const filterRoutes = routes.filter(item => !item?.meta?.isWhite)

    const menuRoutes = useMemo(() => {
        if(rootRouteEnable) {
            return filterRoutes
        }
        // 過濾一級菜單
        return filterRoutes.find(item => item.path == rootRoute && item.children)?.children
    }, [pathname])

    useEffect(() => {
        setOpenKeys(getKeys(pathname))
    }, [pathname])

    // 獲取選中菜單路由keys數(shù)組
    const getKeys = (key) => {
        return findParentRoute(menuRoutes, key)?.map(item => item?.key)
    }

    const handleNavigate = (key) => {
        const reg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/
        if(reg.test(key)) {
            window.open(key)
        }else {
            navigate(key)
        }
    }

    return (
        <Menu
            className="ra__menus"
            mode={mode}
            theme={theme}
            selectedKeys={[pathname]}
            openKeys={openKeys}
            levelIndent={28}
            style={{ ...style }}
            onClickMenuItem={handleNavigate}
            onClickSubMenu={(_, openKeys) => {
                setOpenKeys(openKeys)
            }}
        >
            { menuRoutes.map(item => {
                if(item?.children) {
                    return RouteSubMenu(item, t)
                }
                return (
                    !item?.meta?.isHidden &&
                    <Menu.Item className="ra__menuItem" key={item.redirect || item.key}>
                        { item?.meta?.icon && <Icon name={item.meta.icon} size={18} style={{marginRight: 10}} /> }
                        { item?.meta?.name && <span>{t[item.meta.name]}</span> }
                    </Menu.Item>
                )
            })}
        </Menu>
    )
}

react18狀態(tài)管理zustand

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

Zustand新一代react狀態(tài)管理工具,內(nèi)置多種插件,支持persist本地存儲服務(wù)。

/**
 * react18狀態(tài)管理庫Zustand4,中間件persist本地持久化存儲
*/
import { create } from 'zustand'
import { persist, createJSONStorage } from 'zustand/middleware'
import { generate, getRgbStr } from '@arco-design/color'

export const appStore = create(
    persist(
        (set, get) => ({
            // 語言(中文zh-CN 英文en 繁體字zh-TW)
            lang: 'zh-CN',
            // 角色類型 roles: ['admin'] / roles: ['admin', 'dev'] / roles: ['dev', test']
            roles: ["dev"],
            // 配置信息
            config: {
                // 布局(分欄columns 縱向vertical 橫向transverse)
                layout: 'columns',
                // 模式(亮色light - 暗黑dark)
                mode: 'light',
                // 主題色
                theme: '#3491FA',
                // 是否折疊菜單
                collapsed: false,
                // 開啟面包屑導(dǎo)航
                breadcrumb: true,
                // 開啟標(biāo)簽欄
                tabsview: true,
                tabRoutes: [],
                // 顯示搜索
                showSearch: true,
                // 顯示全屏
                showFullscreen: true,
                // 顯示語言
                showLang: true,
                // 顯示公告
                showNotice: true,
                // 顯示底部
                showFooter: false
            },
            
            // 更新配置
            updateConfig: (key, value) => set({
                config: { ...get().config, [key]: value }
            }),
            // 設(shè)置角色
            setRoles: (roles) => set({roles}),
            // 設(shè)置多語言
            setLang: (lang) => set({lang}),
            // 設(shè)置主題模式
            setMode: (mode) => {
                if(mode == 'dark') {
                    // 設(shè)置為暗黑主題
                    document.body.setAttribute('arco-theme', 'dark')
                }else {
                    // 恢復(fù)亮色主題
                    document.body.removeAttribute('arco-theme')
                }
                get().updateConfig('mode', mode)
            },
            // 設(shè)置主題樣式
            setTheme: (theme) => {
                const colors = generate(theme, { list: true })
                colors.map((item, index) => {
                    const rgbStr = getRgbStr(item)
                    document.body.style.setProperty(`--arcoblue-${index + 1}`, rgbStr)
                })
                get().updateConfig('theme', theme)
            }
        }),
        {
            name: 'appState',
            // name: 'app-store', // name of the item in the storage (must be unique)
            // storage: createJSONStorage(() => sessionStorage), // by default, 'localStorage'
        }
    )
)

react18國際化配置i18n

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

/**
 * 國際化配置
 * @author YXY
 */

import { appStore } from '@/store/app'

// 引入語言配置
import enUS from './en-US'
import zhCN from './zh-CN'
import zhTW from './zh-TW'

export const locales = {
    'en': enUS,
    'zh-CN': zhCN,
    'zh-TW': zhTW
}

export default (locale) => {
    const appState = appStore()
    const lang = appState.lang || 'zh-CN'

    return (locale || locales)[lang] || {}
}

App.jsx引入arco.design組件庫語言包。

/**
 * 入口模板
 * @author Hs
*/

import { useEffect, useMemo } from 'react'
import { HashRouter } from 'react-router-dom'
// 通過 ConfigProvider 組件實現(xiàn)國際化
import { ConfigProvider } from '@arco-design/web-react'
// 引入語言包
import enUS from '@arco-design/web-react/es/locale/en-US'
import zhCN from '@arco-design/web-react/es/locale/zh-CN'
import zhTW from '@arco-design/web-react/es/locale/zh-TW'

import { AuthRouter } from '@/hooks/useRoutes'
import { appStore } from '@/store/app'

// 引入路由配置
import Router from './routers'

function App() {
    const { lang, config: { mode, theme }, setMode, setTheme } = appStore()

    const locale = useMemo(() => {
        switch(lang) {
            case 'en':
                return enUS
            case 'zh-CN':
                return zhCN
            case 'zh-TW':
                return zhTW
            default:
                return zhCN
        }
    }, [lang])

    useEffect(() => {
        setMode(mode)
        setTheme(theme)
    }, [])

    return (
        <ConfigProvider locale={locale}>
            <HashRouter>
                <AuthRouter>
                    <Router />
                </AuthRouter>
            </HashRouter>
        </ConfigProvider>
    )
}

export default App

Lang.jsx配置

import { Dropdown, Menu, Button } from '@arco-design/web-react'
import Icon from '@components/Icon'
import { appStore } from '@/store/app'

export default function Lang() {
    const { lang, setLang } = appStore()

    const handleLang = val => {
        setLang(val)
    }

    return (
        <Dropdown
            position="bottom"
            droplist={
                <Menu className="radmin__dropdownLang" defaultSelectedKeys={[lang]} onClickMenuItem={handleLang}>
                    <Menu.Item key='zh-CN'>簡體中文 <span>zh-CN</span></Menu.Item>
                    <Menu.Item key="zh-TW">繁體字 <span>zh-TW</span></Menu.Item>
                    <Menu.Item key="en">英文 <span>en</span></Menu.Item>
                </Menu>
            }
        >
            <Button
                shape="circle"
                size="small"
                icon={<Icon name="ve-icon-lang" />}
            />
        </Dropdown>
    )
}

Tabs.jsx動態(tài)路由欄

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

項目中動態(tài)路由欄tabs采用arco.design組件庫Tabs組件自定義實現(xiàn)功能。

<Tabs
    activeTab={pathname}
    editable
    showAddButton={false}
    onDeleteTab={key => delTabs(key)}
>
    { tabRoutes.map(item => (
        <Tabs.TabPane
            closable={!item?.meta?.isAffix}
            key={item?.redirect || item?.key}
            title={
                <Dropdown
                    trigger='contextMenu'
                    position='bl'
                    droplist={
                        <Menu className="ra__dropdownContext" onClickMenuItem={(key, e) => handleClickMenuItem(key, e, item)}>
                            <Menu.Item key="close" disabled={item?.meta?.isAffix}><Icon name="ve-icon-close" />{t['tabview__contextmenu-close']}</Menu.Item>
                            <Menu.Item key="closeLeft" disabled={isFirstTab()}><Icon name="ve-icon-prev" />{t['tabview__contextmenu-closeleft']}</Menu.Item>
                            <Menu.Item key="closeRight" disabled={isLastTab()}><Icon name="ve-icon-next" />{t['tabview__contextmenu-closeright']}</Menu.Item>
                            <Menu.Item key="closeOther"><Icon name="ve-icon-reset" />{t['tabview__contextmenu-closeother']}</Menu.Item>
                            <Menu.Item key="closeAll"><Icon name="ve-icon-close-circle-o" />{t['tabview__contextmenu-closeall']}</Menu.Item>
                        </Menu>
                    }
                    onVisibleChange={visible=>handleOpenContextMenu(visible, item)}
                >
                    <span className="ra__tabsview-title" onClick={() => navigate(item?.redirect || item?.key)}>
                        <TabIcon path={item?.key} />
                        { t[item?.meta?.name] }
                    </span>
                </Dropdown>
            }
        />
    ))}
</Tabs>
export default function TabsView() {
    const { pathname } = useLocation()
    const navigate = useNavigate()
    const [selectedTab, setSelectedTab] = useState()
    const { config: { tabRoutes }, updateConfig } = appStore()
    const route = useRoute()
    const t = Locales()

    useEffect(() => {
        addTabs()
    }, [pathname])

    // 添加
    const addTabs = () => {
        const tabIndex = tabRoutes.findIndex(item => item?.key === pathname)
        let newTabs = tabRoutes
        if(tabIndex == -1) {
            newTabs.push(route)
        }
        newTabs.map(item => {
            item.isActive = false
            if(item?.key === pathname) {
                item.isActive = true
            }
        })
        updateConfig('tabRoutes', newTabs)
    }

    // 刪除
    const delTabs = (path) => {
        const tabIndex = tabRoutes.findIndex(item => item?.key === path)
        let newTabs = tabRoutes
        if(tabIndex > -1) {
            newTabs.splice(tabIndex, 1)
            updateConfig('tabRoutes', newTabs)
            updateTabs(newTabs)
        }
    }

    // 刪除左側(cè)標(biāo)簽
    const delLeftTabs = (path) => {
        const tabIndex = tabRoutes.findIndex(item => item?.key === path)
        let newTabs = tabRoutes
        if(tabIndex > -1) {
            newTabs = newTabs.filter((item, i) => item?.meta?.isAffix || i >= tabIndex)
            updateConfig('tabRoutes', newTabs)
            updateTabs(newTabs)
        }
    }

    // 刪除右側(cè)標(biāo)簽
    const delRightTabs = (path) => {
        const tabIndex = tabRoutes.findIndex(item => item?.key === path)
        let newTabs = tabRoutes
        if(tabIndex > -1) {
            newTabs = newTabs.filter((item, i) => item?.meta?.isAffix || i <= tabIndex)
            updateConfig('tabRoutes', newTabs)
            updateTabs(newTabs)
        }
    }

    // 刪除其它
    const delOtherTabs = (path) => {
        let newTabs = tabRoutes.filter(item => item?.meta?.isAffix || item?.key === path)
        updateConfig('tabRoutes', newTabs)
        updateTabs(newTabs)
    }

    // 刪除所有
    const delAllTabs = () => {
        let newTabs = tabRoutes.filter(item => item?.meta?.isAffix)
        updateConfig('tabRoutes', newTabs)
        updateTabs(newTabs)
    }

    // 更新跳轉(zhuǎn)選項卡
    const updateTabs = (tabs) => {
        const nextTab = tabs[tabs.length + 1] || tabs[tabs.length - 1]
        if(!nextTab) return
        navigate(nextTab?.redirect || nextTab?.key)
    }

    // 是否第一個標(biāo)簽
    const isFirstTab = () => {
        return selectedTab?.key === tabRoutes[0]?.key || selectedTab?.key === '/home'
    }
    // 是否最后一個標(biāo)簽
    const isLastTab = () => {
        return selectedTab?.key === tabRoutes[tabRoutes.length - 1]?.key
    }

    // 打開右鍵菜單
    const handleOpenContextMenu = (visible, item) => {
        if(visible) {
            setSelectedTab(item)
        }
    }

    // 點擊右鍵菜單項
    const handleClickMenuItem = (key, e, item) => {
        e.stopPropagation()
        const path = item?.key
        switch(key) {
            case 'close':
                delTabs(path)
                break
            case 'closeLeft':
                delLeftTabs(path)
                break
            case 'closeRight':
                delRightTabs(path)
                break
            case 'closeOther':
                delOtherTabs(path)
                break
            case 'closeAll':
                delAllTabs()
                break
        }
    }

    return (
        ...
    )
}

OK,以上就是react18+arco開發(fā)后臺系統(tǒng)的一些分享,希望對大家有所幫助~???

最后附上兩個最新項目實例

https://www.cnblogs.com/xiaoyan2017/p/17630296.html

https://www.cnblogs.com/xiaoyan2017/p/17468074.html

React-Admin后臺管理模板|react18+arco+zustand后臺解決方案

?文章來源地址http://www.zghlxwxcb.cn/news/detail-710807.html

到了這里,關(guān)于React-Admin后臺管理模板|react18+arco+zustand后臺解決方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

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

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 獨立開發(fā)者必備的29個開源React后臺管理模板

    獨立開發(fā)者必備的29個開源React后臺管理模板

    React Web應(yīng)用程序開發(fā)管理后臺可能非常耗時,這和設(shè)計所有前端頁面一樣重要。 以下是收集的近幾年頂級React.js管理模板列表。 這些模板確實很有價值,使開發(fā)人員更容易構(gòu)建應(yīng)用程序后端的用戶界面。 此外,它們將幫助您完善網(wǎng)站的管理后臺,并克服自己制作所有UI部分的

    2024年02月07日
    瀏覽(22)
  • 后臺管理系統(tǒng)模板推薦(vue-element-admin)

    后臺管理系統(tǒng)模板推薦(vue-element-admin)

    vue-element-admin 是基于vue 和 Element-ui 的一套后臺管理系統(tǒng)集成的模板 GitHub地址: https://github.com/PanJiaChen/vue-element-admin 項目在線預(yù)覽: https://panjiachen.gitee.io/vue-element-admin 由尚硅谷提供的 登錄頁面 主頁面 element-ui 是餓了么前端出品的基于 Vue.js的 后臺組件庫,方便程序員進行頁

    2024年02月16日
    瀏覽(22)
  • X-admin經(jīng)典前端后臺管理模板,基于layui的輕量級前端后臺管理框架,簡單,兼容性好,面向所有層次的前后端程序

    X-admin經(jīng)典前端后臺管理模板,基于layui的輕量級前端后臺管理框架,簡單,兼容性好,面向所有層次的前后端程序

    簡介 X-admin基于layui的輕量級前端后臺管理框架,簡單免費,兼容性好,面向所有層次的前后端程序。創(chuàng)立于2017年初,為了敏捷WEB應(yīng)用開發(fā)和簡化企業(yè)應(yīng)用開發(fā)而誕生的。#X-admin從誕生以來一直秉承簡潔實用的設(shè)計原則,在保持出色的性能和至簡的代碼的同時,也注重易用性。

    2024年02月16日
    瀏覽(55)
  • React--》從零開始搭建一個文章后臺管理系統(tǒng)

    React--》從零開始搭建一個文章后臺管理系統(tǒng)

    目錄 項目準備 項目搭建 scss預(yù)處理器的使用 配置基礎(chǔ)路由 組件庫antd的使用 開發(fā)者工具的安裝 登錄模塊 基本樣式搭建 創(chuàng)建表單結(jié)構(gòu) 獲取表單數(shù)據(jù)并進行相關(guān)登錄操作 對登錄模塊的token進行相關(guān)處理 路由鑒權(quán)實現(xiàn) 后臺頁面模塊 基本頁面結(jié)構(gòu)搭建 菜單高亮顯示 展示個人信

    2023年04月17日
    瀏覽(25)
  • Electron-React18-MacOS桌面管理系統(tǒng)|electron27+react仿mac桌面

    Electron-React18-MacOS桌面管理系統(tǒng)|electron27+react仿mac桌面

    基于 React18+Electron27+ArcoDesign 仿macOS桌面端系統(tǒng)框架 ElectronMacOS 。 electron-react-macOs 基于 electron27.x+vite4+react18+arcoDesign+zustand 等技術(shù)構(gòu)建桌面版仿MacOs框架系統(tǒng)解決方案。支持 中英文/繁體、dark+light主題、桌面多層級路由、多窗口路由頁面、動態(tài)換膚、Dock懸浮菜單 等功能。 Elec

    2024年02月05日
    瀏覽(24)
  • React主流開源UI庫分析(附優(yōu)質(zhì)管理端模板)

    以下列舉了一些React主流的開源UI庫,希為某些所謂的大廠不要再重復(fù)造輪子,當(dāng)然,確實有情懷筆者也為你點贊; 從Star及Fork數(shù)據(jù)來看,國內(nèi)以Ant Design為主,國外以Material UI為主;另外,Material UI已經(jīng)形成了較完整的生態(tài),你可以自己開發(fā)管理模板掛上去銷售。 名稱 Star Fo

    2024年02月08日
    瀏覽(24)
  • 【退役之重學(xué)前端】使用vite+vue3+vue-router,重構(gòu)react+react-router前后端分離的商城后臺管理系統(tǒng)

    前言: 對前端各個技術(shù)板塊,HTML、CSS、JavaScript、ES6、vue家族,整體上能“摸其大概”。筆者計劃重構(gòu)一個基于react的商城后臺管理系統(tǒng)。 —— 2024年2月16日 vue3 sass bootstrap ES7 前后端分離 分層架構(gòu) 模塊化開發(fā) npm vite git

    2024年02月20日
    瀏覽(25)
  • zdpreact_antdesginpro 研究一下react里面比較流行的一個UI框架,開發(fā)后臺管理系統(tǒng)

    zdpreact_antdesginpro 研究一下react里面比較流行的一個UI框架,開發(fā)后臺管理系統(tǒng)

    首先看一下最開始的代碼: 這里面大部分的東西都可以刪掉,比如README,只留下中文的那個就可以了。 之后看看README.md中介紹的特性。 ?? TypeScript : 應(yīng)用程序級 JavaScript 的語言 ?? 區(qū)塊 : 通過區(qū)塊模板快速構(gòu)建頁面 ?? 優(yōu)雅美觀 :基于 Ant Design 體系精心設(shè)計 ?? 常見設(shè)計模

    2024年04月11日
    瀏覽(51)
  • qiankun:react18主應(yīng)用 + 微應(yīng)用 react18 + vue3

    qiankun:react18主應(yīng)用 + 微應(yīng)用 react18 + vue3

    一:主應(yīng)用 搭建react項目 安裝Antd 在 index.js中引入 安裝react-router : 在 index.js中引入 安裝 qiankun : 在主應(yīng)用中注冊微應(yīng)用,在 index.js中引入 注:子應(yīng)用嵌入到主應(yīng)用的地方,id要跟index.js下registerMicroApps里面的container設(shè)置一致 修改App.js文件,將如下代碼放入App.js 修改App.css樣

    2024年02月16日
    瀏覽(43)
  • admin后臺管理

    admin后臺管理

    django 提供了比較完善的后臺管理數(shù)據(jù)庫的接口,可供開發(fā)過程中調(diào)用和測試使用 django 會搜集所有已注冊的模型類,為這些模型類提拱數(shù)據(jù)管理界面,供開發(fā)者使用 admin配置步驟 創(chuàng)建后臺管理帳號- 該賬號為管理后臺最高權(quán)限賬號 管理后臺用戶和組配置 注冊自定義模型類 若

    2024年02月07日
    瀏覽(59)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包