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

Scala ReactNode类代码示例

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

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



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

示例1: formData

//设置package包名称以及导入依赖的类
package postgresweb.components.base

import io.circe._
import io.circe.generic.auto._
import io.circe.parser._
import io.circe.syntax._
import io.circe.scalajs._
import japgolly.scalajs.react.{React, ReactComponentU_, ReactElement, ReactNode}
import postgresweb.models.{JSONSchemaUI, JSONSchema}

import scala.scalajs._



@js.native
trait SchemaFormState extends js.Object{
  def formData: js.Any
}


case class SchemaFormNative(
                             schema:String,
                             uiSchema:Option[JSONSchemaUI] = None,
                             formData:Option[js.Any] = None,
                             onChange:Option[() => Unit] = None,
                             onError:Option[() => Unit] = None,
                             onSubmit:Option[SchemaFormState => Unit] = None,
                             schemaField:Option[() => Unit] = None,
                             titleField:Option[() => Unit] = None
  )  {



   def apply(childs: ReactNode*) = {

    val p = js.Dynamic.literal()
      p.updateDynamic("schema")(js.JSON.parse(schema)) //fix to avoid undefined fields
      uiSchema.foreach(ui => p.updateDynamic("uiSchema")(ui.asJsAny))
      formData.foreach(fd => p.updateDynamic("formData")(fd))
      onChange.foreach(oc => p.updateDynamic("onChange")(oc))
      onError.foreach(oe => p.updateDynamic("onError")(oe))
      onSubmit.foreach(os => p.updateDynamic("onSubmit")(os))
      schemaField.foreach(sf => p.updateDynamic("SchemaField")(sf))
      titleField.foreach(tf => p.updateDynamic("TitleField")(tf))


     js.Dynamic.global.console.log(p)


      val component = React.asInstanceOf[js.Dynamic].createElement(js.Dynamic.global.JSONSchemaForm,p,childs.toJsArray)
      js.Dynamic.global.console.log(component)
      component.asInstanceOf[ReactComponentU_]
    }
  } 
开发者ID:minettiandrea,项目名称:postgres-web,代码行数:55,代码来源:SchemaFormNative.scala


示例2: AceEditor

//设置package包名称以及导入依赖的类
package spatutorial.client.components

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}
import macros.JSMacro

import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
import scala.scalajs.js.{UndefOr, _}

@js.native
@JSName("ReactAce")
object AceEditor extends js.Object

case class AceEditorGenerated(mode : UndefOr[String] = undefined,
                              theme : UndefOr[String] = undefined,
                              name : UndefOr[String] = undefined,
                              height : UndefOr[String] = undefined,
                              fontSize: UndefOr[Int] = undefined,
                              value: UndefOr[String] = undefined
                             ) {
  def toJS = {
    val p = js.Dynamic.literal()
    mode.foreach(v => p.updateDynamic("mode")(v))
    theme.foreach(v => p.updateDynamic("theme")(v))
    name.foreach(v => p.updateDynamic("name")(v))
    height.foreach(v => p.updateDynamic("height")(v))
    fontSize.foreach(v => p.updateDynamic("fontSize")(v))
    value.foreach(v => p.updateDynamic("value")(v))
    p
  }

  def apply(children: js.UndefOr[ReactNode] = js.undefined) = {

    val props = JSMacro[AceEditorGenerated](this)
    val f = React.asInstanceOf[js.Dynamic].createFactory(AceEditor)
    f(props, children).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:wrotki,项目名称:spacommander,代码行数:39,代码来源:AceEditorGenerated.scala


示例3: propOne

//设置package包名称以及导入依赖的类
package spatutorial.client.components

import japgolly.scalajs.react.vdom.prefix_<^.<
import japgolly.scalajs.react.{BackendScope, Callback, JsComponentM, JsComponentType, JsComponentU, ReactComponentB, ReactComponentU_, ReactNode}
import org.scalajs.dom.raw.HTMLElement

import scala.scalajs.js
import scala.scalajs.js._
import scala.scalajs.js.annotation.JSName

@js.native
trait SampleReactComponentProps extends js.Object {
  def propOne: String = js.native
  def propRwo: String = js.native
}

@js.native
@JSName("SampleReactComponent")
class SampleReactComponent(props: SampleReactComponentProps) extends JsComponentU[SampleReactComponentProps, js.Object, HTMLElement]

object SampleReactComponentProps {
  def apply(propOne: String,
            propTwo: String): SampleReactComponentProps = {
    js.Dynamic.literal(
      propOne = propOne,
      propYwo = propTwo
    ).asInstanceOf[SampleReactComponentProps]
  }
}

object SampleReactComponent {

  //  ,^.style("width: 500; height: 500")
  val component = ReactComponentB[SampleReactComponentProps]("SampleReactComponent")
    .render_P(p => new SampleReactComponent(p))
    .build

  //  val component = ReactComponentB[AceProps]("AceEditor")
  //    //.render(p => new AceEditor(p))
  //    .render_P(p => new AceEditor(p))
  //    .build

  def apply(props: SampleReactComponentProps, children: ReactNode*) = component(props, children: _*)

  def apply() = component

} 
开发者ID:wrotki,项目名称:spacommander,代码行数:48,代码来源:SampleReactComponent.scala


示例4: Switch

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Switch(checked: js.UndefOr[Boolean] = js.undefined,
                  defaultChecked: js.UndefOr[Boolean] = js.undefined,
                  onChange: js.UndefOr[(Boolean) => CallbackTo[Unit]] = js.undefined,
                  checkedChildren: js.UndefOr[String | ReactNode] = js.undefined,
                  unCheckedChildren: js.UndefOr[String | ReactNode] = js.undefined,
                  size: js.UndefOr[Switch.Size] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    checked.foreach { x =>
      p.updateDynamic("checked")(x)
    }
    defaultChecked.foreach { x =>
      p.updateDynamic("defaultChecked")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(
        (v1: Boolean) => x(v1).runNow()
      )
    }
    checkedChildren.foreach { x =>
      p.updateDynamic("checkedChildren")(x.asInstanceOf[js.Any])
    }
    unCheckedChildren.foreach { x =>
      p.updateDynamic("unCheckedChildren")(x.asInstanceOf[js.Any])
    }
    size.foreach { x =>
      p.updateDynamic("size")(x.id)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Switch)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

object Switch {
  sealed abstract class Size(val id: String)

  object Size {
    case object Default extends Size("default")
    case object Small   extends Size("small")
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:55,代码来源:Switch.scala


示例5: Item

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js.{Dynamic, Object, |}
import scala.scalajs.js


  case class Item(color: js.UndefOr[String] = js.undefined, dot: js.UndefOr[String | ReactNode] = js.undefined) {
    def toJS: Object with Dynamic = {
      val p = js.Dynamic.literal()
      color.foreach { x =>
        p.updateDynamic("color")(x)
      }
      dot.foreach { x =>
        p.updateDynamic("dot")(x.asInstanceOf[js.Any])
      }
      p
    }

    def apply(children: ReactNode*): ReactComponentU_ = {
      val f =
        React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Timeline.Item)
      f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
    }
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:28,代码来源:Timeline.scala


示例6: Affix

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Affix(offsetTop: js.UndefOr[Int] = js.undefined,
                 offsetBottom: js.UndefOr[Int] = js.undefined,
                 onChange: js.UndefOr[Boolean => CallbackTo[Unit]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    offsetTop.foreach { x =>
      p.updateDynamic("offsetTop")(x)
    }
    offsetBottom.foreach { x =>
      p.updateDynamic("offsetBottom")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(
        (v1: Boolean) => x(v1).runNow()
      )
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Affix)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:34,代码来源:Affix.scala


示例7: Rate

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Rate(count: js.UndefOr[Double] = js.undefined,
                value: js.UndefOr[Double] = js.undefined,
                defaultValue: js.UndefOr[Double] = js.undefined,
                onChange: js.UndefOr[Double => CallbackTo[Unit]] = js.undefined,
                allowHalf: js.UndefOr[Boolean] = js.undefined,
                disabled: js.UndefOr[Boolean] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    count.foreach { x =>
      p.updateDynamic("count")(x)
    }
    value.foreach { x =>
      p.updateDynamic("value")(x)
    }
    defaultValue.foreach { x =>
      p.updateDynamic("defaultValue")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(
        (v1: Double) => x(v1).runNow()
      )
    }
    allowHalf.foreach { x =>
      p.updateDynamic("allowHalf")(x)
    }
    disabled.foreach { x =>
      p.updateDynamic("disabled")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Rate)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:46,代码来源:Rate.scala


示例8: Group

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}
import org.scalajs.dom.Event

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


  case class Group(onChange: js.UndefOr[Event => CallbackTo[Unit]] = js.undefined,
                   value: js.UndefOr[String] = js.undefined,
                   defaultValue: js.UndefOr[String] = js.undefined,
                   size: js.UndefOr[Size] = js.undefined) {
    def toJS: Object with Dynamic = {
      val p = js.Dynamic.literal()
      onChange.foreach { x =>
        p.updateDynamic("onChange")(
          (v1: Event) => x(v1).runNow()
        )
      }
      value.foreach { x =>
        p.updateDynamic("value")(x)
      }
      defaultValue.foreach { x =>
        p.updateDynamic("defaultValue")(x)
      }
      size.foreach { x =>
        p.updateDynamic("size")(x.id)
      }
      p
    }

    def apply(children: ReactNode*): ReactComponentU_ = {
      val f =
        React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Radio.Group)
      f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
    }
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:40,代码来源:Radio.scala


示例9: Badge

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Badge(count: js.UndefOr[Int] = js.undefined,
                 overflowCount: js.UndefOr[Int] = js.undefined,
                 dot: js.UndefOr[Boolean] = js.undefined,
                 status: js.UndefOr[Badge.Status] = js.undefined,
                 text: js.UndefOr[String] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    count.foreach { x =>
      p.updateDynamic("count")(x)
    }
    overflowCount.foreach { x =>
      p.updateDynamic("overflowCount")(x)
    }
    dot.foreach { x =>
      p.updateDynamic("dot")(x)
    }
    status.foreach { x =>
      p.updateDynamic("status")(x.id)
    }
    text.foreach { x =>
      p.updateDynamic("text")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Badge)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

object Badge {
  sealed abstract class Status(val id: String)

  object Status {
    case object Success    extends Status("success")
    case object Processing extends Status("processing")
    case object Default    extends Status("default")
    case object Error      extends Status("error")
    case object Warning    extends Status("warning")
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:52,代码来源:Badge.scala


示例10: Checkbox

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{CallbackTo, React, ReactComponentU_, ReactNode}
import org.scalajs.dom.Event

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Checkbox(checked: js.UndefOr[Boolean] = js.undefined,
                    defaultChecked: js.UndefOr[Boolean] = js.undefined,
                    onChange: js.UndefOr[(Event) => CallbackTo[Unit]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    checked.foreach { x =>
      p.updateDynamic("checked")(x)
    }
    defaultChecked.foreach { x =>
      p.updateDynamic("defaultChecked")(x)
    }
    onChange.foreach { x =>
      p.updateDynamic("onChange")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Checkbox)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:33,代码来源:Checkbox.scala


示例11: Icon

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Icon(`type`: String, spin: js.UndefOr[Boolean] = js.undefined) {

  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    p.updateDynamic("type")(`type`)
    spin.foreach { x =>
      p.updateDynamic("spin")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Icon)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }

} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:27,代码来源:Icon.scala


示例12: Popover

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Popover(title: js.UndefOr[String | ReactNode] = js.undefined,
                   content: js.UndefOr[String | ReactNode] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    title.foreach { x =>
      p.updateDynamic("title")(x.asInstanceOf[js.Any])
    }
    content.foreach { x =>
      p.updateDynamic("content")(x.asInstanceOf[js.Any])
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Popover)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:28,代码来源:Popover.scala


示例13: Col

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Col(span: js.UndefOr[Double] = js.undefined,
               order: js.UndefOr[Double] = js.undefined,
               offset: js.UndefOr[Double] = js.undefined,
               push: js.UndefOr[Double] = js.undefined,
               pull: js.UndefOr[Double] = js.undefined,
               xs: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined,
               sm: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined,
               md: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined,
               lg: js.UndefOr[Double | js.Dictionary[js.Any]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    span.foreach { x =>
      p.updateDynamic("span")(x)
    }
    order.foreach { x =>
      p.updateDynamic("order")(x)
    }
    offset.foreach { x =>
      p.updateDynamic("offset")(x)
    }
    push.foreach { x =>
      p.updateDynamic("push")(x)
    }
    pull.foreach { x =>
      p.updateDynamic("pull")(x)
    }
    xs.foreach { x =>
      p.updateDynamic("xs")(x.asInstanceOf[js.Any])
    }
    sm.foreach { x =>
      p.updateDynamic("sm")(x.asInstanceOf[js.Any])
    }
    md.foreach { x =>
      p.updateDynamic("md")(x.asInstanceOf[js.Any])
    }
    lg.foreach { x =>
      p.updateDynamic("lg")(x.asInstanceOf[js.Any])
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Col)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:56,代码来源:Col.scala


示例14: Spin

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Spin(size: js.UndefOr[Size] = js.undefined,
                spinning: js.UndefOr[Boolean] = js.undefined,
                tip: js.UndefOr[String] = js.undefined,
                delay: js.UndefOr[Int] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    size.foreach { x =>
      p.updateDynamic("size")(x.id)
    }
    spinning.foreach { x =>
      p.updateDynamic("spinning")(x)
    }
    tip.foreach { x =>
      p.updateDynamic("tip")(x)
    }
    delay.foreach { x =>
      p.updateDynamic("delay")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Spin)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:36,代码来源:Spin.scala


示例15: Row

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object}


case class Row(gutter: js.UndefOr[Double] = js.undefined,
               `type`: js.UndefOr[Row.Type] = js.undefined,
               align: js.UndefOr[Row.Align] = js.undefined,
               justify: js.UndefOr[Row.Justify] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    gutter.foreach { x =>
      p.updateDynamic("gutter")(x)
    }
    `type`.foreach { x =>
      p.updateDynamic("type")(x.id)
    }
    `align`.foreach { x =>
      p.updateDynamic("align")(x.id)
    }
    `justify`.foreach { x =>
      p.updateDynamic("justify")(x.id)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Row)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

object Row {
  sealed abstract class Type(val id: String)

  object Type {
    case object Flex extends Type("flex")
  }

  sealed abstract class Align(val id: String)

  object Align {
    case object Top    extends Align("top")
    case object Middle extends Align("middle")
    case object Bottom extends Align("bottom")
  }

  sealed abstract class Justify(val id: String)

  object Justify {
    case object Start        extends Justify("start")
    case object End          extends Justify("end")
    case object Center       extends Justify("center")
    case object SpaceAround  extends Justify("space-around")
    case object SpaceBetween extends Justify("space-between")
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:62,代码来源:Row.scala


示例16: Card

//设置package包名称以及导入依赖的类
package scalajs.antdesign

import japgolly.scalajs.react.{React, ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{Dynamic, Object, |}


case class Card(title: js.UndefOr[String | ReactNode] = js.undefined,
                extra: js.UndefOr[String | ReactNode] = js.undefined,
                bordered: js.UndefOr[Boolean] = js.undefined,
                bodyStyle: js.UndefOr[js.Dictionary[js.Any]] = js.undefined) {
  def toJS: Object with Dynamic = {
    val p = js.Dynamic.literal()
    title.foreach { x =>
      p.updateDynamic("title")(x.asInstanceOf[js.Any])
    }
    extra.foreach { x =>
      p.updateDynamic("extra")(x.asInstanceOf[js.Any])
    }
    bordered.foreach { x =>
      p.updateDynamic("bordered")(x)
    }
    bodyStyle.foreach { x =>
      p.updateDynamic("bodyStyle")(x)
    }
    p
  }

  def apply(children: ReactNode*): ReactComponentU_ = {
    val f =
      React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.antd.Card)
    f(toJS, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
开发者ID:mdedetrich,项目名称:scalajs-antdesign,代码行数:36,代码来源:Card.scala


示例17: Panel

//设置package包名称以及导入依赖的类
package example.components

import japgolly.scalajs.react.{ReactComponentB, ReactNode}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._


object Panel {

  case class Props(heading: String)

  val component = ReactComponentB[Props]("Panel")
    .renderPC((_, p, c) =>
      <.div(
        <.div(p.heading),
        <.div(c)
      )
    ).build

  def apply(props: Props, children: ReactNode*) = component(props, children: _*)
  def apply() = component
} 
开发者ID:cdiniz,项目名称:play-scalajs-react,代码行数:23,代码来源:Panel.scala


示例18: MainMenu

//设置package包名称以及导入依赖的类
package console.components

import japgolly.scalajs.react.extra.OnUnmount
import japgolly.scalajs.react.extra.router.RouterCtl
import japgolly.scalajs.react.vdom.all.{className, li, ul}
import japgolly.scalajs.react.{BackendScope, ReactComponentB, ReactNode}
import console.JsApplication.{ClusterMapRoute, DashboardRoute, Route}
import console.style.{GlobalStyles, Icon}
import console.style.Icon.Icon
import japgolly.scalajs.react.vdom.all._
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^.<

import scalacss.ScalaCssReact._

object MainMenu {

  @inline private def style = GlobalStyles.bootstrapStyles

  case class Props(ctl: RouterCtl[Route], currentRoute: Route)

  case class MenuItem(label: (Props) => ReactNode, icon: Icon, location: Route)

  class MainMenuBackend(t: BackendScope[Props, Unit]) extends OnUnmount {
    val menuItems = Seq(
      MenuItem(_ => "Metrics", Icon.dashboard, DashboardRoute),
      MenuItem(_ => "Clusters", Icon.circle, ClusterMapRoute))

    def render(props: Props) = {
      <.ul(style.navbar)(
        for (item <- menuItems) yield {
          <.li(
            (props.currentRoute == item.location) ?= (className := "active"),
            props.ctl.link(item.location)(item.icon, " ", item.label(props))
          )
        }
      )
    }
  }

  private val MainMenu = ReactComponentB[Props]("MainMenu")
    .renderBackend[MainMenuBackend]
    .build

  def apply(props: Props) = MainMenu(props)
} 
开发者ID:haghard,项目名称:akka-cluster-console,代码行数:47,代码来源:MainMenu.scala


示例19: Divider

//设置package包名称以及导入依赖的类
package scalajs.semanticui.elements.divider

import japgolly.scalajs.react.{ReactComponentB, ReactNode}
import japgolly.scalajs.react.vdom.prefix_<^._

object Divider {
  case class Props(vertical: Boolean = false,
                   horizontal: Boolean = false,
                   inverted: Boolean = false,
                   fitted: Boolean = false,
                   hidden: Boolean = false,
                   section: Boolean = false,
                   clearing: Boolean = false)

  def component = ReactComponentB[Props]("Divider")
    .renderPC((_, p, c) =>
      <.div(
        ^.cls := "ui divider",
        ^.classSet(
          "vertical"   -> p.vertical,
          "horizontal" -> p.horizontal,
          "inverted"   -> p.inverted,
          "fitted"     -> p.fitted,
          "hidden"     -> p.hidden,
          "section"    -> p.section,
          "clearing"   -> p.clearing
        ),
        c
      )
    ).build

  def apply(children: ReactNode*) = component(Props(), children: _*)
  def apply(p: Props, children: ReactNode*) = component(p, children: _*)
} 
开发者ID:cquiroz,项目名称:scalajs-react-semantic-ui,代码行数:35,代码来源:Divider.scala


示例20: IconExample

//设置package包名称以及导入依赖的类
package scalajs.semanticui.elements.icon

import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.{ReactComponentB, ReactNode}

object IconExample {
  case class Props(header: String, description: String, inverted: Boolean = false)

  def component = ReactComponentB[Props]("IconExample")
    .stateless
    .renderPC((_, p, c) =>
      <.div(
        ^.cls := "example",
        <.h4(
          ^.cls := "ui header",
          p.header),
        <.p(p.description),
        if (p.inverted) <.div(
          ^.cls := "ui inverted segment",
          c) else c
      )
    ).build

  def apply(p: Props, children: ReactNode*) = component(p, children: _*)
} 
开发者ID:cquiroz,项目名称:scalajs-react-semantic-ui,代码行数:26,代码来源:IconExample.scala



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Scala TargetApi类代码示例发布时间:2022-05-23
下一篇:
Scala OK类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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