Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文档FAQ更新 & 增加一个 Model 添加 function 的内容 #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

2. “XMLHttpRequest cannot load http://sfenglish.sx.duapp.com/socket/info. Origin http://sfenglish.duapp.com is not allowed by Access-Control-Allow-Origin.”错误解决。

答:该错误说明Clouda服务器代码出险错误,可查看Clouda在BAE上的log定位问题。
答:该错误说明你访问的地址和配置的site_url不一致,去 app/server_config/site_url.js 修改


3. 在Controller中使用env.redirect()跳转后出险页面覆盖和重叠的问题?
Expand Down Expand Up @@ -36,4 +36,4 @@

7. 出现“MSBUILD : error MSB3428: Could not load the Visual C++ component ‘VCBuild.exe’.”
<img style="max-width: 80%;;" src="./images/error_install_sureru.png">
答:按照出错之后的提示安装 .NET Framework 2.0 SDK以及安装Microsoft Visual Studio 2005。
答:按照出错之后的提示安装 .NET Framework 2.0 SDK以及安装Microsoft Visual Studio 2005。
19 changes: 19 additions & 0 deletions docs/step3_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,25 @@ Controller具有以下几个时态:onload()、onrender()、onready()、onsleep
更多内置验证方法和自定义验证方法,请参考附录:《API说明文档》


* ### function

定义Model的function
给 student 增加 ageAndGender() 。(不要覆盖 get set 等原有 function)

Model.student = function(exports){
exports.config = {
fields: [
{name : 'studentName', type: 'string'},
{name : 'age', type: 'int'},
{name : 'gender', type: 'string'}
]
};
exports.ageAndGender = function(){
return this.age + ' ' + this.gender
}
};


* #### model

当type值为model和collection时,表示该字段包含一个指向其他model的1:1 或 1:n 的关系。
Expand Down