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

@bingoit/desktop-base

Package Overview
Dependencies
Maintainers
6
Versions
296
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bingoit/desktop-base

PC端基础模块

  • 1.3.13
  • latest
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

desktop-base

定义PC端基础功能,如:登录功能,菜单功能等;

安装方法

npm install @bingoit/desktop-base --save

使用方法

需要依赖desktop-ui模块,所以使用时需要先引入“desktop-ui”:

import Vue from 'vue';
import BingoDesktopUI from '@bingoit/desktop-ui';
Vue.use(BingoDesktopUI);

使用时需要配置相关参数:
1.系统参数的配置
参数设置:如设置系统名称,logo地址,是否为调试模式,移动端域名等。

 import {initSystem} from "@bingoit/desktop-base/lib/setting";
 initSystem({
     name: '测试系统名称 ',
     logo: require('../../assets/logo.png'),
     isDebug: true,
     mobileDomain: ''
 });

import DesktopBase from "@bingoit/desktop-base";
Vue.use(DesktopBase, {
    name: '测试系统名称 ',
    logo: require('../../assets/logo.png'),
    isDebug: true,
    mobileDomain: ''
})

2.设置Ajax请求

//设置ajax请求,返回结果为未登录状态时的处理方法
import {removeLoginState, removeUserInfo, removeToken, getToken} from "@bingoit/utils";
import { setTokenHandler, setNotLoginHandler } from "@bingoit/ajax";
setNotLoginHandler(this,function () {
    removeLoginState();
    removeUserInfo();
    removeToken();
    router.push('/login').then(() => {});
});
//设置token
setTokenHandler(this, function () {
    return getToken();
});

3.配置Vuex(基础模块的Vuex导入);如:

 import Vue from 'vue';
 import Vuex from 'vuex';
 Vue.use(Vuex);
 import baseStoreOptions from '@bingoit/desktop-base/lib/store';
 export default new Vuex.Store(baseStoreOptions);

4.设置路由及拦截器;如:

 import Vue from 'vue';
 import Router from 'vue-router';
 import { routerInterceptor } from '@bingoit/desktop-base/lib/router/helper';
 import store from '../store';
 Vue.use(Router);
 import BaseRouters from '@bingoit/desktop-base/lib/router';
 let routeArray = BaseRouters;
 const router = new Router({
     routes: routeArray
 });
 //设置路由拦截
 routerInterceptor(router, store);
 export default router;

FAQs

Package last updated on 18 Jul 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