1
经过大量的努力,我已经实现了handlebarsjs到一个测试站点,用户在输入数据时显示它。handlebarsjs - 如何使用include代替重复代码
要以不同的模板样式显示用户输入,我必须以同样的形式多次重复相同的handlebarsjs代码。
有没有办法将重复的句柄代码放在一个外部页面,然后包括这个外部页面代替重复的句柄代码?
我不确定语法,或者即使这种方法可能与handlebarsjs(我尝试了几件事 - 但不能得到这个工作)。
这里是被剔除重复的代码,我有:
{{# if address_style_one_line }}
{{! address is to be displayed across one line - replaced line breaks with line space }}
{{# if address_style_01 }}
....
{{else}}
{{# if address_style_02 }}
....
{{else}}
{{! address is to be displayed across more than one line - use this format as the template for the address scross one line style }}
{{# if address_style_01 }}
....
{{else}}
{{# if address_style_02 }}
....
{{/if}}
VLS - 感谢您的帮助。 – user3354539