ttk-app-core
Version:
@ttk/recat enterprise develop framework
37 lines (32 loc) • 1.04 kB
JavaScript
import ReactDom from 'react-dom';
// @ttk/utils统一为name export
import * as ttkUtils from '@ttk/utils';
import {
Toast,
Message
} from '@ttk/component'
// 增加初始化函数,将antd组件、ReactDom作为参数,减少ttk-utils对上述包的依赖
ttkUtils.form.init(Message);
ttkUtils.dom.init(ReactDom)
ttkUtils.fetchCors.init(Toast);
ttkUtils.fetch.init(Message);
export default ttkUtils;
export * from '@ttk/utils'
export const form = ttkUtils.form;
export const dom = ttkUtils.dom;
export const fetchCors = ttkUtils.fetchCors;
export const fetch = ttkUtils.fetch;
export function isNotEmpty(value) {
return value !== null && value !== undefined && value !== ""
}
export function transformSlv({zzssl, yhzclx}) {
return zzssl == '0' && (yhzclx == '不征税' || yhzclx == '免税') ? yhzclx : zzssl * 100 + '%'
}
// 字节转换
export function byteLength(value) {
if(["function", "object"].includes(typeof value)) {
return 0
}
value = value + ""
return value.replace(/[^\x00-\xff]/g, "**").length;
}