简体   繁体   English

如何将数据传递到 ejs 模板中?

[英]How to pass data into ejs templates?


I have the following `html` snippet and I can see that it's using `ejs` and potentially some other templating engines. 我有以下 `html` 片段,我可以看到它正在使用 `ejs` 和可能的其他一些模板引擎。
 <div class="swiper-slide slide7"> <img src="~-IMAGE/img_1200x653_eBanking_03.7.png" class="d-none d-md-block d-lg-block d-sm-none" srcset="${require('-IMAGE/img_1200x653_eBanking_03.7.png')}" alt=""> <div class="text-group-right"> <h2 class="slide-title">${__('ebanking.dss.content.step.7.title')}</h2> <p class="slide-desc">${__('ebanking.dss.content.step.7.descriptions')}</p> </div> </div>

I am not that familiar with ejs but am wondering if there's a way I can pass data, like the with template literals as seen in the example snippet/ image source, etc., as seen in the example, into snippets like these so it can save a lot of hassles.我对ejs不太熟悉,但想知道是否有一种方法可以将数据(如示例代码段/图像源中看到的模板文字等)传递到这样的代码段中,这样它就可以省去很多麻烦。

are you passing data from the backend, if so it is nodeJs?您是否从后端传递数据,如果是的话,它是 nodeJs 吗? If it is, typically you have to set the value of the data you want to pass in the function from the backend, and then pass it through when rendering the page.如果是的话,一般你要在后台的function中设置你要传的数据的值,然后在渲染页面的时候传过去。 if this is the case, I can explain more on how to do so如果是这种情况,我可以详细解释如何操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM