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的Select属性怎么设置值 #543

Open
ubadly opened this issue Sep 27, 2024 · 0 comments
Open

Form的Select属性怎么设置值 #543

ubadly opened this issue Sep 27, 2024 · 0 comments

Comments

@ubadly
Copy link

ubadly commented Sep 27, 2024

{
    field: 'account_type',
    label: '账号类型',
    component: 'Select',
    formItemProps: {
      rules: [required('账号类型不能未空')]
    },
    componentProps: {
      placeholder: '请选择账号类型',
      options: [
        {
          label: '服务号',
          value: '1'
        },
        {
          label: '订阅号',
          value: '2'
        }
      ]
    }
  }

类似这样
正常手动选择的时候 获取表单数据可以拿到对应的value

然后有个修改数据的功能

使用setValues方法设置表单数据,其他的输入input类型的可以直接修改成功
然后这种配置了options的则会直接设置成value 也就是本来应该显示服务号的却显示成了1

如果设置values的时候写成

setValues({account_type:'服务号'})

不做改动的时候直接提交表单却会变成服务号,期待的是1
image

主要是Select这种的属性值如何设置value 1 显示成 服务号 提交的时候也能是1

我前端不是太熟练 还请指教

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

1 participant