
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
npm i xrk-tools-test
import xkrTools from 'xrk-tool-test'
借助 babel-plugin-component
首先,安装 babel-plugin-component
npm i babel-plugin-component -D
然后,修改.babelrc 或者 babel.config.js
{
"plugins": [
[
"component",
{ libraryName: "xrk-tools-test", style: false },
"xrk-tools-test",
],
]
}
最后,只需在项目中引入需要部分
import { file } from 'xrk-tool-test'
base
格式化数值
numberFormat(
num: Number | String,
divisor?: Number,
decimalPlaces?: Number,
unit?: String
): String;
简易深克隆(无法克隆 Function Map Set undefined)
easyDeepClone(content: any): any;
深克隆
deepClone(content: any): any;
创建冻结对象
craeteFreezeObject(
value: Object | Array | Set | Map
): ProxyConstructor;
check
判断是否为数字 (数字字符串也是数字,例如'23'、'123.213')
isNumber(num: Number | String): Boolean;
判断是否为手机号
isTel(num: Number | String): Boolean;
判断是否有值,但是值为 false
isFalseValue(value: any): Boolean;
判断是否为函数
isFunction(params: any): Boolean;
判断是否为时间对象
isDate(params: any): Boolean;
判断是否为 Object 对象
isObject(params: any): Boolean;
判断是否为 Map 断是否为 Set
isMap(params: any): Boolean;
判断是否为字符串
isString(params: any): Boolean;
判断是否为 Boolean
isBoolean(params: any): Boolean;
date
格式化时间
dateFormat(
date: Number | String | Date,
fmt?: String,
autoFillZero?: Boolean
): String;
file
base64 转为 Blob
dataURLToBlob(base64: String): Blob;
Blob 转为 base64g;将 img 标签转为 base64
blobToDataURI(blob: Blob): Promise<String>;
将 img 网络资源转为 base64
imgUrl2Base64(imgUrl: String): Promise<String>;
获取网络资源文件
getNetFile(
url: String,
responseType?: "blob"
): Promise<Blob>;
将内容转为二维码图片
contentToQrcodeUrl(content: any): Promise\<String>;
money
将分格式化为元,保留两位小数
moneyFixed(
num: Number | String,
decimalPlaces?: Number,
unit?: String
): String;
将元格式化为分,主要用于向服务端传递参数时使用
moneyComplete(num: Number | String): Number;
给 c 端计算税率
afterTaxPrice(num: Number | String): Number;
storage
本地数据存储
setStorage(
key: String,
value: any,
isLocal?: Boolean
): void;
读取本地存储的数据
getStorage(
key: String,
isLocal?: Boolean
): String;
transform
将字符串指定位置替换为指定字符
hideSomeString(
str: Number | String,
start?: Number,
end?: Number,
replaceStr?: String
): String;
config
问卷&可配置场景 题目配置
CONFIG_QUESTION: Array<{
label: number | string;
value: number | string;
}>;
项目类型
CONFIG_PROJECT: Array<{
label: number | string;
value: number | string;
}>;
业务结构
CONFIG_BUSINESS:Array<{
id: number;
name: string;
children: Array<{
id: number;
name: string;
hasIndustry?: boolean; // 是否有工业方
hasEnterprise?: boolean; // 是否有服务商
hasSupplier?: boolean; //是否有供应商
hasPerson?: boolean; // 是否有自然人
hasIndividual?: boolean; // 是否有个体
}>;
}>;
业务结构
CONFIG_BACKGROUND:Array<{
label: number | string;
value: number | string;
}>;
职责名称
CONFIG_DUTY_NAME: Array<{
label: number | string;
value: number | string;
}>;
税筹结构
CONFIG_TAX_STRUCTURE: Array<{
id: number;
name: string;
children: Array<{
id: number;
name: string;
hasIndustry?: boolean; // 是否有工业方
hasEnterprise?: boolean; // 是否有服务商
hasSupplier?: boolean; //是否有供应商
hasPerson?: boolean; // 是否有自然人
hasIndividual?: boolean; // 是否有个体
}>;
}>;
FAQs
A Component Library for Vue.js.
The npm package xrk-tools receives a total of 21 weekly downloads. As such, xrk-tools popularity was classified as not popular.
We found that xrk-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.