hellof2e / quark-design

Browser-native component library, framework-agnostic, base on web components.(移动端 UI 组件库,无框架,即插即用。)
https://quark-ecosystem.github.io/quarkd-docs
MIT License
1.9k stars 189 forks source link

Checkbox must be passed 'onChange', otherwise an error will be reported during compilation #219

Closed zhaoyiming0803 closed 1 year ago

zhaoyiming0803 commented 1 year ago

A description of the problem, steps to reproduce, or with code samples, can be hosted on a GitHub repository with a link to the repository. (问题说明,重现步骤,或附上代码示例,可存放 GitHub 仓库并提供仓库链接。)

My codes is following:

import { Checkbox, CheckboxGroup } from '@quarkd/quark-react'

function TestQuarkComponent () {
  const [groupValue, setGroupValue] = useState<string[]>(['苹果', '橘子'])

  const onChangeCheckbox = (e: any) => {
    console.log('on change checkbox: ', e)
    setGroupValue(() => e.detail.value)
  }

  return <>
    <CheckboxGroup value={groupValue.join()} onChange={onChangeCheckbox}>
      <Checkbox name="apple"></Checkbox>
      <Checkbox name="warning">橘子</Checkbox>
      <Checkbox name="banana">香蕉</Checkbox>
    </CheckboxGroup>
  </>
}

Screenshot of error reporting

compilation-error

sanqi-med commented 1 year ago

1.0.39 has fixed this issue. https://github.com/hellof2e/quark-design/commit/d4f0e1ce0795372baf2f1d1f2ea0029ba7115b86