1

I'm harp js user and im curious if its possible to call another parital to the harp js parameter?

I would like to proceed with modularization to reuse the code.
It is difficult to use the parital function of harp to insert data into a module of a particular module into another module.

This is my sources:

//component/button.ejs
<button><%= lable %></button>

//component/tab.ejs
<div class="tab">
    <div class="tab__nav">
        <% for(var i in locals.payload){ %>
            <div class="tab__nav-item"><%- locals.payload[i].name %></div>
        <% }; %>
    </div>
    <div class="tab__content">        
        <% for(var i in locals.payload){ %>            
            <div class="tab__content-item">
                <div class="container">
                    <%- locals.payload[i].content %>
                </div>
            </div>
        <% }; %>
    </div>
</div>

//page.ejs
<%- partial("component/tab",{
  payload: [
    {
        name:'tab1',
         content:`
            <div><%= partial("component/button.ejs",{label:"btn"})%></div>
         `
    },
    {
        name:'tab2',
        content: `
            <div>111111</div>
        `
    }
 ]}) %>
evan
  • 23
  • 4

0 Answers0