Skip to content

ER的两点疑问 #160

Description

@Phinome

我按照 ER DEMO 中的 book-store 例子,写了一个类似的例子,有一些疑问,

第一个是关于ER中Action,Model,View 实例创建方式的疑问:例如:

// 在 ER 中声明一个 Action
...
var Action = require('er/Action');
function indexAction() {
    Action.apply(this, arguments);
}
indexAction.prototype.modeType = require('index/indexModel');
indexAction.prototype.viewType   = require('index/indexView');
.............
require('er/util').inherits(indexAction, Action);

用上面的代码创建 Action 时,有两点:

  1. modeType , viewType 能否默认为 indexModel, indexView ?这一点,想请教一下你们的考虑;
  2. 是否有这样一种方式生成 Action:
define([
    'er'
], function(er) {
    var indexAction = er.Action.extend({
        modeType:  require('index/indexModel'),
        viewType :  require('index/indexView'),
        initBehavior: function() {
            console.log(this);
        }
    ....
    });

    return indexAction;
});

第二,想问问 ER 与 ESUI 结合使用的例子,我看之前的 errorrik 写的 ER 中有一个 ui.js 中写了个 ui adapter ,将 ER 与 ESUI 结合了起来,那么,新版的 ER 可否采用相同的方式或者你们在实践中又是怎样处理的呢?

以上两个问题,感谢!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions