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

Picker组件建议增加FieldNamesType 属性 #6553

Open
houguang opened this issue Feb 23, 2024 · 0 comments
Open

Picker组件建议增加FieldNamesType 属性 #6553

houguang opened this issue Feb 23, 2024 · 0 comments
Labels

Comments

@houguang
Copy link

Version of antd-mobile

5.34.0

What is this feature about?

//地区选择
  const [area, setArea] = useState([] as PickerColumn[])
  const [selectedArea, setSelectedArea] = useState("")
  const [areaPickerState, {toggle: areaToggle}] = useToggle(false);
  const fetchArea = (course_id: number) => {
    request.get("/m/area", {params: {course_id}}).then((res) => {
      const data = [] as PickerColumn;
      // 配置FieldNamesType 参数后这里就不是遍历转换字段名称
      res.data.map((item: Area, index: number) => {
        data[index] = {label: item.name, value: item.id};
      })
      setArea([data])
    })
  }

功能类似(https://arco.design/react/components/cascader#fieldnamestype)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant