此问题仅在我将代码迁移到生产中时出现,在我的开发环境中不会发生。
我有一个接收对象的车把模板,例如:
{node: {sections: [{name: 'abc'},{name: 'xyz'}]}}
模板看起来像这样:
{{#each node.sections}}
{{#ifCond type '==' "image-left-text-right"}}
{{> admin/section/image-left-text-right}}
{{/ifCond}}
{{#ifCond type '==' "two-columns-image-and-text"}}
{{> admin/section/two-columns-image-and-text}}
{{/ifCond}}
{{#ifCond type '==' "four-columns"}}
{{> admin/section/four-columns}}
{{/ifCond}}
{{/each}}
现在,这一切在我的开发环境中看起来都很好,并且模板可以正确呈现,在生产中什么也没显示。
在控制台记录完我的整个对象后,我可以确认它在那里,并编写了一个小助手来帮助我对其进行控制台记录:
<script>
console.log('----1---')
console.log({{{json node}}})
console.log('----2---')
console.log({{{json node.sections}}})
console.log('----3---')
</script>
但是第二个控制台日志什么也不输出。
就像它无权访问对象上的该属性?
我在开发人员和产品中都运行版本[email protected]。我需要设置的把手中是否存在一些我不知道的奇怪的私有/公共标志,以允许其直接访问数组?
所以,显然我错了,我在开发环境中运行4.0.12,在生产环境中运行4.7.6。 package.json文件中的^ 4.0.12导致它安装了较新的版本。显然,此问题与4.7.6有关,现在我将其更改为4.0.12,并将最终调查4.7.6的哪些更改导致了此问题。