Skip to content

Instantly share code, notes, and snippets.

@otakustay
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otakustay/50e6057de11e3fd9e1f9 to your computer and use it in GitHub Desktop.
Save otakustay/50e6057de11e3fd9e1f9 to your computer and use it in GitHub Desktop.
Table config
function XxxListView() {
// super()
var tableFields = [
{
// ...
}
];
this.setTableFields(tableFields);
}
// 好处:更接近java的玩法,每个实例独享不会相互影响
// 坏处:构造函数会变得比较长
function XxxListView() {
// super()
}
XxxListView.prototype.tableFields = [
{
// ...
}
];
// 好处:像配置一样去写,看着舒服
// 坏处:一但需要动态修改列,没有deepClone后果严重
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment