- swan.removeStorageSync
- 方法参数
- key 参数说明
- 示例
- 图片示例
- 代码示例
- Bug & Tip
- 错误码
- Android
- iOS
- 方法参数
swan.removeStorageSync
解释:从本地缓存中同步移除指定 key 。
方法参数
String key
key 参数说明
本地缓存中的指定的 key
示例
跳转编辑工具
在开发者工具中打开
在 WEB IDE 中打开
扫码体验
代码示例
请使用百度APP扫码
图片示例
代码示例
- SWAN
- JS
<view class="wrap"><view class="card-area"><view class="list-area border-bottom"><label class="list-item-key-4">key</label><input class="list-item-value" bindfocus="keyFocus" bindinput="keyInput" type="text" value="{{key}}" placeholder="请输入key" /></view><view class="list-area border-bottom"><label class="list-item-key-4">value</label><input class="list-item-value" bindfocus="valueFocus" bindinput="valueInput" type="text" value="{{value}}" placeholder="请输入value" /></view><view><button bindtap="setStorage" type="primary" hover-stop-propagation="true">存储数据</button><button bindtap="getStorage" type="primary" hover-stop-propagation="true" disabled="{{disabled}}">读取数据</button><button bindtap="getStorageInfo" type="primary" disabled="{{disabled}}">获取存储数据信息</button><button bindtap="removeStorageSync" type="primary" hover-stop-propagation="true" disabled="{{disabled}}">移除第一个key对应的value值</button></view></view></view>
Bug & Tip
- Tip:基础库 3.140.1 之前,无法判断接口是否调用失败。
- Tip:基础库 3.140.1 及以后,接口调用失败时会返回一个标准的
Error对象,可通过instanceof来判断接口是否调用失败。
错误码
Android
| 错误码 | 说明 |
|---|---|
|
201 |
解析失败,请检查调起协议是否合法 |
|
1001 |
执行失败 |
iOS
| 错误码 | 说明 |
|---|---|
|
202 |
解析失败,请检查参数是否正确 |


![晴川云Minecraft Wiki教程:初始资源[ ],晴川云](https://baike.qcidc.com/wp-content/uploads/2025/09/20250919082215182-u_2837843575_1454814601fm_253fmt_autoapp_138f_JPEG.jpeg)







暂无评论内容