参考 removeItem()

removeItem()

Removes an item from the web browser's local storage.

Web browsers can save small amounts of data using the built-in localStorage object. Data stored in localStorage can be retrieved at any point, even after refreshing a page or restarting the browser. Data are stored as key-value pairs.

storeItem() makes it easy to store values in localStorage and removeItem() makes it easy to delete them.

The parameter, key, is the name of the value to remove as a string. For example, calling removeItem('size') removes the item with the key size.

Note: Sensitive data such as passwords or personal information shouldn't be stored in localStorage.

示例

语法

removeItem(key)

参数

key

name of the value to remove.

Notice any errors or typos? Please let us know. Please feel free to edit src/data/local_storage.js and open a pull request!

相关参考