var jsonobj=eval('('+t+')');

 

使用eval 函数,讲后台json字符串转换为前台jsarray数组。

 

 无法转换json问题 Error: Model.nodeDataArray value is not an instance of Array or NodeList or HTMLCollection

 

无法转换json问题 Error: Model.nodeDataArray value is not an instance of Array or NodeList or HTMLCollection

 

如果使用 ajax不会出现这种情况,因为会自动转换。

但是如果直接从后台传值,比如说 使用thymeleaf模板引擎,中的 [[${value}]] 表达式获取值,则不会自动转换为array类型,需要使用eval函数进行转换。

 

相关文章:

  • 2021-10-27
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-21
  • 2021-09-07
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案