npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hb_soft/core

v1.0.4

Published

环博软件前端开发VUE核心基础包

Downloads

9

Readme

@hb_soft/core

描述:

vue项目核心包,包含启动配置、appInfo、http、util、core、message 采用ts编写,通过tsc编译,gulp打包,生成npm包

API

1.BOOTSTRAP()

描述:项目启动方法,支持移动端和PC端,网关支持JS和json。(免挂载vue)

BOOTSTRAP(Vue: any, vueConfig: any, hbConfig: HBConfig ): Promise<any>

​ 文件:bootstrap.ts ( export default bootstrap )

​ 参数:

| 参数 | 说明 | 类型 | 默认值 | 版本 | | :-------- | ------------------------------------------------------------ | -------- | ------ | ---- | | Vue | 传入Vue | any | 无 | | | vueConfig | new Vue传入的对象 | any | 无 | | | hbConfig | 项目配置对象:包含msg、notify、loading、session、local、http | HBConfig | 无 | |

示例:

import { BOOTSTRAP } from ''@hb_soft/core';

 bootstrap(
		Vue,
		{ 
			router,
            store,
            render: h => h(App)
		},
		{
			msg: {
				duration:2,
				...msgImpl
			}
		},
		...
  )

2.appStart()

描述:项目启动方法,支持移动端和PC端,网关支持JS和json。(需要手动挂载Vue)

文件:core/app-start.ts

appStart(callback?: Function): Promise<any> 

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ----------------- | -------- | ------ | ---- | | callback | 回调函数 【可选】 | fucntion | 无 | |

示例:

import { appStart,Loading,Msg,Notify,Http,Setting } from ''@hb_soft/core';

Vue.use(Loading,{
	namespace:'loading',//this.$loading
	start(){},
	end(){}
})
Vue.use(Msg,{
	namespace:'msg',//this.$msg
	duration:2,
	info(){},
	success(){},
	warning(){},
	error(){}
})
Vue.use(Notify,{
	namespace:'notify',//this.$notify
    title:'提示',
	duration:2,
	info(){},
	success(){},
	warning(){},
	error(){}
})
Vue.use(Http,{
	namespace:'http' //this.$http();
})

bootstrap().then(() => {
   Vue.use(Setting,{namespace:'setting'}) //加载完后挂载,才会有所有配置,this.$setting
   new Vue({
     router,
     store,
     render: h => h(App)
   }).$mount('#app')
 })

3. Setting

描述:获取项目配置,获取网关配置

文件:core/app-info.service.ts

默认命名空间为:setting。 this.$setting

appcode()

描述:获取项目APP_CODE

 appcode(): string

无参数

gatewayUrl()

描述:获取网关URL配置

gatewayUrl(): string 

无参数

getAppConfig()

描述:获取项目的配置:不传参数获取所有配置,传某个key则获取该项的配置

getAppConfig(configKey?: string): any

| 参数 | 描述 | 类型 | 默认值 | 版本 | | --------- | ----------------------- | ------ | ------ | ---- | | configKey | 项目配置项的键 【可选】 | string | 无 | |

示例:

假设项目配置如下:
module.exports ={
    GATEWAY_BASE: 'http://192.168.16.188:729/',
    // GATEWAY_API:'/config/GetJs.json',
    GATEWAY_API:'api/sysconfig/GetJs',
    APP_CODE: '',
    SINGLE_SIGN_KEY: 'SERVER_JS_SSO'
}

1. this.$setting.getAppConfig() 
//返回{
    GATEWAY_BASE: 'http://192.168.16.188:729/',
    // GATEWAY_API:'/config/GetJs.json',
    GATEWAY_API:'api/sysconfig/GetJs',
    APP_CODE: '123456',
    SINGLE_SIGN_KEY: 'SERVER_JS_SSO'
}

2.this.$setting.getAppConfig('APP_CODE') 等价于 this.$setting.appcode()
//123456

3.this.$setting.gatewayUrl('GATEWAY_BASE') 等价于 this.$setting.gatewayUrl()
//'http://192.168.16.188:729/'

getGatewayResource()

描述:获取网关配置:不传参数返回所有配置,传key则返回该项配置

getGatewayResource(configKey?: string, ): any

| 参数 | 描述 | 类型 | 默认值 | 版本 | | --------- | ----------------------- | ------ | ------ | ---- | | configKey | 网关配置项的键 【可选】 | string | 无 | |

示例:

假设网关配置为:{
"SERVER_API_ImportExport": {
    "Name":"导入导出服务接口地址",
	"Code":"SERVER_API_ImportExport",
	"Value":"ImportExport"
 },
 SERVER_JS_SSO: {
 	Name: "单点登陆地址",
    Code: "SERVER_JS_SSO",
    Value: "http://192.168.16.188:1001/Client/JiaFaSoftSignin"
  }
}

1. this.$setting.getGatewayResource();
//{
	"SERVER_API_ImportExport":{
    	"Name":"导入导出服务接口地址",
		"Code":"SERVER_API_ImportExport",
		"Value":"ImportExport"
 	},
 	SERVER_JS_SSO: {
        Name: "单点登陆地址",
        Code: "SERVER_JS_SSO",
        Value: "http://192.168.16.188:1001/Client/JiaFaSoftSignin"
     }
}

2. this.$setting.getGatewayResource(SERVER_API_ImportExport);
// {
    	"Name":"导入导出服务接口地址",
		"Code":"SERVER_API_ImportExport",
		"Value":"ImportExport"
}

getGatewayValue()

描述:获取网关配置项的Value值

getGatewayValue(configKey?: string): any

| 参数 | 描述 | 类型 | 默认值 | 版本 | | --------- | ----------------------- | ------ | ------ | ---- | | configKey | 网关配置项的键 【可选】 | string | 无 | |

singleSignUrl

描述:获取单点登录的地址

singleSignUrl(): string

无参数

4.Http

描述:http请求方法,统一处理错误,loading,请求拦截,结果处理

文件:core/http.ts

默认命名空间为:http。 使用:this.$http()

$http(api:string|ApiOptions,params?:any,body?:any,httpOptions?: HttpOptions):Promise<any>

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ----------- | ----------------------------------------------------- | ------------------ | ------ | ---- | | api | 为字符串的时候,method=get;为ApiOpions时参考接口传参 | string|ApiOptions | 无 | | | data | method为post/put/patch的时候, 为body,其余为params | any | 无 | | | httpOptions | http请求参数配置,参数参考接口【可选】 | HttpOptions | 无 | |

示例:

如:
api配置文件: api.js,内容如下:
const DATACENTER_KEY = 'SERVER_API_DATACENTER';
const MSG_KEY = 'SERVER_API_MSG';

export default {
	GetYearsListFromName: '/api/Years/GetYearsListFromName',
	Wether: {
		api:'http://www.baidu.com/api/getWetherList',
		method: 'get',
		full: true
	},
	GetTeacherTurnPageList:{
		api: '/api/TeacherTurn/GetTeacherTurnPageList',
		gateway: DATACENTER_KEY,
		method: 'post'
	}
}
////////////////////////////////////////////////////////////////////////////
import API from './api.js'

1. this.$http(API.GetYearsListFromName) //get请求

2. this.$http(API.Wether,{city: 'chengdu'} ) //get请求

3. this.$http(API.GetTeacherTurnPageList,{id:1,data:2}) //post请求,自动包层model
//返回数据 {
	MZM: “01",
	SFGE: null,
	SFSG: '1'
}

//初始化请求
4. this.$http(
    API.GetTeacherTurnPageList,
    {id:1,data:[2,3,4]},
    {
		 fieldConfig: {
          MZM: "MZ",
          SFGE:{
            type: 'boolean',
            nameKey: '1',
            valueKey:'是'
          },
          SFSG:{
            filedAlias:'是否帅哥',
            type: 'boolean',
            nameKey: '1',
            valueKey:'否'
          }
        }
  })
    
//返回数据 {
	MZM: “01",
	SFGE: null,
	SFLSET: “1”,
	是否帅哥:“是",
	_SFGE: "否"
}

5. local

描述:localStorage方法,免JSON.stringify(),免JSON.parse()并进行容错处理,设置过期时间

文件:core/storage.ts

默认命名空间为:ls。 使用: this.$ls

setItem()

​ 描述: 设置locastorage的值

setItem(key: string, data: any): void

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | ---- | ------ | ------ | ---- | | key | 键 | string | 无 | | | data | 值 | any | 无 | |

示例:

this.$ls.setItem('abc',123);

getItem()

描述:获取localStorage的值

getItem(key: string): any

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | ---- | ------ | ------ | ---- | | key | 键 | string | 无 | |

示例:

this.$ls.getItem('abc'); 
// 123

removeItem()

描述:移除localStorage的值

removeItem(key: string): void

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | ---- | ------ | ------ | ---- | | key | 键 | string | 无 | |

示例:

this.$ls.removeItem('abc');

this.$ls.getItem('abc');
//undefined

refreshItem()

描述: 刷新某项的过期时间

refreshItem(key: string): void

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | ---- | ------ | ------ | ---- | | key | 键 | string | 无 | |

示例:

this.$ls.refreshItem('abc');

clear()

描述:清空缓存,一般要先加确认框

无参数

示例:

this.$ls.clear();

6.session

描述:sessionStorage方法,免JSON.stringify(),免JSON.parse()并进行容错处理,设置过期时间

文件:core/storage.ts

默认命名空间为:ss。 使用: this.$ss

session的所有方法同local

7.msg

描述:统一的消息处理器,全局配置控制,一般该消息用于用户操作界面提示信息。

文件:message/msg.ts

info()

描述:普通消息提示,一般不需要自己传duration,统一读取全局的持续时间

info(content: string, duration?: number): void

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ---------------------------------- | ------ | ------ | ---- | | content | 消息的内容 | string | 无 | | | duration | 持续时间,特殊情况才需要自己传该值 | number | 无 | |

success()

描述:成功的消息,一般不需要自己传duration,统一读取全局的持续时间

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ---------------------------------- | ------ | ------ | ---- | | content | 消息的内容 | string | 无 | | | duration | 持续时间,特殊情况才需要自己传该值 | number | 无 | |

warning()

描述:警告的消息,一般不需要自己传duration,统一读取全局的持续时间

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ---------------------------------- | ------ | ------ | ---- | | content | 消息的内容 | string | 无 | | | duration | 持续时间,特殊情况才需要自己传该值 | number | 无 | |

error()

描述:错误的消息,一般不需要自己传duration,统一读取全局的持续时间

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ---------------------------------- | ------ | ------ | ---- | | content | 消息的内容 | string | 无 | | | duration | 持续时间,特殊情况才需要自己传该值 | number | 无 | |

示例:

this.$msg.info();
this.$msg.success();
this.$msg.warning();
this.$msg.error();

8.notify

描述:统一的全局消息提示。一般不用此方法,http里调用的是该方法。

文件:message/notify.ts

命名空间: 默认为notify。 使用: this.$notify.info('消息提示')

info()

描述:普通消息提示,一般不需要自己传duration,统一读取全局的持续时间

info(content: string, title?: string, duration?: number): void

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ------------------ | ------ | ------ | ---- | | content | 消息的内容 | string | 无 | | | title | 消息的标题【可选】 | string | 无 | | | duration | 持续时间【可选】 | number | 无 | |

success()

描述:成功消息提示,一般不需要自己传duration,统一读取全局的持续时间

方法、参数同 8.1 info()

warning()

描述:警告消息提示,一般不需要自己传duration,统一读取全局的持续时间

方法、参数同 8.1 info()

error()

描述:错误消息提示,一般不需要自己传duration,统一读取全局的持续时间

方法、参数同 8.1 info()

9.Loading

描述:http请求loading。一般情况业务代码中不需要使用该方法。

文件:message/loading.ts

命名空间:默认loading。使用: this.$loading.start()

start()

描述:loading开始

无参数

end()

描述:loading结束

无参数

10.Util

getUrlByApi()

描述:传入api配置项,获取完整的URL字符串

文件:http/http.ts

getUrlByApi( api:  string | ApiOptions): string

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | --------- | -------------------- | ------ | ---- | | api | API配置项 | string | ApiOptions | 无 | |

示例:

import { getUrlByApi } from '@hb_soft/core';

getPCDName()

描述:获取省(Province)市(City)区(District)名称

文件:utils/city.util.ts

getPCDName  (city: string, joinStr?: string):string

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ------- | ---------------------------------------------------------- | ------ | ------ | ---- | | city | 格式为50001,50002,50003 | 字符串 | 无 | | | joinStr | 省市区连接符,默认为 /,即:四川省/成都市/武侯区 【可选】 | 字符串 | / | |

示例:

import { getPCDName } from '@hb_soft/core';

1. getPCDName('500000,500100,500154'); 
//  重庆市/市辖区/开州区

2. getPCDName('500000,500100,500154','-'); 
//  重庆市-市辖区-开州区

getBirthDayFromIdCard()

描述:根据从身份证里获取出生年月日

文件:utils/common.util.ts

 getBirthDayFromIdCard (idCard: string, format?: string): string

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ------ | -------------- | ------ | ---------- | ---- | | idCard | 身份证号 | string | 无 | | | format | 格式化【可选】 | string | YYYY-MM-DD | |

示例:

import { getBirthDayFromIdCard } from '@hb_soft/core';

getBirthDayFromIdCard('511623199103125236');
// 1991-03-12

getBirthDayFromIdCard('511623199103125236','YYYY年MM月DD日');
// 1991年03月12日

debounce()

描述:防抖处理函数

文件:utils/common.util.ts

debounce (func: Function, wait: number, immediate?: boolean): Function

| 参数 | 描述 | 类型 | 默认值 | 版本 | | --------- | ------------------------ | -------- | ------ | ---- | | func | 要进行防抖处理的函数 | Function | 无 | | | wait | 防抖延迟时间,单位ms | number | 无 | | | immediate | 第一次是否执行 【可选】 | number | false | |

示例:

html: 
	<input @onChange="changeDebounce" />
	
script:
	import { debounce } from '@hb_soft/core'
export default {
    data(){
        changeDebounce: debounce(this.getData,1000)
    },
    methods:{
    	getData(){}
    }
}
作用:输入的时候每输入一个字符就调取数据开销大。 防抖以后输入的时候每1秒才会请求一次

pubSub

描述:观察者 - 订阅者 设计模式

文件:util/common.util.ts

next()

描述:发射数据

 next(type: string, data: any):void

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | -------- | ------ | ------ | ---- | | type | 观察标志 | string | 无 | | | data | 发射数据 | any | 无 | |

subscribe()

描述:订阅某个事件的数据

subscribe(type: string, fn: Function): void

示例:

import { pubSub } from '@hb_soft/core';

//在某个地方
pubSub.subscribe('event1',data => { console.log(data) }) //订阅event1的数据。


//在另一个地方
pubSub.next('event1',123) //无论什么时候,这个地方的数据发射,订阅的地方都会观察到该数据改变

getDictionary()

描述:获取字典数据,不传参数获取所有字典,传key则获取该键对应的字典(枚举)

文件:utils/hb.util.ts

getDictionary = (key?: string): Array<object>|object

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ---- | -------------------------- | ------ | ------ | ---- | | key | 字典(枚举)的键 【可选】 | string | null | |

示例:

字典数据: {
	XBM:[
		{
            Id: "E768D6C4A203415EA1A602A9BB979158",
            Level: 1,
            NameC: "男",
            PId: "4E035811-37D8-41A3-BB2D-1F583097DA70",
            Value: "1"
    	},
    	{
            Id: "7FACA79564204F4AABA02F0B63D48948",
            Level: 1,
            NameC: "女",
            PId: "4E035811-37D8-41A3-BB2D-1F583097DA70",
            Value: "2"
    	}
    ],
    ...
}

import { getDictionary } from '@hb_soft/core';

getDictionary(); //返回所有的字典

getDictionary('XBM'); 
// [
		{
            Id: "E768D6C4A203415EA1A602A9BB979158",
            Level: 1,
            NameC: "男",
            PId: "4E035811-37D8-41A3-BB2D-1F583097DA70",
            Value: "1"
    	},
    	{
            Id: "7FACA79564204F4AABA02F0B63D48948",
            Level: 1,
            NameC: "女",
            PId: "4E035811-37D8-41A3-BB2D-1F583097DA70",
            Value: "2"
    	}
]

getDicName()

描述:查找字典的名称(一般用于渲染HTML)

文件:utils/hb.util.ts

getDicName(dicKey: string, value: string | number | boolean, dicValueKey?: string, nameKey?: string, emptyFormat?: string): string

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ----------- | ------------------------------------------------------------ | ----------------------- | ------ | ---- | | dicKey | 字典的key | | 无 | | | value | 当前的值 | string|number|boolean | 无 | | | dicValueKey | 查找字典dicKey的dicValueKey与当前值相等的项,如果字典不规范则可以根据需要传入其他值 【可选】 | string | Value | | | nameKey | 返回查找目标的nameKey,如字典不规范可根据需要传入其他值 【可选】 | string | NameC | | | emptyFormat | 如果没有查找到字典则返回该字符串 【可选】 | string | ------ | |

loadScript()

描述:加载script 通用方法

文件:utils/common.util.ts

loadScript(url: string, callback?: Function): Promise<any>

| 参数 | 描述 | 类型 | 默认值 | 版本 | | -------- | ----------------- | -------- | ------ | ---- | | url | js地址 | string | null | | | callback | 回调函数 【可选】 | function | null | |

obj2ParamUrl()

描述:对象转化为url的参数

文件:utils/common.util.ts

obj2ParamUrl(url: string, obj: Object, encode?: boolean): string

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ------ | --------------------- | ------- | ------ | ---- | | url | 原url地址 | string | 无 | | | obj | 要转参数的对象 | Object | 无 | | | encode | 是否进行编码 【可选】 | boolean | false | |

示例:

let param = {
	name: 'jay',
	age: '18'
}

let url1 = 'http://www.hb.com';
let url2 = 'htpp://www.hb.com?client=c';

import { obj2ParamUrl } from '@hb_soft/core';
obj2ParamUrl(url1,param); 
// http://www.hb.com?name=jay&age=18

obj2ParamUrl(url2,param); 
// http://www.hb.com?client=c&name=jay&age=18

paramUrl2Obj()

描述:url上的参数转化为对象

文件:utils/common.util.ts

paramUrl2Obj(url: string, decode?: boolean): object

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ------ | --------------------- | ------- | ------ | ---- | | url | 要获取对象的url地址 | string | | | | decode | 是否进行解码 【可选】 | boolean | false | |

示例:

let url = 'http://www.hb.com?client=c&name=jay&age=18'
import { paramUrl2Obj } from '@hb_soft/core';


paramUrl2Obj(url);
// { 
    client: 'c',
    name: 'jay',
    age: '18' 
}

RegExpUtil

描述:表单正则验证表达式集合

文件:utils/reg-exp.util.ts

| 参数 | 描述 | 版本 | | ---------- | ---------------- | ---- | | idcard | 身份证校验 | | | name | 姓名校验 | | | phone | 手机号校验 | | | postcode | 邮编校验 | | | schoolCode | 毕业学校代码校验 | | | tel | 固定电话校验 | |

接口(interface)

1.HBConfig

描述:项目启动配置

文件:hb-config.interface.ts

| 参数 | 描述 | 类型 | 默认值 | 版本 | | ------- | -------------------------- | ---------------- | ------ | ---- | | msg | 消息提示设置 | MessageInterface | 无 | | | notify | 消息提示设置 | NotifyInterface | 无 | | | loading | loading设置 | LoadingInterface | 无 | | | http | http设置 | RequestInterface | 无 | | | setting | 项目配置设置【可选】 | AppInfoInterface | 无 | | | local | localStorage配置【可选】 | Options | 无 | | | session | sessionStorage配置【可选】 | Options | 无 | |

2.MessageInterface

描述:msg消息提示配置

文件:message/message.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | --------- | -------------------------------------- | ----------------------------------------- | ---- | ---- | | namespace | vue.namespace、this.$namespace【可选】 | string | 无 | | | duration | 消息持续时间【可选】 | number | 无 | | | info | 普通消息 | function(content:string,duration?:number) | 无 | | | success | 成功消息 | function(content:string,duration?:number) | 无 | | | warning | 警告消息 | function(content:string,duration?:number) | 无 | | | error | 错误消息 | function(content:string,duration?:number) | 无 | |

3.NotifyInterface

描述:notify消息提示配置

文件:message/message.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | --------- | -------------------------------------- | ----------------------------------------- | ---- | ---- | | namespace | vue.namespace、this.$namespace【可选】 | string | 无 | | | duration | 消息持续时间【可选】 | number | 无 | | | title | 提示的标题【可选】 | string | 无 | | | info | 普通消息 | function(content:string,duration?:number) | 无 | | | success | 成功消息 | function(content:string,duration?:number) | 无 | | | warning | 警告消息 | function(content:string,duration?:number) | 无 | | | error | 错误消息 | function(content:string,duration?:number) | 无 | |

4.LoadingInterface

描述:请求loading的配置

文件:message/message.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | --------- | -------------------------------------- | ---------- | ---- | ---- | | namespace | vue.namespace、this.$namespace【可选】 | string | 无 | | | start | loading开始 | function() | 无 | | | end | loading结束 | function() | 无 | |

5.HttpOptions

描述:http请求参数配置项

文件:http/http.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | ------------------ | ------------------------------------------------------------ | ------------------ | ------------- | ---- | | AxiosRequestConfig | axios的http配置项【可选】 | AxiosRequestConfig | axios的默认值 | | | handleError | 是否需要错误处理【可选】 | boolean | true | | | loadingDisabled | 是否禁用请求loading【可选】 | boolean | false | | | async | 是否支持同步【可选】 | boolean | false | | | isNotHB | 是否不是环博的http接口,如果是环博的接口返回res.data.Data的结果,否则返回res.data【可选】 | boolean | false | | | fieldConfig | 数据初始化配置 FieldConfig 【可选】 | FieldConfig | 无 | | | fieldMatchDeep | 是否深层次匹配,当fieldConfig配置时生效 【可选】 | boolean | false | |

6.FieldConfig

描述:数据初始化配置,默认是初始化字典,可初始化其他数据

文件:http/http.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | ------------- | ------------------ | ------ | ----------------- | ---- | | [key: string] | 任何字段都能初始化 | string | CustomFieldConfig | |

7.CustomFieldConfig

描述:自定义字段配置,支持字典、自定义数组、布尔值

文件:http/http.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | ---------- | ------------------------------------------------------------ | --------------------- | ---- | ---- | | fieldAlias | 初始化数据后的别名 【可选】,默认 为下划线 _ | string | _ | | | type | 数据初始化类型 | dic|columns|boolean | dic | | | source | 当type=dic时,source是字典的key; 当type=columns时,source是数组; 当type=boolean时,source为valueKey不匹配时取值,默认是 “否”。 | string | Array | 无 | | | nameKey | 当type=dic时,nameKey是字典的字段,默认NameC;当type=columns时,nameKey是数组的字段,默认Name; 当type=boolean时,nameKey为判断值,如果为真取valueKey的值,为假取source的值 | string | 无 | | | valueKey | 当type=dic时,valueKey是字典取值的字段,默认是Value; 当type=columns时,valueKey是数组取值的字段,默认是Value; 当type=boolean时,valueKey是布尔值的字段匹配时的取值,默认是 “是”。 | string | 无 | |

8.RequestInterface

描述:环博http请求配置

文件:http/http.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | --------------- | ------------------------------------------------- | --------------- | ----- | ---- | | namespace | Vue.namespace、this.$namespace【可选】 | string | http | | | userModelConfig | 存储userModel的配置,位置为sessionStorage【可选】 | UserModelConfig | 无 | | | loadingDisabled | 全局配置,是否禁用请求loading【可选】 | boolean | false | |

9.ApiOptions

描述:API配置

文件:http/http.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | ------- | -------------------------------------------- | ------- | ----- | ---- | | api | 后端api地址 | string | 无 | | | gateway | 网关配置项 【可选】 | string | 无 | | | method | get|post|delete|put|patch|head 【可选】 | string | get | | | full | 是否是完整 地址【可选】 | boolean | false | |

10.UserModelConfig

描述:存储userModel的配置

文件:http/http.interface.ts

| 参数 | 描述 | 类型 | 默认 | 版本 | | ----------- | ----------------------------------- | ------ | ------- | ---- | | key | 储存userModel的key | string | 无 | | | storageType | userModel存储方式:local | session | string | session | |

开发(贡献)

1.每次修改任何东西需要升级版本

npm version patch   //修改bug  1.0.0 -> 1.0.1
 
npm version  minor  //功能增加、变更 1.0.0 -> 1.1.0

npm version major   //架构更改,不兼容之前版本  1.0.0 -> 2.0.0

2.修改 所有的API 文档,变更或者新增的地方填入对应的版本

3.修改CHANGELOG.md 变更记录

4.打包命令:

//编译开发的包到项目下,需要修改gulpfile.js文件中的devPath,开发项目路径。
npm run dev


//编译正式包
npm run deploy 


//手动发布
cd deployment 
npm publish --access public