Skip to content

plugin-block-carousel 编辑图片并没有出现图片样例 #22

@JAVA-LW

Description

@JAVA-LW

本地版本 1.6.4 ,https://docs-cn.nocobase.com/plugin-samples/block/block-carousel
参考这个教程发现,

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,
        },
      },
    })
  }
};

},
};

原图这个也没有出现上传图片,点击但是什么都没有发生

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions