在html-loader文档中有这个例子
require("html?interpolate=require!./file.ftl");
<#list list as list>
<a href="${list.href!}" />${list.name}</a>
</#list>
<img src="${require(`./images/gallery.png`)}">
<div>${require('./components/gallery.html')}</div>
Run Code Online (Sandbox Code Playgroud)
"名单"来自哪里?如何为插值范围提供参数?
我想做像template-string-loader那样的事情:
var template = require("html?interpolate!./file.html")({data: '123'});
Run Code Online (Sandbox Code Playgroud)
然后在file.html中
<div>${scope.data}</div>
Run Code Online (Sandbox Code Playgroud)
但它不起作用.我试图将模板字符串加载器与html-loader混合,但它不起作用.我只能使用template-string-loader,但HTML中的图像不会被webpack转换.
有任何想法吗?谢谢