ReferenceError: Can't find varia

2020-04-30  本文已影响0人  潼潼夏
<div class="layui-input-block" style="width:200px" >
                    <select name="goodsTypeId" lay-filter="parentTypes"  >
                        <option value="0" th:each="t:${types1}" th:value="${t.goodsTypeId}" th:text="${t.typeName}">写作</option>

                    </select>
  </div>

<script>
form.on('select(parentTypes)', function(data){
                 let pid = data.value;
                 console.log(pid);
                 let types = [[${types1}]];
                 console.log(types);
            });
</script>

其中后台传过来的${types1}为List<GoodsTypeVO>
前端报错:ReferenceError: Can't find variable: GoodsTypeVO

已解决:
加上th:inline='javascript'

<script th:inline='javascript'  type="text/javascript">
form.on('select(parentTypes)', function(data){
                 let pid = data.value;
                 console.log(pid);
                 let types = [[${types1}]];
                 console.log(types);
            });
</script>

问题即解决。

上一篇下一篇

猜你喜欢

热点阅读