當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript cycle-snabbdom.p函數代碼示例

本文整理匯總了TypeScript中cycle-snabbdom.p函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript p函數的具體用法?TypeScript p怎麽用?TypeScript p使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了p函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: view

  function view(isDrawerActive: boolean) {
    const drawer = (
      Drawer(sources, { isolate: false, className: 'drawer', active: isDrawerActive, type: 'left' }, [
        h5('This is a left drawer'),
        p('A drawer can have multiple children controls'),
        Input(sources, { label: 'Input in a Drawer' }).DOM,
      ])
    );

    // (<any>drawer).closeEvent$.subscribe( (x: any) => {
    //   console.log('close obs event: ' + x);
    // });

    return (
      Card(sources, { isolate: false, className: 'demoDrawers' }, [
        CardTitle(sources, { isolate: false, title: 'Drawers (Work in progress)' }, [
          CardText(sources, { isolate: true }, [
            Button(sources, { isolate: false, className: 'showDrawer', label: 'Show Drawer',
              raised: true }).DOM,
            p('is active: ' + isDrawerActive),
            drawer.DOM,
          ]).DOM
        ]).DOM
      ]).DOM
    );
  }
開發者ID:eldarlabs,項目名稱:cycle-ui-typescript-webpack,代碼行數:26,代碼來源:Drawers.ts

示例2: view

 function view(isDialogActive: boolean) {
   return (
     DemoCardView(sources, 'Dialogs (Work in progress)', [
       CardText(sources, [
         Button(sources, { className: 'showDialog', label: 'Show Modal Dialog',
           raised: true }).DOM,
         p('is active: ' + isDialogActive),
         Dialog({ title: 'Test Dialog', active: isDialogActive,
           actions: [cancelButton.DOM, saveButton] }, [
             p('This is a dialog'),
             p('A dialog can have multiple children controls')
           ]
         ).DOM
       ]).DOM
     ])
   );
 }
開發者ID:eldarlabs,項目名稱:cycle-ui-typescript-webpack,代碼行數:17,代碼來源:Dialogs.ts

示例3: classNames

  const vtree$ = props$.map( (props) => {

    const className = classNames(style.cardText, props.className);
    console.log(children);
    return (
      div( { props: { className } },
        typeof children === 'string' ? p(children) : children
      )
    );
  });
開發者ID:eldarlabs,項目名稱:cycle-ui,代碼行數:10,代碼來源:CardText.ts

示例4: FooterView

export function FooterView() {
  return (
    footer(`.${style.footer}`, [
      p([
        'Š ',
        a({
          'props': {
            'href': 'https://eldarlabs.com'
          }
        }, `Eldar Labs`),
        ' 2016'])
    ])
  );
}
開發者ID:eldarlabs,項目名稱:cycle-ui-typescript-webpack,代碼行數:14,代碼來源:Footer.ts

示例5: classNames

  const vtree$ = props$.map( (props) => {

    //TODO: do Avatars at some point

    //let avatarComponent;

    // if (typeof avatar === 'string') {
    //   avatarComponent = <Avatar image={avatar} />;
    // } else {
    //   avatarComponent = avatar;
    // }

    const className = classNames(style.cardTitle, {
      // [style.small]: props.avatar,
      // [style.large]: !props.avatar
    }, props.className);
    const titleDOM = props.title &&
      h5(`.${style.title}`, props.title);

    const childrenAsStringDOM = children && typeof children === 'string' &&
      h5(`.${style.title}`,
        children
      );

    const subtitleDOM = props.subtitle &&
      p(`.${style.subtitle}`, props.subtitle);

    const childrenAsArray = children && typeof children !== 'string' &&
      children;

    return (
      div( { props: { className } }, [
        div(concat([],
          titleDOM,
          childrenAsStringDOM,
          subtitleDOM,
          childrenAsArray
        )),
      ]
      // [
      //   //TODO: Avatars
      //   // {avatarComponent && (
      //   //   <div className={style.avatar}>
      //   //     {avatarComponent}
      //   //   </div>
      //   // )}
      // ]
      )
    );
  });
開發者ID:eldarlabs,項目名稱:cycle-ui,代碼行數:50,代碼來源:CardTitle.ts

示例6: SpielView

export function SpielView() {
  return (
    h2('Kitchen Sink'),
    p([
      'Demo site for ',
      a({
        'props': {
          'href': 'https://github.com/eldarlabs/cycle-ui'
        }
      }, 'Cycle-UI'),
      ' using ',
      a({
        'props': {
          'href': 'https://github.com/eldarlabs/cycle-ui-typescript-webpack'
        }
      }, 'cycle-ui-typescript-webpack'),
      ' starter project.'
    ])
  );
}
開發者ID:eldarlabs,項目名稱:cycle-ui-typescript-webpack,代碼行數:20,代碼來源:Spiel.ts

示例7: div

 DOM: count$.map(count =>
     div([
       Button(sources, { className: 'decrement', label: 'Decrement' }).DOM,
       Button(sources, { className: 'increment', label: 'Increment' }).DOM,
       p('Counter: ' + count)
     ])
開發者ID:eldarlabs,項目名稱:cycle-ui-typescript-webpack,代碼行數:6,代碼來源:index.ts


注:本文中的cycle-snabbdom.p函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。