Get the App
SLTechnology News&Howtos  ›  Development  › 

What's the difference between delete and Vue.delete deleting arrays?

Shulou Source: shulou.com Published: 2022-06-01 12:07:27 10月16日 Update

Today Xiaobian to share with you what is the difference between delete and Vue.delete delete array of relevant knowledge, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you will learn something after reading this article, let's take a look at it.

Delete is just that the deleted element becomes the key value of other empty/undefined elements or remains the same.

Vue.delete deletes the array directly and changes the key value of the array.

Next, let's look at an example.

The difference between delete and Vue.delete deleting arrays

Amuri-{{item}}

Deal with array a

BMMI-{{item}}

Processing b array

Export default {

Name: "vueDelete"

Data () {

Return {

A: [1,2,3,4]

B: [1,2,3,4]

}

}

Methods: {

HandleA () {

Delete this.a [1]

This.$set (this.a)

Console.log (this.a)

}

HandleB () {

This.$delete (this.b, 1)

Console.log (this.b)

}

}

}

These are all the contents of the article "what's the difference between delete and Vue.delete deleting arrays". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Arrays knowledge articles elements content processing different big next examples just most more knowledge points industry information information channels or logic. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Linux macOS Microsoft OPPO Reno