• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript aurelia-templating.ViewSlot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中aurelia-templating.ViewSlot的典型用法代码示例。如果您正苦于以下问题:TypeScript ViewSlot类的具体用法?TypeScript ViewSlot怎么用?TypeScript ViewSlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ViewSlot类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: compile

  compile(element: HTMLElement, fragment: Element | DocumentFragment | string, context: any, overrideContext: any = undefined) {
    element.classList.remove('au-target');
    let view = this.viewCompiler.compile(fragment, this.resources).create(this.container);

    let viewSlot = new ViewSlot(element, true, undefined);
    viewSlot.add(view);
    viewSlot.bind(context, overrideContext);
    viewSlot.attached();
    return viewSlot;
  }
开发者ID:LazerFX,项目名称:marvelous-aurelia-core,代码行数:10,代码来源:compiler.ts


示例2: ViewSlot

 return this.viewEngine.loadViewFactory(templateUrl).then(x => {
   let view = x.create(this.container);
   let viewSlot = new ViewSlot(element, true, undefined);
   
   viewSlot.add(view);
   viewSlot.bind(ctx, undefined);
   viewSlot.attached();
   
   return viewSlot;
 });
开发者ID:LazerFX,项目名称:marvelous-aurelia-core,代码行数:10,代码来源:compiler.ts


示例3: createController

// creates a controller given a html template string and a viewmodel instance.
function createController(template, viewModel, viewsRequireLifecycle?: boolean) {
  let childContainer = container.createChild();

  let viewFactory = viewCompiler.compile(template);

  if (viewsRequireLifecycle !== undefined) {
    for (let id in viewFactory.instructions) {
      let targetInstruction = viewFactory.instructions[id];
      for (let behaviorInstruction of targetInstruction.behaviorInstructions) {
      if (behaviorInstruction.attrName === 'repeat') {
        behaviorInstruction.viewFactory._viewsRequireLifecycle = viewsRequireLifecycle;
      }
      }
    }
  }

  let metadata = new HtmlBehaviorResource();
  function App() {
    //
  }
  metadata.initialize(childContainer, App);
  metadata.elementName = metadata.htmlName = 'app';

  let controller = metadata.create(childContainer, BehaviorInstruction.dynamic(host, viewModel, viewFactory));
  controller.automate();

  viewSlot.removeAll();
  viewSlot.add(controller.view);

  return controller;
}
开发者ID:aurelia,项目名称:templating-resources,代码行数:32,代码来源:repeat-integration.spec.ts


示例4: hide

  hide() {
    if (!this.tooltipHovering) {
      this._viewSlot.unbind();
      this._viewSlot.detached();

      this._element.removeEventListener('mouseenter', this.tooltipHovered);
      this._element.removeEventListener('mouseleave', this.tooltipHovered);

      // stop Tether from caring about this.element
      // do not delete the reference to this.tether because it will probably be used again
      if (this._tether) {
        this._tether.destroy();
      }
      DOM.removeNode(this._element);
    }
  }
开发者ID:Thanood,项目名称:monterey,代码行数:16,代码来源:tooltip-renderer.ts


示例5: bind

  /**
   * Binds the replaceable to the binding context and override context.
   * @param bindingContext The binding context.
   * @param overrideContext An override context for binding.
   */
  bind(bindingContext, overrideContext) {
    if (this.view === null) {
      this.view = (this.viewFactory as any).create();
      this.viewSlot.add(this.view);
    }

    this.view.bind(bindingContext, overrideContext);
  }
开发者ID:aurelia,项目名称:templating-resources,代码行数:13,代码来源:replaceable.ts


示例6:

  /**
   * @internal
   */
  _hide() {
    if (!this.showing) {
      return;
    }

    this.showing = false;
    let removed = this.viewSlot.remove(this.view); // Promise or View

    if (removed instanceof Promise) {
      return removed.then(() => {
        this._unbindView();
      });
    }

    this._unbindView();
  }
开发者ID:aurelia,项目名称:templating-resources,代码行数:19,代码来源:if-core.ts


示例7: show

  show(target: Element) {
    this._viewSlot.attached();

    this._element.addEventListener('mouseenter', this.tooltipHovered.bind(this));
    this._element.addEventListener('mouseleave', this.tooltipHovered.bind(this));

    this._tether = new Tether({
      element: this._element,
      target,
      classes: {
        element: false,
        target: false,
        enabled: false,
      },
      classPrefix: 'tooltip',
      attachment: 'bottom left',
      constraints: [{ to: 'window', attachment: 'together' }]
    });
    this._tether.position();
  }
开发者ID:Thanood,项目名称:monterey,代码行数:20,代码来源:tooltip-renderer.ts


示例8: unbind

  unbind() {
    if (this.view === null) {
      return;
    }

    this.view.unbind();

    // It seems to me that this code is subject to race conditions when animating.
    // For example a view could be returned to the cache and reused while it's still
    // attached to the DOM and animated.
    if (!this.viewFactory.isCaching) {
      return;
    }

    if (this.showing) {
      this.showing = false;
      this.viewSlot.remove(this.view, /*returnToCache:*/true, /*skipAnimation:*/true);
    } else {
      this.view.returnToCache();
    }

    this.view = null;
  }
开发者ID:aurelia,项目名称:templating-resources,代码行数:23,代码来源:if-core.ts



注:本文中的aurelia-templating.ViewSlot类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript aurelia-testing.ComponentTester类代码示例发布时间:2022-05-25
下一篇:
TypeScript aurelia-task-queue.TaskQueue类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap