how to achieve the rise and fall of values in asynchronously acquired data like this in vue-cli?
there are actually some differences in requirements before and after this change.
there is no discussion about the second requirement. Assuming that the subject of the question is the first, I will solve it like this:
after requesting new list data, don't rush to bind data, to compare the existing data with the existing data, tie the comparison result to the new data, and then update it to data.
-Separator-
for multi-layer nesting, it is also necessary to traverse and compare.
to understand that you need to rise or fall, you need data to reflect, so you can only traverse and compare with the last data.
function diff(arr1, arr2) {
return arr1.map((item, i) => Object.assign(item, {up: item.a < arr2[i].a}))
}
diff([{a: 1.2}, {a: 2.8}, {a: 3}], [{a: 1.5}, {a: 2}, {a: 2}])
A simple diff will do, return a up of Boolean type, and then set the corresponding rise and fall icon
Previous: The input field generated by < FormItem / > declared by antd inside componentDidMount is invalid.
developers need to use signatures on computers. I introduced jsignature into vue. I have registered jquery globally in vue, but keep reporting errors jq },jqjsignature while running. ...
A sudden problem with vue-cli scaffolding today after npm run dev, there was a problem, and the final result was also successful, but the page could not be opened at all excuse me, what is the reason for this? has anyone encountered it ...
I fetched the package in main.js. Why can t other vue components call the methods directly? ...
for example, our interface is http: 118.31.112.11 levy log.. $post( levy login index ,this.ruleForm) 500 ...
as shown in the picture, I got the information of this picture, but I don t have the address of the picture. Could you tell me how to display this picture in an img tag = resolved = this.file1Img = window.URL.createObjectURL(file) ...
problem description recently attempted to update project scaffolding from vue-cli2 webpack2 to vue cli 3 webpack4 vue-cli-service serve indexlogin, window.location.href = login loginindex.htmlindex.js url localhost:3007 login.htmlurllocalhos...
I found it amazing when I installed vue-cli3, and started vue ui on two computers. One computer is in Chinese and the other is in English. I want to change the English version into Chinese, but I find that there is no relevant configuration. Where shoul...
when I use the vue-cli command sudo vue create hello-world to create a new project, the following error occurs as long as I check the babel or eslint options in the configuration. [fsevents] Success: " Users tanghaoyi work VueSingle hell...
in which folder should I put the json file to get it? Put it under assets. I tried the browser and didn t seem to get it . ...
recently, when upgrading the vue-cli3.0 package, I found that css has many more files than before. After looking closely, I found that each .vue file has been packaged with a css, and as long as there is a style tag in the .vue file, even if there is no...
there is a project that I need to introduce the viz.js file in order to implement a function. so I put viz.js in the static directory, and then introduce it through the script tag in index.html . let head = document.getElementsByTagName( head ...
problem description borrow a project written by the iview-admin framework. At first, it was a single page, but now the reason for the demand needs to be changed to a multi-page form. The previous set of routes, which reported memory overflow errors, c...
<cube-upload ref="upload" v-model="files" :action="action" fileName="uploadfile" :headers="header" @file-error="errHandler" file-success="successHandler" > <div class="cle...
can the port number on which vue-cli is running be removed ...