问题描述
我目前正在学习 geddy 教程并遇到了一行代码:
I'm currently working through a geddy tutorial and came across a line of code:
<%- partial('form', {step: {}, toDos: toDos}) %>
部分是什么意思?我在没有太多洞察力的情况下进行了谷歌搜索.我猜这意味着您部分加载了内容,因此页面加载速度更快?
What does partial mean? I've done a google search without much insight. I'm guessing it means that you partially load the content so the page loads faster?
任何解释或有用的链接将不胜感激.
Any explanations or helpful links would be appreciated.
我已经有一段时间没有编写代码了,所以如果我应该查看我遗漏的特定编码方法(例如 OOP、MVC),请告诉我.
It's been a while since I've coded so if I should be looking at a particular method of coding (e.g. OOP, MVC) that I'm missing let me know.
推荐答案
我在专家交流中收到了 Dan Craciun 的回答,为我解答:
I received this answer by Dan Craciun on experts exchange which answers it for me:
在 geddy 中,部分(由名称前面的 _ 表示)是可重用的文件/模板,旨在用于多个模板.它有助于在不同模板之间共享代码.
In geddy, a partial (denoted by a _ in front of the name) is a reusable file/template, that is meant to be used in more than one template. It helps share code between different templates.
这里有更详细的解释(大约半页,部分介绍"):http://code.tutsplus.com/tutorials/creating-a-todo-list-app-with-nodejs-and-geddy--net-24535
See here for a longer explanation (about half page, "An intro to partials"): http://code.tutsplus.com/tutorials/creating-a-todo-list-app-with-nodejs-and-geddy--net-24535
HTH,丹
这篇关于从编码的角度来看,什么是“部分"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!