Is vue hungry? is it invalid to add tree table nodes?

it"s not easy to make better use of the components, resulting in a lot of problems!

<!--  -->
              <el-button
                icon="el-icon-plus"
                circle
                :size="iconSize"
                type="success"
                @click="NodeAdd(node, data)"
              ></el-button>

this is the html added to the node

NodeAdd(n, d) {
      //
      console.log(n, d);
      //
      if (n.level >= 3) {
        this.$message.error("");
        return false;
      }
      //
      d.list.push({
        id: PPthis.maxexpandId,
        name: "",
        pid: d.id,
        list: []
      });
      //
      if (!n.expanded) {
        n.expanded = true;
      }
    }

this is a way to add nodes. Others are fine for top-level nodes, but an error is reported when adding to secondary nodes

clipboard.png
I don"t know what went wrong. I"m tired!

May.06,2022

look at the d.list you printed out is an object, not an array, and the object does not have a push method, so an error has been reported!


NodeAdd(n, d) {
      //
      console.log(n, d);
      //
      if (n.level > 3) {
        this.$message.error("");
      }else{
          //listd.listundefined,push
          if (!d.list) {
            this.$set(d, 'list', []);
          }
          //
          d.list.push({
            id: PPthis.maxexpandId,
            name: "",
            pid: d.id,
            list: []
          });
          //
          if (!n.expanded) {
            n.expanded = true;
          }
      }
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c1f1f1-15984.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c1f1f1-15984.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?