element-pro-components icon indicating copy to clipboard operation
element-pro-components copied to clipboard

array 类型报错is not a string

Open vine05 opened this issue 1 year ago • 3 comments

Describe the bug

2023-12-11 rules

UI 和 rules 如图。 填了array里头的内容,点击提交的时候报错说这个is not a string.

Related version

element-pro-component: 1.2.12 vue: 3.3.4

Link to minimal reproduction

No response

Steps to Reproduce the Bug

Create a array type in form. Input value. Click save.

Expected behavior

Save succeed.

Additional context

No response

vine05 avatar Dec 11 '23 02:12 vine05

我没有复现这个问题,你可以参考文档中的 Demo

tolking avatar Dec 15 '23 08:12 tolking

我把这个array的required删掉,rules里已经没有它了,但是还是报同样的错误……疯了TAT

vine05 avatar Jan 05 '24 06:01 vine05

我找到了复现的办法!以及不复现的实现! 就是一个空的rules!

我用以下这个column和form data可以稳定复现:

<pro-form
    v-model="tempForm"
    :columns="tempColumns"
    @submit="tempSubmit"
  />


setup () {
    const tempForm = ref({})
    const tempColumns = defineFormColumns([
      {
        children: [{
          props: {
            data: [{
              value: 'SKIP',
              label: 'SKIP '
            }],
            title: 'An enumeration.'
          },
          label: 'ButtonType',
          component: 'pro-select',
          prop: 'button_type'
        }],
        label: 'Buttons222',
        rules: {}, /**问题所在!!只要加上这一行,就会validation失败,删除就pass!可以运行了!但是这个是不是Bug呢?**
        prop: 'buttons'
      }
    ])
    const tempSubmit = defineFormSubmit((done, isValid, invalidFields) => {
      console.log(tempForm.value, isValid, invalidFields)
      setTimeout(() => {
        done()
      }, 1000)
    })
    return { tempColumns, tempForm, tempSubmit }
  },

vine05 avatar Jan 05 '24 07:01 vine05