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

support property validate and correct #8

Closed
Javey opened this issue Jul 26, 2018 · 2 comments
Closed

support property validate and correct #8

Javey opened this issue Jul 26, 2018 · 2 comments

Comments

@Javey
Copy link
Owner

Javey commented Jul 26, 2018

Support validate and correct property like bellow:

class A extends Intact {
    static propTypes = {
        show: Boolean,
        name: {
            type: Number,
            fix: (value) => {
                return Number(value);
            }
        }
}
@Javey
Copy link
Owner Author

Javey commented Aug 3, 2018

The fix method is complex. Because it has changed the original property, when the component has received a invalid value again, it may lead to infinite loop. On the other hand, we maybe not only change one property but also set some other states.

Let the $receive event trigger on init is good a choice.

@Javey
Copy link
Owner Author

Javey commented Aug 7, 2018

Support validate enumerated type like bellow:

static propTypes = {
    type: ['default', 'primary', 'danger']
}

@Javey Javey closed this as completed in 594fc58 Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant