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

TypeScript mithril.default函数代码示例

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

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



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

示例1: renderStaging

function renderStaging(staging): Child[] {
  const elements: Child[] = [];

  for (const s of staging) {
    const queueFunc = (): void => {
      staging.delete(s);
      taskQueue.queueTask(s);
    };
    const cancelFunc = (): void => {
      staging.delete(s);
    };

    let elms;
    if (s.name === "setParameterValues")
      elms = renderStagingSpv(s, queueFunc, cancelFunc);
    else if (s.name === "download") elms = renderStagingDownload(s);

    const queue = m(
      "button.primary",
      { title: "Queue task", onclick: queueFunc, disabled: s.invalid },
      "Queue"
    );
    const cancel = m(
      "button",
      { title: "Cancel edit", onclick: cancelFunc },
      "Cancel"
    );

    elements.push(m(".staging", elms, m("div.actions", queue, cancel)));
  }
  return elements;
}
开发者ID:zaidka,项目名称:genieacs,代码行数:32,代码来源:drawer-component.ts


示例2: pins

function pins(
  { frame, squareNumber }: FramePinState,
  dispatch: (action: FrameAction) => void,
) {
  const frameOptions = {
    key: frame.id,
    onclick() {
      dispatch({ type: "cycle" })
    },
    style: "cursor: pointer;",
    className: frame.id === 10 ? "tenth-frame" : "",
  }

  const standingPins = frame.squares[squareNumber - 1].standingPins
  return m("li", frameOptions, [
    m(".frame-number-container", frame.id),
    m(".score-container", [
      m(".shot-number", squareNumber),
      m(
        ".pins",
        range(0, 10).map(n => {
          const isStanding = standingPins & (1 << n) ? ".isStanding" : ""
          return m(`.pin.pin-${n + 1}${isStanding}`)
        }),
      ),
    ]),
  ])
}
开发者ID:nordfjord,项目名称:eyc-live,代码行数:28,代码来源:Frame.ts


示例3: m

TreeView.view = function (ctrl: ITreeData, args: ITreeDataOptions, components: { header?: Array<Object> }): Object {
  return m('div', [
    m('div', { 'class': CLASS_TREE_HEADER }, (!components || !components.header) ? [] : components.header.map((Component) => {
      return m.component(Component, ctrl)
    })),
    (ctrl.getRootNodes().length > 0) ? TreeView.view.createTreeNodeView(ctrl) : ''
  ])
}
开发者ID:Draggha,项目名称:pickdrasil-mithril,代码行数:8,代码来源:treeview.ts


示例4: onChange

    view: vnode => {
      if (
        !vnode.state["filterList"] ||
        vnode.attrs["filter"] !== vnode.state["filter"]
      ) {
        vnode.state["filterInvalid"] = 0;
        vnode.state["filter"] = vnode.attrs["filter"];
        vnode.state["filterList"] = splitFilter(vnode.attrs["filter"]);
      }

      function onChange(): void {
        vnode.state["filterInvalid"] = 0;
        vnode.state["filterList"] = vnode.state["filterList"].filter(f => f);
        let filter = vnode.state["filterList"].map((f, idx) => {
          try {
            return parseFilter(vnode.attrs["resource"], f);
          } catch (err) {
            vnode.state["filterInvalid"] |= 1 << idx;
          }
          return null;
        });
        vnode.state["filterList"].push("");

        if (!vnode.state["filterInvalid"]) {
          delete vnode.state["filter"];
          if (filter.length === 0) {
            vnode.attrs["onChange"]("");
          } else {
            if (filter.length > 1) filter = ["AND"].concat(filter);
            else filter = filter[0];
            vnode.attrs["onChange"](stringify(filter));
          }
        }
      }

      return m(
        "div.filter",
        [m("b", "Filter")].concat(
          vnode.state["filterList"].map((fltr, idx) => {
            return m("input", {
              type: "text",
              class: `${
                (vnode.state["filterInvalid"] >> idx) & 1 ? "error" : ""
              }`,
              value: fltr,
              onchange: e => {
                vnode.state["filterList"] = vnode.state["filterList"].slice();
                vnode.state["filterList"][idx] = e.target.value.trim();
                onChange();
              },
              oncreate: vn => {
                getAutocomplete(vnode.attrs["resource"]).attach(vn.dom);
              }
            });
          })
        )
      );
    }
开发者ID:zaidka,项目名称:genieacs,代码行数:58,代码来源:filter-component.ts


示例5: m

 render: () => {
   lastRenderTimestamp = Date.now();
   let p;
   if (state && state.error) p = m(errorPage.component, state);
   else p = m(contextifyComponent(page.component), state);
   fulfill();
   const attrs = {};
   attrs["page"] = pageName;
   return m(layout, attrs, p);
 },
开发者ID:zaidka,项目名称:genieacs,代码行数:10,代码来源:app.ts


示例6: m

    view: vnode => {
      const active = { [vnode.attrs["page"]]: "active" };

      const tabs = [];
      if (window.authorizer.hasAccess("devices", 1)) {
        tabs.push(
          m(
            "li",
            { class: active["overview"] },
            m("a", { href: "#!/overview" }, "Overview")
          )
        );
      }

      if (window.authorizer.hasAccess("devices", 2)) {
        tabs.push(
          m(
            "li",
            { class: active["devices"] },
            m("a", { href: "#!/devices" }, "Devices")
          )
        );
      }

      if (window.authorizer.hasAccess("faults", 2)) {
        tabs.push(
          m(
            "li",
            { class: active["faults"] },
            m("a", { href: "#!/faults" }, "Faults")
          )
        );
      }

      const adminPages = [
        "presets",
        "provisions",
        "virtualParameters",
        "files"
      ];
      for (const page of adminPages) {
        if (window.authorizer.hasAccess(page, 2)) {
          tabs.push(
            m(
              "li",
              { class: active["admin"] },
              m("a", { href: "#!/admin" }, "Admin")
            )
          );
          break;
        }
      }

      return m("nav", m("ul", tabs));
    }
开发者ID:zaidka,项目名称:genieacs,代码行数:55,代码来源:menu.ts


示例7: m

export const Game = ({ attrs: { player } }: m.Vnode<{ player: GameType }>) => ({
  view() {
    return m("", { key: player.name }, [
      m(".lane-name", player.name),
      m(
        "ul.lane-row.clearfix",
        player.frames.map(frame => m(Frame, { frame, key: frame.id })),
      ),
    ])
  },
})
开发者ID:nordfjord,项目名称:eyc-live,代码行数:11,代码来源:game.ts


示例8: renderStagingSpv

function renderStagingSpv(task, queueFunc, cancelFunc): Children {
  function keydown(e): void {
    if (e.keyCode === 13) queueFunc();
    else if (e.keyCode === 27) cancelFunc();
    else e.redraw = false;
  }

  let input;
  if (task.parameterValues[0][2] === "xsd:boolean") {
    input = m(
      "select",
      {
        value: task.parameterValues[0][1].toString(),
        onchange: e => {
          e.redraw = false;
          task.parameterValues[0][1] = input.dom.value;
        },
        onkeydown: keydown,
        oncreate: vnode => {
          (vnode.dom as HTMLSelectElement).focus();
        }
      },
      [
        m("option", { value: "true" }, "true"),
        m("option", { value: "false" }, "false")
      ]
    );
  } else {
    input = m("input", {
      type: ["xsd:dateTime", "xsd:int", "xsd:unsignedInt"].includes(
        task.parameterValues[0][2]
      )
        ? "number"
        : "text",
      value: task.parameterValues[0][1],
      oninput: e => {
        e.redraw = false;
        task.parameterValues[0][1] = input.dom.value;
      },
      onkeydown: keydown,
      oncreate: vnode => {
        (vnode.dom as HTMLInputElement).focus();
        (vnode.dom as HTMLInputElement).select();
        // Need to prevent scrolling on focus because
        // we're animating height and using overflow: hidden
        (vnode.dom.parentNode.parentNode as Element).scrollTop = 0;
      }
    });
  }

  return [m("span", "Editing ", mparam(task.parameterValues[0][0])), input];
}
开发者ID:zaidka,项目名称:genieacs,代码行数:52,代码来源:drawer-component.ts


示例9: m

let SearchBarView = function (ctrl) {
  return m('Label', {
    'class': CLASS_TREEVIEW_SEARCH_LABEL
  }, [
      'Filter: ',
      m('input', {
        type: 'text',
        name: 'treeview-search',
        oninput: m.withAttr('value', ctrl.searchTerm),
        value: ctrl.searchTerm()
      })
    ])
}
开发者ID:Draggha,项目名称:pickdrasil-mithril,代码行数:13,代码来源:searchbar.ts


示例10: m

    view: vnode => {
      let sideMenu, group;

      if (adminPages.includes(vnode.attrs["page"])) {
        group = "admin";
        const attrs = {};
        attrs["page"] = vnode.attrs["page"];
        sideMenu = m(adminMenu, attrs);
      }

      const attrs = {};
      attrs["page"] = group || vnode.attrs["page"];

      return [
        m("#header", [
          m("img.logo", { src: "logo.svg" }),
          m(userMenu),
          m(menu, attrs),
          m(drawerComponent)
        ]),
        m(
          "#content-wrapper",
          sideMenu,
          m("#content", { class: `page-${vnode.attrs["page"]}` }, [
            vnode.children
          ])
        ),
        overlay.render()
      ];
    }
开发者ID:zaidka,项目名称:genieacs,代码行数:30,代码来源:layout.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript mithril.endComputation函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mithril.buildQueryString函数代码示例发布时间: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