The problem of require entering a template file with parameters in arttemplate

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?


Why can testHtml take res as a parameter when rendering the template after the require template file is entered? does arttemplate have this use?

because require can be a method, depending on what your module exports.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c403-2c328.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c403-2c328.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?