我编写了一个辅助函数来帮助我格式化 URL,它是一些对象属性的组合。如何在车把视图中连接此属性?
辅助功能
const url = (link)=>{
return process.env.URL+'/'+link.replace(/ /gi,'-').toLowerCase();
};
Run Code Online (Sandbox Code Playgroud)
我的看法
<a href="{{url 'samples/'+this.name+'/'+this.class+'/'+this.id}}">{{this.name}}</a>
Run Code Online (Sandbox Code Playgroud) node.js express handlebars.js handlebarshelper express-handlebars