Layui call interface use experience

Today I want to use Layui to write a simple list display page. I haven’t used Layui for a long time, so I went to see Layui’s documentation and copied the code of the documentation, but encountered problems during use.

.Issue 1: Thymelea inline style problem

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/assistance

This is the page's error, then specifically

 Later, Baidu found out that the inline style of thymelea needs to add an attribute

<script th:inline=none>
        layui.use('table', function(){
                var table = layui.table;

2. Regarding interface data exceptions

After the backend writes the interface, an exception occurs after the frontend calls the interface

I use String to transfer data. The data data uses a method to splicing into JSON object form, and the data is encrypted with escape. There have been problems when the front end receives the data. Later, I specifically asked the students at the front end to tell me the problem of using unescape. solved

    for(let i in data[0].data){
                    for (let j in data[0].data[i]){
                        data[0].data[i][j]=unescape(data[0].data[i][j])
                        count =count+1
                    }

                }

Guess you like

Origin blog.csdn.net/weixin_47035997/article/details/126111065