|
389 | 389 | if (b) { |
390 | 390 | if (b.view) { |
391 | 391 | init = function(arg$){ |
392 | | - var node, local, data, ctx, ctxs, views, ref$; |
| 392 | + var node, local, data, ctx, ctxs, views, _cfg, ref$, _ctx; |
393 | 393 | node = arg$.node, local = arg$.local, data = arg$.data, ctx = arg$.ctx, ctxs = arg$.ctxs, views = arg$.views; |
394 | | - local._view = new ldview((ref$ = import$({ |
| 394 | + _cfg = (ref$ = import$({ |
395 | 395 | ctx: data |
396 | 396 | }, b.view), ref$.initRender = false, ref$.root = node, ref$.baseViews = views, ref$.ctxs = ctxs |
397 | 397 | ? [ctx].concat(ctxs) |
398 | | - : [ctx], ref$)); |
| 398 | + : [ctx], ref$); |
| 399 | + if (typeof _cfg.ctx === 'function') { |
| 400 | + _ctx = _cfg.ctx; |
| 401 | + _cfg.ctx = function(opt){ |
| 402 | + return _ctx(import$({ |
| 403 | + ctx: data || ctx |
| 404 | + }, opt)); |
| 405 | + }; |
| 406 | + local._ctx = _ctx; |
| 407 | + } |
| 408 | + local._view = new ldview(_cfg); |
399 | 409 | return local._view.init(); |
400 | 410 | }; |
401 | | - handler = function(arg$){ |
| 411 | + handler = function(opt){ |
402 | 412 | var local, data, ctx, ctxs; |
403 | | - local = arg$.local, data = arg$.data, ctx = arg$.ctx, ctxs = arg$.ctxs; |
| 413 | + local = opt.local, data = opt.data, ctx = opt.ctx, ctxs = opt.ctxs; |
404 | 414 | if (e) { |
405 | | - local._view.ctx(data); |
| 415 | + local._view.ctx(data || ctx); |
| 416 | + } else if (local._ctx) { |
| 417 | + local._view.ctx(local._ctx(opt)); |
406 | 418 | } |
407 | 419 | local._view.ctxs(ctxs |
408 | 420 | ? [ctx].concat(ctxs) |
|
0 commit comments