problem description
in an arttemplate template engine and node-built project, there is a piece of code that, after getting the data in an ajax asynchronous callback, populates the template and renders it into html, but here
a.html
const testHtml = require("@templates/test");
if(res.code === 1) {
$("-sharpbox").html(testHtml(res));
}
I don"t understand very well, in which the test.html template file code is as follows
test.html
<ul class="main-person clear">
{{each object as v i}}
<li class="{{(i%4 == 3 && i != 0) ? "mr-list0 clear": "clear"}}">
<div class="img-box" data-word="{{v.memberName}}">
<img src="" width="60" height="60"/>
</div>
<div class="info">
<span title="v.memberName">{{v.memberName || ""}}</span>
</div>
</li>
{{/each}}
</ul>
$("- sharpbox") .html (testHtml (res));
Why can testHtml take res as a parameter when rendering the template after the require template file is entered? does arttemplate have this use?