Vue error: Error in render: “TypeError: Cannot read properties of null (reading ‘xxx’)” found in

created at 10-19-2021 views: 45

Front-end vue error [Vue warn]: Error in render: "TypeError: Cannot read properties of null (reading'name')" found in ****** Type error when receiving return value, scroll down

vue error

This error is that the type whose attribute is null cannot be loaded. I used a stupid way to mark all the null values on the page with ctrl+f and then modify them to 0 (0 is convenient for writing points), and then I found that the error on the current page is not Change, and finally I located the error and in the subcomponent I called, I called a pop-up window

 pop-up window code

When I delete this reference, it doesn’t report an error, which means that there is an error when I quote
I used a dumb way to locate, and changed the value of all null attributes to have values. At this time, my error message has changed
Finally, I located the attribute I received changed from nulll to [], which is also the problem caused by my sloppy

// change
current:null,
// to
current:[],

There is also a Type error when the return value of the access interface is received.

export default {
   data() {
     return {
       tableData: null,
    },

   methods: {
     search() {this.axios.post("/api/xxx/xxx", this.filter).then((res) => {
           this.tableData = res.data;//Generally speaking, the return value is wrong here

       });
     },

For example, when using

<el-button-group class="pull-right">
            <el-button
              size="medium"
              type="primary"
              @click="gotoAdd(tableData.length)"
              >xx</el-button
            >

An error will be reported at this time. When res.data is empty, this.tableData is equal to null. At this time, you will report an error when you do anything to TableData. Please pay attention to this little detail.

methods: {
     search() {this.axios.post("/api/xxx/xxx", this.filter).then((res) => {
             if(res.data!=null){//Generally speaking, the return value is wrong here
               this.tableData = res.data;
                }
           });
       },

Don't let him assign it in

Hope it helps you

created at:10-19-2021
edited at: 10-19-2021: