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

formUtils.getUiOptions处理fui:xxx 参数的时候报错 #371

Open
gitAda16 opened this issue Nov 19, 2024 · 1 comment
Open

formUtils.getUiOptions处理fui:xxx 参数的时候报错 #371

gitAda16 opened this issue Nov 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@gitAda16
Copy link

vue和ui框架

vue2+elementui

问题描述

自定义field中调用formUtils.getUiOptions报错 如下
error.js:13 TypeError: Cannot read properties of undefined (reading 'split') at Br (vueJsonSchemaForm.esm.min.js:4:121853) at vueJsonSchemaForm.esm.min.js:4:123740 at Array.reduce (<anonymous>) at vueJsonSchemaForm.esm.min.js:4:123458 at Array.map (<anonymous>) at Jr (vueJsonSchemaForm.esm.min.js:4:123424) at Object.Zr [as getUiOptions] (vueJsonSchemaForm.esm.min.js:4:124489) at VueComponent.created (DnnInfoSchema.vue:326:1) at invokeWithErrorHandling (vue.runtime.esm.js:3017:1) at callHook$1 (vue.runtime.esm.js:4031:1)

如何复现

const fromSchema = {
      type: 'array',
      'ui:field': 'field-test',
      'ui:title': '信息列表',
      'fui:addable': (parent, root, prop) => {
        return !this.disabled
      },
      'fui:removable': (parent, root, prop) => {
        return !this.disabled
      },
      'ui:options': {
        sortable: false,
        showIndexNumber: true
      },
      items: {
        type: 'object',
        properties: {
          count: { type: 'number', title: '规格数量' }
        }
      }
    }
    const options = formUtils.getUiOptions({
      schema: fromSchema,
      uiSchema: {}
    })

期望的结果

发现原因是没有传curNodePath导致的,formUtils.js 中getUserUiOptions在处理fui:xxx 参数的时候没有判断curNodePath是否存在

@lljj-x lljj-x added the bug Something isn't working label Nov 21, 2024
@lljj-x
Copy link
Owner

lljj-x commented Nov 21, 2024

应该是类型缺失了,我补充上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants