<template>
  <div>InfoDetailed</div>
</template>
<script>
export default {
  name: "InfoDetailed",
  props: {
    treeData: {
      type: Array,
      required: true
    }
  },
  data() {
    return {};
  },
  methods: {
    handleRemoveConfirm(row) {
      deleteCategory({ categoryId: row.id })
        .then(data => {
          this.$message.success(data.message);
          // 方法1:数组同基本数据类型看待,要显式通知(update)父组件sync
          // const res= this.treeData.filter(e => e.id !== row.id);
          // this.$emit("update:treeData", res);

          //方法2:实现删除数组里面特定的项,父组件的值同时被修改(不用通知父组件)
          let index = this.treeData.findIndex(e => e.id === row.id);
          this.treeData.splice(index, 1);
        })
        .catch(err => console.log(err));
    }
  }
};
</script>
<style lang="scss" scoped></style>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
猜你喜欢
  • 2021-07-31
  • 2021-05-20
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
相关资源
相似解决方案