* 描述问题
参考教程:https://docs-cn.nocobase.com/plugin-samples/block/block-carousel#7-实现-schema-settings-items
实现发现:
import { SchemaSettingsItemType, useDesignable, } from "@nocobase/client";
import { useFieldSchema } from '@formily/react';
import { BlockNameLowercase } from "../../constants";
import { useT } from "../../locale";
export const imagesSchemaSettingsItem: SchemaSettingsItemType = {
name: 'images',
type: 'actionModal',
useComponentProps() {
const filedSchema = useFieldSchema();
const { deepMerge } = useDesignable();
const t = useT();
return {
title: t('Edit Images'),
schema: {
type: 'object',
title: t('Edit Images'),
properties: {
src: {
title: t('Images'),
type: 'string',
default: filedSchema['x-decorator-props'][BlockNameLowercase]?.images ?? [],
'x-decorator': 'FormItem',
'x-component': 'Upload.Attachment',
'x-component-props': {
action: 'attachments:create',
multiple: true
},
},
},
},
onSubmit({ src: images }: any) {
deepMerge({
'x-uid': filedSchema['x-uid'],
'x-decorator-props': {
...filedSchema['x-decorator-props'],
[BlockNameLowercase]: {
...filedSchema['x-decorator-props']?.[BlockNameLowercase],
images,
},
},
})
}
};
},
};
点击时候发现并没有出现上传图片弹窗,我尝试使用官方示例但是也没有弹窗。
* 运行环境
- NocoBase 版本:1.6.4
- 数据库种类与版本: mysql 8.0
- 操作系统: Windows
-浏览器及版本:谷歌浏览器134.0.6998.178
- 部署方式:源码部署
- Docker 镜像版本:
- NodeJS 版本:v22.12.0
如何重现
本地新建一个yarn pm create @nocobase-sample/plugin-block-carousel
然后将官方代码的/plugin-block-carousel的src直接粘贴进去
预期行为
我希望能够弹窗上传端口
截图
日志
点击时候浏览器控制台没有报错,后台也没有日志出现