从其他文件使用ES2015字符串模板的最佳方法是什么?
template.html
<div>
<span>Hello, my name is ${name}.</span>
<span>I'm a ${title}.</span>
</div>
main.js
let template = '';
let name = "Adam Curl"
let title = "Coder"
$.get("template.html", function(response) {
template = response;
});
console.log(template);
希望输出......
<div>
<span>Hello, my name is Adam Curl.</span>
<span>I'm a Coder.</span>
</div>