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

[Field] 使用mobx状态管理器时部分场景更新字段仍无法触发render函数问题 #537

Open
rookie125 opened this issue May 18, 2021 · 0 comments
Labels
bug 问题

Comments

@rookie125
Copy link
Contributor

如何复现
---描述一下问题
业务场景中使用了mobx后导致Field内部调用setState无法触发render函数更新。

复现源码:

import React from 'react';
import { Field } from 'cloud-react';
import { observer } from 'mobx-react';

@observer
export default class DEMO extends React.Component {
    field = new Field(this)

    onUpdate = () => {
        this.field.setValue('test', '我更新了');
    }

    render() {
        return (
            <>
                <input {...this.field.init('test')} />
                <button onClick={this.onUpdate}>更新</button>
            </>
        );
    }
}

期望的结果
点击更新按钮后输入框中内容变成我更新了

截图

使用环境

@rookie125 rookie125 added the bug 问题 label May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 问题
Projects
None yet
Development

No branches or pull requests

1 participant