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

Form组件resetFields没有设置为defaultValue并重新发起请求 #54

Closed
enjkvbej opened this issue Oct 24, 2020 · 2 comments
Closed

Comments

@enjkvbej
Copy link

async function resetFields(): Promise<any> {
      const { resetFunc } = unref(getProps);
      resetFunc && isFunction(resetFunc) && (await resetFunc());
      const formEl = unref(formElRef);
      if (!formEl) return;
      Object.keys(formModel).forEach((key) => {
        (formModel as any)[key] = undefined;
      });
      setFieldsValue(unref(defaultValueRef));  // 新加
      emit('reset', toRaw(formModel));
      handleSubmit(); // 新加
    }

Expected behaviour

点击重置按钮,筛选条件恢复默认或清空,并发起请求

My resolution

代码如上

@anncwb
Copy link
Collaborator

anncwb commented Oct 25, 2020

已复现,handleSubmit会加一个参数来控制。并不一定重置都需要重新执行submit

@anncwb
Copy link
Collaborator

anncwb commented Oct 25, 2020

已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants