How to use the @alicloud/console-components.Field.useField function in @alicloud/console-components

To help you get started, we’ve selected a few @alicloud/console-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aliyun / alibabacloud-console-components / packages / component / src / components / field / demo / demo4.js View on Github external
const Demo4 = () => {
  const myField = Field.useField()

  const { init, getError, setError, setErrors } = myField
  return (
    
      <input>
      <br>
github aliyun / alibabacloud-console-components / packages / component / src / components / field / demo / demo10.js View on Github external
const Demo10 = () => {
  const myField = Field.useField({
    parseName: true,
    values: {
      objWithDefaults: {
        a: 1,
        b: 2,
      },
    },
  })

  const onGetValue = () => {
    console.log(myField.getValues())
  }

  const onSetValue = () => {
    myField.setValues({
      obj: {
github aliyun / alibabacloud-console-components / packages / component / src / components / field / demo / demo7.js View on Github external
const Demo7 = () =&gt; {
  const myField = Field.useField({
    deepReset: true,
  })
  const { init } = myField

  return (
    <div>
      <select style="{layout}">
        jack
        lucy
        
          disabled
        
        hugohua
      </select>
      <br>
</div>
github aliyun / alibabacloud-console-components / packages / component / src / components / field / demo / demo8.js View on Github external
const Demo8 = () =&gt; {
  const myField = Field.useField()
  const { init } = myField

  return (
    <div>
      
        checked
      
      <br>
      
        defaultChecked
      
      <br>
      </div>
github aliyun / alibabacloud-console-components / packages / component / src / components / field / demo / demo3.js View on Github external
const Demo3 = () => {
  const myField = Field.useField({
    onChange: (name, value) => {
      console.log(myField.getValues())
      switch (name) {
        case 'input':
          myField.setValue('sync', `change to: ${value}`)
          break
        case 'select':
          myField.setValue('sync', `${value} is coming`)
          break
        case 'range':
          myField.setValue('sync', ` (${value.join(',')}) ready`)
          break
      }
    },
  })
github aliyun / alibabacloud-console-components / packages / component / src / components / field / demo / demo2.js View on Github external
const Demo2 = () =&gt; {
  const myField = Field.useField()
  const { init } = myField
  return (
    <div>
      <input value=""> {
            if (value.match(/##/)) {
              return value
            }
            return `## title-${value}`
          },
        })}
      /&gt;
      <button type="primary"> {</button></div>
github aliyun / alibabacloud-console-components / packages / component / src / components / form / demo / demo6.js View on Github external
const Demo6 = () =&gt; {
  const myField = Field.useField()
  const { init } = myField

  return (
    <form>
      
        <p>
          The quick brown fox jumps over the lazy dog.
        </p>
        <p>
          <a href="#">Link</a>
        </p>
      
      
        }
          align="r"</form>
github aliyun / alibabacloud-console-components / packages / component / src / components / form / demo / demo11.js View on Github external
const Demo11 = () => {
  const myField = Field.useField()

  const userExists = (rule, value) => {
    return new Promise((resolve, reject) => {
      if (!value) {
        resolve()
      } else {
        setTimeout(() => {
          if (value === 'frank') {
            reject([new Error('Sorry, this username is already occupied.')])
          } else {
            resolve()
          }
        }, 500)
      }
    })
  }