Taro.removeStorageSync(key)
The synchronous version of Taro.removeStorage
.
Type
{ (key: string): void; (key: string): void; }
Parameters
Property | Type | Description |
---|---|---|
key | string | The specified key in the local cache |
Sample Code
Example 1
try {
Taro.removeStorageSync('key')
} catch (e) {
// Do something when catch error
}
Example 2
Taro.removeStorage({
key: 'key',
success: function (res) {
console.log(res)
}
})
try {
Taro.removeStorageSync('key')
} catch (e) {
// Do something when catch error
}
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.removeStorageSync | ✔️ | ✔️ |