Skip to content

Conversation

@XinJiangQingMang
Copy link

@XinJiangQingMang XinJiangQingMang commented Mar 12, 2019

<a-cascader :options="options" @change="onChange" :defaultValue="[2,3]" /> options:[{ "value": 2, "pid": 1, "name": "dashboard", "label": "控制台", "children": [{ "value": 3, "pid": 2, "name": "Workplace", "label": "工作台", }] }]

First of all, thank you for your contribution! 😄

New feature please send pull request to feature branch, and rest to master branch.
Pull request will be merged after one of collaborators approve.
Please makes sure that these form are filled before submitting your pull request, thank you!

[中文版模板 / Chinese template]

This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

What's the background?

  1. Describe the source of requirement.
    tree结构如果采用id,pid标记子级父级,常规options的value类型为int,这里不适合限制成string类型 会引起报错,还有defaultValue和Value 是一样的道理。
  2. Resolve what problem.
    更改options 以及defaultValue value的约束类型
  3. Related issue link.
    cascader 组件options数据中的value 为数字时会报错 #567

API Realization (Optional if not new feature)

  1. Basic thought of solution and other optional proposal.
  2. List final API realization and usage sample.
  3. GIF or snapshot should be provided if includes UI/interactive modification.

What's the effect? (Optional if not new feature)

  1. Does this PR affect user? Which part will be affected?
  2. What will say in changelog?
  3. Does this PR contains potential break change or other risk?

Changelog description (Optional if not new feature)

  1. English description
  2. Chinese description (optional)

Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Additional Plan? (Optional if not new feature)

If this PR related with other PR or following info. You can type here.

tree结构如果采用id,pid标记子级父级,常规options的value类型为int,这里不适合限制成string类型 会引起报错,还有defaultValue和Value 是一样的道理。 ```js <a-cascader :options="options" @change="onChange" :defaultValue="[2,3]" /> options:[{ "value": 2, "pid": 1, "name": "dashboard", "label": "控制台", "children": [{ "value": 3, "pid": 2, "name": "Workplace", "label": "工作台", }] }] ```
@netlify
Copy link

netlify bot commented Mar 12, 2019

Deploy preview for ant-desing-vue processing.

Building with commit 46f16e0

https://app.netlify.com/sites/ant-desing-vue/deploys/5c876470b4682200085b7b3c

@codecov
Copy link

codecov bot commented Mar 12, 2019

Codecov Report

Merging #575 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## master #575 +/- ## ======================================= Coverage 87.22% 87.22% ======================================= Files 145 145 Lines 4808 4808 Branches 1418 1418 ======================================= Hits 4194 4194 Misses 571 571 Partials 43 43
Impacted Files Coverage Δ
components/cascader/index.jsx 83.63% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aac5e56...46f16e0. Read the comment docs.


const CascaderOptionType = PropTypes.shape({
value: PropTypes.string,
value: PropTypes.any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PropTypes.oneofType(String, Number)

options: PropTypes.arrayOf(CascaderOptionType).def([]),
/** 默认的选中项 */
defaultValue: PropTypes.arrayOf(PropTypes.string),
defaultValue: PropTypes.arrayOf(PropTypes.any),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PropTypes.arrayOf(PropTypes.oneofType(String, Number))

defaultValue: PropTypes.arrayOf(PropTypes.string),
defaultValue: PropTypes.arrayOf(PropTypes.any),
/** 指定选中项 */
value: PropTypes.arrayOf(PropTypes.string),
Copy link
Member

@tangjinzhou tangjinzhou Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PropTypes.arrayOf(PropTypes.oneofType(String, Number))

disabled: PropTypes.bool,
children: PropTypes.array,
key: PropTypes.string,
key: PropTypes.any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PropTypes.oneofType(String, Number)

@XinJiangQingMang XinJiangQingMang deleted the patch-1 branch March 19, 2019 10:00
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants