Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bingoit/cms-desktop

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bingoit/cms-desktop

信息公告PC端

  • 0.3.1
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
6
Weekly downloads
 
Created
Source

cms-desktop

信息公告PC端,主要功能有:信息公告的发布、分类管理、标签管理、群组管理等;

安装方法

npm install @bingoit/cms-desktop --save

使用方法

直接引入信息公告导出的路由,并配置路由就可以使用了。
配置路由的实例代码如下所示:


import Vue from 'vue';
import Router from 'vue-router';
import { isNotEmpty } from '@bingoit/utils';
import { routerInterceptor, registerRouter, getParentRouteByPath } from '@bingoit/desktop-base/lib/router/helper';
import store from './store';
Vue.use(Router);

import CmsRoutes from '@bingoit/cms-desktop/lib/router';
let routeArray = [];
let cmsStaticRoutes = registerRouter(CmsRoutes);
let notMenuDynamicRouters = [];
//CMS路由有点特别:返回的路由中,除了静态路由,还有需要添加到子路由的非菜单路由
if(cmsStaticRoutes) {
    cmsStaticRoutes.forEach(route => {
        //判断是否需要添加到指定路由中;
        // 指定了siblingPath参数的路由,需要添加到对应父路由的子路由中
        if(isNotEmpty(route.siblingPath)) {
            notMenuDynamicRouters.push(route);
        } else {
            routeArray.push(route);
        }
    });
}

const router = new Router({
    routes: routeArray
});
//设置路由拦截;主要是登录拦截
routerInterceptor(router, store, routes => {
    //当动态路由注册完成前,会执行该方法,继续处理动态路由
    //注册非菜单的动态路由;如有些路由需要动态添加到指定路由的子路由中
    if(notMenuDynamicRouters) {
        notMenuDynamicRouters.forEach(route => {
            let parentRoute = getParentRouteByPath(routes, route.siblingPath);
            if(parentRoute) {
                if(!parentRoute.children) {
                    parentRoute.children = new Array();
                }
                parentRoute.children.push(route);
            }
        })
    }
});
export default router;

FAQs

Package last updated on 07 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc