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

请教下编辑器扩展-定制属性配置这块的问题 #564

Open
spierBoy opened this issue Jan 9, 2024 · 7 comments
Open

请教下编辑器扩展-定制属性配置这块的问题 #564

spierBoy opened this issue Jan 9, 2024 · 7 comments
Labels
question Further information is requested

Comments

@spierBoy
Copy link

spierBoy commented Jan 9, 2024

我的需求是:点击特定的业务组件,编辑器中右侧属性配置栏增加一个特定的tab分页(不是目前的属性、样式、事件和高级四个)
看了下编辑器扩展这块的文档,没太看明白,不知道该怎么干预propsService.fillConfig来实现自定义,大佬有时间可否讲解下,配合实例更佳,非常感谢!

@jia000
Copy link
Collaborator

jia000 commented Jan 9, 2024

propsService.usePlugin({
  /**
   * result为生成好的默认配置
   * config为组件中定义好的配置
   */
  afterFillConfig(result, config) {
    return config
  }
});

@jia000
Copy link
Collaborator

jia000 commented Jan 9, 2024

可以看fillConfig的实现

export const fillConfig = (config: FormConfig = []) => [

就是要在afterFillConfig里重新实现上面这个函数

@spierBoy
Copy link
Author

spierBoy commented Jan 10, 2024

感谢大佬回复,再请教下:
目前我在看文档的教程:DSL解析那个章节的例子,遇到了个这样一个问题:在文档组件库开发那个章节中写了一个Test的组件,我使用这个组件时发现定义的formConfig和initValue没生效,下面是部分代码
在editor-runtime 中定义组件并且全局注册
textCard.vue

import textCard from './src/index.vue';

export { default as config } from './src/formConfig';
export { default as value } from './src/initValue';


export default textCard;

在hello-editor的App.vue中使用,componentGroupList

{
    title: '基础组件',
    items: [
      {
        icon: 'https://vfiles.gtimg.cn/vupload/20220614/9cc3091655207317835.png',
        text: 'HelloWorld',
        type: 'hello-world',
      },
      {
        icon: 'https://vfiles.gtimg.cn/vupload/20220614/9cc3091655207317835.png',
        text: '测试文本',
        type: 'text-card',
      },
    ],
  },

编辑器查看config,发现只有一个text,定义组件时的value和config并未挂载到text-card中,请请教下大佬是啥原因呢,在哪里注入的value和config

@jia000
Copy link
Collaborator

jia000 commented Jan 10, 2024

需要配置propsconfigspropsvalues

@vxhly
Copy link

vxhly commented Mar 7, 2024

这一块,我也挺希望能有多一点的例子,文档有的时候看不懂😂

@vxhly
Copy link

vxhly commented Mar 7, 2024

@spierBoy 能否给一个联系方式交流一下,因为我也有这个需求

@jia000 jia000 added the question Further information is requested label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants