Leetcode icon indicating copy to clipboard operation
Leetcode copied to clipboard

44. 会话存储上可用的方法有哪些

Open webVueBlog opened this issue 3 years ago • 0 comments

会话存储提供了读取、写入和清除会话数据的方法

// Save data to sessionStorage
sessionStorage.setItem("key", "value");

// Get saved data from sessionStorage
let data = sessionStorage.getItem("key");

// Remove saved data from sessionStorage
sessionStorage.removeItem("key");

// Remove all saved data from sessionStorage
sessionStorage.clear();

webVueBlog avatar Jun 09 '22 02:06 webVueBlog