Skip to content

依赖某个data(state)控制Field的显示隐藏 #1390

Answered by dahui4dev
oo101001 asked this question in Q&A [2.x]
Discussion options

You must be logged in to vote

用 form 的 effect 控制呢?

const form = createForm({
  effects: () => {
    onFieldValueChange("aa", (field, form) => {
      form.setFieldState("bb", (state) => {
        state.visible = field.value;
      });
    });
  },
});

或者 这样也行吧?

form
    .query("aa")
    .take()
    .setState((state) => {
      state.visible = value[0] === "custom";
    });

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@oo101001
Comment options

Comment options

You must be logged in to vote
2 replies
@oo101001
Comment options

@janryWang
Comment options

Answer selected by oo101001
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants