Use split pit encountered

报错:Uncaught TypeError: Cannot read property ‘split’ of undefined
at HTMLLIElement.

 

This is clearly split (cut problem), and finally by analyzing learned, for the first time will get a null value.

Solution: Use split () when adding a judgment (judgment is to cut the string is not present), and then successfully resolved the problem.

  if (data.name) {
          this.chooselist=data.name.split(",");
        }

Guess you like

Origin www.cnblogs.com/weijiahao/p/12036156.html