实例方法this.$delete的使用

this.$delete方法是用来删除对象属性的。

语法:

this.$delete(obj,key);

例子:

<template>
<div>
     {{testData.name}}
     <button @click="del">删除</button>
</div>
</template>
<script>
export default {
  name: "Home",
  data () {
    return {
        testData:{
            name:"zs"
        }
    };
  },
  methods:{
      del(){
          this.$delete(this.testData,"name")
      }
  }
}
</script>
原文地址:https://www.cnblogs.com/luguankun/p/10872968.html