1. I have a list, and when I swipe to delete it, I get the index, and call localStorage.removeItem (index).. The data in the cache cannot be deleted. Is there something wrong with my writing? I"m going to delete the option to 1 now. What do I do?
1. I have a list, and when I swipe to delete it, I get the index, and call localStorage.removeItem (index).. The data in the cache cannot be deleted. Is there something wrong with my writing? I"m going to delete the option to 1 now. What do I do?
localStorage is a key-value pair
list
is its key
if you want to delete list, removeItem ('list')
delete the data inside getItem ('list')
get the array and then set it
function f(i){
let list = localStorage.getItem('list');
list.splice(i, 1);
localStorage.setItem('list', list);
}
upstairs is basically correct, but localStorage can only store strings. A small change based on him
function f(i){
var list = JSON.parse(localStorage.getItem('list'));
list.splice(i, 1);
localStorage.setItem('list', JSON.stringify(list));
}
Previous: If webpack3 uses url-loader and does not install file-loader, it will report an error.
Next: How does vue get the image path under the array and render it to the page?
description: a regular match is given to the content of an input box, and the matching content is the product activation code. looks like this: "0C31-0B81-BB32-3094-0C31-0B81-BB32-3094 " Code: $( -sharplicenseCode ).keyup(function () { le...
do the gods have plug-ins for uploading attachments in the mobile version that can also be uploaded more than one? ...
wrote an H5 page. According to the official description of Wechat jssdk, it is found that the shared icons and descriptions are invalid. the code is like this ....
what is the current level of support for vw,vh layouts in mobile browsers? ...
...
this method is included in the constructor of most components, so what exactly is this method for constructor(props,context){ super(props,context) } ...
adopt a reward of 10 yuan, 1045 Access denied for user root @ localhost (using password:NO) recently, when I was at the front end of my self-study, I came into contact with a little bit of database. This happened when I made a new connection on ...
as shown in the red box of the second picture, is there any recommendation for this plug-in? Thank you. the screenshot is uploaded, so let s just look at it. nothing can be found in vueawesome. ...
http: shrek.imdevsh.com demo. ask for help: the principle of inertia retardation effect in demo touchmove ...
want to explain how to make table different colors? is not different. is . <table> <tr> <td width="100">a< td> <td><a>< td> < tr> <tr> ...
I ve been looking for it for a long time, but I can t find it. 1. After the direct upload of web is completed, the server cannot know whether the file was uploaded successfully, who uploaded it, and the information of the file 2. Using web to dire...
is not to analyze user browsers, but to evoke Wechat app in Weibo app and open a link with Wechat app; WeChat Work can have this function, whether Weibo has a similar configuration. ...
A picture grows slowly when it slides up to a certain extent. Why does it bring out a line that has been entangled all night? I can t find the reason. ...
write a line chart with native JS, right-angled ones can be written, but now you need to change into a smooth curve, similar to: the inflection point is still at a right angle, is there any god who can provide the next solution ...
in Wechat browser, it is required and only required to be compatible with iOS8+ and Android4.4+ existing icon is bound with click event fullScreen . After clicking this button, the video vdo of inline can be full screen: . const fullScreen = e =&g...
for example, I request localhost:8080 a b c.cd proxy to http: www.aaaa.com api can you change a b c.cd to a b c , before proxy? means that the agent rewrites the original path before. ...
question 1. The project is a chat application, which needs to display the latest news in the chat window in real time. Using the scrollIntoView method id div for bottom, I want to put it at the bottom. As long as it can be displayed, other chat message...
var myNumber = { value: 1, add: function(i){ var helper = function(i){ console.log(this); this.value += i; } helper(i); } } myNumber.add(1); Why does this this point to window?? The add method called by the myNumber o...
<template> <div style="height: 100%;"> <mt-header title=""> <mt-button icon="back" slot="left" v-tap="{methods: switchView, view: Post }">< mt-button> &l...
Click the button to show that (Bing s daily wallpaper) is successful, and then when the background of the page changes, it takes time to render, and there will be a white background color. How to solve this? ...