taro-rn-clear-cache
v1.3.1
Published
```jsx import clear from 'taro-rn-clear-cache';
Downloads
2
Readme
用法
import clear from 'taro-rn-clear-cache';
constructor () {
super();
this.state = {
cacheSize:"",
unit:"",
}
clear.getCacheSize((value,unit)=>{
this.setState({
cacheSize:value, //缓存大小
unit:unit //缓存单位
})
});
}
render() {
return (
<View style={{flex: 1,justifyContent: 'center',alignItems: 'center'}}>
<Text style={{fontSize: 20,textAlign: 'center',margin: 10}}>
缓存大小{this.state.cacheSize}{this.state.unit}
</Text>
<Button title="清除缓存" onPress={this.clearCache.bind(this)}/>
</View>
);
}
clearCache(){
clear.runClearCache(()=>{
console.log("清除成功");
clear.getCacheSize((value,unit)=>{
this.setState({
cacheSize:value, //缓存大小
unit:unit //缓存单位
})
});
});
}