小编Lat*_*mos的帖子

JSON模板引擎

有没有JSON模板引擎?我在寻找像这样的东西......

var template = {
  'sts': '%data1.sts%',
  'msg': '%data2.msg%'
};

var data1 = {
  'sts': 200
};

var data2 = {
  'msg': 'Hi!'
};

// render(template, [data sources]);
var response = render(template, [data1, data2]);

console.log(response);
Run Code Online (Sandbox Code Playgroud)

产量

{
  'sts': 200,
  'msg': 'Hi!'
}
Run Code Online (Sandbox Code Playgroud)

谢谢你的答复!

javascript templates json

5
推荐指数
1
解决办法
4839
查看次数

标签 统计

javascript ×1

json ×1

templates ×1