1.0.0 • Published 4 years ago
@bbb324/tools v1.0.0
使用说明
安装方法
npm i bbb324-tools --save
引入说明
工具组目前包含以下几个方法,throttle, debounce, slice 引入方式为
import { throttle, debounce, slice, getUrlParams } from 'bbb324-tools';
使用说明
throttle, debounce 默认delay 200ms
<button type="primary" onClick={throttle(fn, delay)}>Button</button>
<button type="primary" onClick={debounce(fn, delay)}>Button</button>
实例
render() {
return <button type="primary" onClick={throttle(this.dosth.bind(this, 'ts'), 1000)}>Button</button>
}
slice 函数说明
a = slice(['a','b','c','d'], ['b'])
// a = ['a','c','d']
getUrlParams 函数说明
let a = 'https://xiejun325.yst.htm?isReadOnly=yes';
getUrlParams().isReadOnly === 'yes' // return true;
1.0.0
4 years ago