美文网首页
ReferenceError: Can't find varia

ReferenceError: Can't find varia

作者: 潼潼夏 | 来源:发表于2020-04-30 00:36 被阅读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>
    

    问题即解决。

    相关文章

      网友评论

          本文标题:ReferenceError: Can't find varia

          本文链接:https://www.haomeiwen.com/subject/kfhawhtx.html