用的是vue版本,JSON Schema 开发模式。怎么写能兼容组件的slot呢 #1395
Answered
by
MisicDemone
qq1037305420
asked this question in
Q&A [2.x]
-
提前谢谢大佬们想实现下面这个效果 需要把一个值传入 append 插槽里面 const schema = {
type: 'object',
properties: {
name: {
required: true,
name: 'name',
title: '名称',
type: 'void',
'x-component': 'Row',
'x-component-props': {},
'x-decorator': 'ElFormItem',
'x-decorator-props': {},
properties: {
firstName: {
type: 'string',
required: true,
'x-decorator': 'Col',
'x-decorator-props': { span: 11, offset: 1 } as Col,
'x-component': 'Input',
'x-component-props': {
placeholder: '姓'
}
},
lastName: {
type: 'string',
required: true,
'x-decorator': 'Col',
'x-decorator-props': { span: 11, offset: 1 } as Col,
'x-component': 'Input',
'x-component-props': {
placeholder: '名'
},
properties: {
appendText: {
type: 'void',
'x-component': 'Input',
'x-component-props': {
slot: 'append'
}
}
}
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
MisicDemone
May 18, 2021
Replies: 2 comments 8 replies
-
建个issue吧,这个当前是没考虑到的。临时解决的话,在appendText的外层套一个void类型的functional component,用于把子组件放到父组件的指定插槽,不知道可不可行 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
MisicDemone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
可参考
https://vue.formilyjs.org/questions/#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E5%85%B7%E5%90%8D%E6%8F%92%E6%A7%BD