模块: storage

window.localStorage 的 get 和 set



del(key)

通过键(key)删除

Parameters:
Name Type Description
key string
Example
$api.storage.set('a',JSON.stringify({a:1}))
JSON.parse($api.storage.get('a'))
$api.storage.del('a')


get(key)

通过键(key)检索获取应用存储的值

Parameters:
Name Type Description
key string
Returns:
Type:
string
Example
$api.storage.set('a',JSON.stringify({a:1}))
JSON.parse($api.storage.get('a'))


set(key, value)

修改或添加键值(key-value)对数据到应用数据存储中

Parameters:
Name Type Description
key string
value string
Example
$api.storage.set('a',JSON.stringify({a:1}))