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

TypeScript dom.children函数代码示例

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

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



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

示例1: _update_layout

  _update_layout(): void {
    const loc = this.model.tabs_location

    this.header = new LayoutItem()
    const size = Math.max(...children(this.header_el).map((el) => outer_size(el).height))
    if (loc == "above" || loc == "below")
      this.header.set_sizing({width_policy: "fit", height_policy: "fixed", height: size})
    else
      this.header.set_sizing({width_policy: "fixed", width: size, height_policy: "fit"})

    let row = 1
    let col = 1
    switch (loc) {
      case "above": row -= 1; break
      case "below": row += 1; break
      case "left":  col -= 1; break
      case "right": col += 1; break
    }

    const header = {layout: this.header, row, col}

    const panels = this.child_views.map((child_view) => {
      return {layout: child_view.layout, row: 1, col: 1}
    })

    this.layout = new Grid([header, ...panels])
    this.layout.set_sizing(this.box_sizing())
  }
开发者ID:paddymul,项目名称:bokeh,代码行数:28,代码来源:tabs.ts


示例2: return

      return () => {
        const ntabs = this.model.tabs.length

        if (dir == "left")
          scroll_index = Math.max(scroll_index - 1, 0)
        else
          scroll_index = Math.min(scroll_index + 1, ntabs - 1)

        if (scroll_index == 0)
          left_el.setAttribute("disabled", "")
        else
          left_el.removeAttribute("disabled")

        if (scroll_index == ntabs - 1)
          right_el.setAttribute("disabled", "")
        else
          right_el.removeAttribute("disabled")

        const sizes = children(this.headers_el)
          .slice(0, scroll_index)
          .map((el) => el.getBoundingClientRect())

        if (vertical) {
          const left = -sum(sizes.map((size) => size.width))
          this.headers_el.style.left = `${left}px`
        } else {
          const top = -sum(sizes.map((size) => size.height))
          this.headers_el.style.top = `${top}px`
        }
      }
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:30,代码来源:tabs.ts


示例3: on_active_change

  on_active_change(): void {
    const i = this.model.active

    const headers = children(this.header_el)
    for (const el of headers)
      el.classList.remove("bk-active")

    headers[i].classList.add("bk-active")

    const {child_views} = this
    for (const child_view of child_views)
      hide(child_view.el)

    show(child_views[i].el)
  }
开发者ID:paddymul,项目名称:bokeh,代码行数:15,代码来源:tabs.ts


示例4: _measure

      protected _measure(viewport: Sizeable) {
        const min_headers = 3

        const scroll = size(scroll_el)
        const headers = children(headers_el).slice(0, min_headers).map((el) => size(el))

        const {width, height} = super._measure(viewport)
        if (vertical) {
          const min_width = scroll.width + sum(headers.map((size) => size.width))
          return {width: viewport.width != Infinity ? viewport.width : min_width, height}
        } else {
          const min_height = scroll.height + sum(headers.map((size) => size.height))
          return {width, height: viewport.height != Infinity ? viewport.height : min_height}
        }
      }
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:15,代码来源:tabs.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript dom.classes函数代码示例发布时间:2022-05-24
下一篇:
TypeScript dom.canvas函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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