Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react^16.13.1安装amis6.2.2版本后,页面使用ConditionBuilder组件,配置data字段不生效。求助 #9727

Closed
1462062613 opened this issue Mar 5, 2024 · 1 comment

Comments

@1462062613
Copy link

1462062613 commented Mar 5, 2024

想要在react中使用amis。配置字段属性除了onchange都不生效

import React from "react"
import 'amis/lib/themes/antd.css'
import 'amis/lib/themes/cxd.css'
import 'amis/lib/helper.css'

import { ConditionBuilder } from 'amis';



const App = () => {
  const formData = {
    "type": "page",
    "title": "搜索",
    "body": {
      "type": "form",
      "controls": [
        {
          "type": "condition-builder",
          "label": "查询条件",
          "name": "conditions",
          "fields": [
            {
              "label": "关键词",
              "type": "text",
              "name": "keyword"
            },
            {
              "label": "最小数量",
              "type": "number",
              "name": "minQuantity"
            },
            {
              "label": "状态",
              "type": "select",
              "name": "status",
              "options": [
                { "label": "启用", "value": "active" },
                { "label": "禁用", "value": "inactive" }
              ]
            }
          ]
        }
      ]
    }
  };

  console.log('ConditionBuilder config:', formData);

  const handleSearch = (values) => {
    console.log(111111111)
    // 处理搜索条件的逻辑
    console.log("搜索条件:", values);
    // 在这里你可以将搜索条件应用到数据过滤或者发起网络请求等
  };

  return (
    <ConditionBuilder
    data={formData}
    placeholder="请设置查询条件"
    />
  )
}

export default App
@2betop
Copy link
Collaborator

2betop commented Mar 5, 2024

如果直接用 ui 组件,得看 props 说明,输入输出对应的是 valueonChange

@2betop 2betop closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants