Skip to content

feat: add examples: form-upload #5955

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

Merged
merged 4 commits into from
Apr 17, 2025
Merged

feat: add examples: form-upload #5955

merged 4 commits into from
Apr 17, 2025

Conversation

yuhldr
Copy link
Contributor

@yuhldr yuhldr commented Apr 15, 2025

Description

如图,预览的例子中,表单组建添加了文件上传的示例

图片

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features

    • Introduced file upload functionality in the form, allowing users to upload image files (.png, .jpg, .jpeg) with progress tracking and error handling.
    • Added a new API endpoint for handling file uploads.
    • Displayed uploaded file URLs and provided clear feedback on upload success or failure.
  • Localization

    • Added new English and Chinese translations for upload-related messages.

@yuhldr yuhldr requested review from anncwb, vince292007, mynetfan, jinmao88 and a team as code owners April 15, 2025 03:52
Copy link
Contributor

coderabbitai bot commented Apr 15, 2025

Walkthrough

A new file upload feature has been implemented across the backend mock API and frontend playground. The backend mock now exposes an /api/upload endpoint that verifies access tokens and returns a static image URL upon success. The playground frontend introduces a new upload_file utility for uploading files, updates the form schema to include an image upload field, and enhances the form submission logic to handle upload results, display localized messages, and process both successful and failed uploads. English and Chinese localization files are updated with new entries for upload-related messages, and the API route list is updated to include the new upload endpoint.

Changes

File(s) Change Summary
apps/backend-mock/api/upload.ts Added a new API endpoint handler for /api/upload that verifies access tokens and returns a static image URL.
apps/backend-mock/routes/[...].ts Added /api/upload to the list of API routes in the HTML response.
playground/src/api/examples/upload.ts Added upload_file function to handle file uploads with progress, error, and success callbacks.
playground/src/locales/langs/en-US/examples.json
playground/src/locales/langs/zh-CN/examples.json
Added new localization keys for upload error, upload URLs, file label, and upload image button text in English and Chinese.
playground/src/views/examples/form/basic.vue Updated form schema to add an image upload field, integrated upload_file, and enhanced submission logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend (Form)
    participant upload_file API
    participant Backend /api/upload

    User->>Frontend (Form): Selects image and submits form
    Frontend (Form)->>upload_file API: Calls upload_file({ file, ... })
    upload_file API->>Backend /api/upload: Uploads file with token
    Backend /api/upload-->>upload_file API: Returns static image URL (if authorized)
    upload_file API-->>Frontend (Form): onSuccess or onError callback
    Frontend (Form)->>Frontend (Form): Processes upload results
    Frontend (Form)-->>User: Shows success or error message
Loading

Suggested reviewers

  • jinmao88

Poem

A bunny with files to send,
Hops to the backend—let uploads ascend!
With tokens checked and URLs in tow,
Success or error, the user will know.
Now forms can handle images bright,
In every language, left and right!
🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yuhldr yuhldr mentioned this pull request Apr 15, 2025
3 tasks
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
apps/backend-mock/api/upload.ts (1)

9-13: Consider handling actual file upload rather than returning a static URL.

The current implementation returns a fixed image URL instead of actually processing uploaded files. While sufficient for demonstration purposes, consider enhancing this to process real file uploads for production use.

Also, the commented-out error response on line 12 should be removed or implemented properly if error scenarios testing is needed.

 return useResponseSuccess({
   url: 'https://unpkg.com/@vbenjs/[email protected]/source/logo-v1.webp',
 });
-// return useResponseError("test")
playground/src/api/examples/upload.ts (1)

1-25: Good implementation of the upload functionality.

The upload_file function provides a clean interface for handling file uploads with proper progress tracking, success callbacks, and error handling.

However, I have a few suggestions for improvement:

  1. The onSuccess callback accepts data: any which limits type safety. Consider defining a specific response type.
  2. The progress reporting is very basic (only 0% and 100%). If the underlying requestClient.upload supports real-time progress updates, consider passing them through.
-  onSuccess?: (data: any, file: File) => void;
+  onSuccess?: (data: { url: string, [key: string]: any }, file: File) => void;
playground/src/views/examples/form/basic.vue (2)

357-376: Solid upload result handling with proper status checking.

The code effectively separates successful and failed uploads, giving appropriate user feedback through localized messages.

Consider adding these safety improvements:

  1. Use optional chaining when accessing response.url in case the structure varies:
-  ...doneFiles.map((file) => file.response.url),
+  ...doneFiles.map((file) => file.response?.url || file.name),
  1. Avoid type casting with a more specific form values interface:
-function onSubmit(values: Record<string, any>) {
-  const files = toRaw(values.files) as UploadFile[];
+interface FormValues {
+  files: UploadFile[];
+  [key: string]: any;
+}
+
+function onSubmit(values: FormValues) {
+  const files = toRaw(values.files);

377-381: Consider consolidating success messages.

The code shows two success messages when uploads succeed: one for the upload URLs and another for form values. This might confuse users.

 if (failedFiles.length === 0) {
   message.success({
-    content: `${$t('examples.form.upload-urls')}: ${msg}`,
+    content: `${$t('examples.form.upload-urls')}: ${msg}\n${$t('examples.form.form-values')}: ${JSON.stringify(values)}`,
   });
+  return;
 } else {
   message.error({
     content: `${$t('examples.form.upload-error')}: ${msg}`,
   });
   return;
 }

-message.success({
-  content: `form values: ${JSON.stringify(values)}`,
-});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf7496f and 5563c22.

📒 Files selected for processing (6)
  • apps/backend-mock/api/upload.ts (1 hunks)
  • apps/backend-mock/routes/[...].ts (1 hunks)
  • playground/src/api/examples/upload.ts (1 hunks)
  • playground/src/locales/langs/en-US/examples.json (1 hunks)
  • playground/src/locales/langs/zh-CN/examples.json (1 hunks)
  • playground/src/views/examples/form/basic.vue (3 hunks)
🔇 Additional comments (4)
playground/src/locales/langs/en-US/examples.json (1)

21-23: Good addition of localization keys for the new upload feature.

The new localization entries support the file upload functionality with appropriate error and success messaging. The keys are descriptive and follow the existing naming convention.

apps/backend-mock/routes/[...].ts (1)

10-10: Properly added new upload API endpoint to the routes list.

The upload endpoint is now discoverable alongside other API routes in the mock service.

playground/src/locales/langs/zh-CN/examples.json (1)

24-26: Complete and consistent localization for both languages.

The Chinese translations are appropriate and match the English counterparts, ensuring a consistent user experience across languages.

apps/backend-mock/api/upload.ts (1)

1-8: Authentication handling is properly implemented.

The endpoint correctly verifies user authentication using JWT token before processing the upload request, enhancing security.

@bo-Chou
Copy link

bo-Chou commented Apr 15, 2025

是否有图片预览,最终可能这样会比较优雅,当然,我说的不仅是头像: #5448

@jinmao88
Copy link
Collaborator

机器人有一些优化 请调整一下

Copy link

changeset-bot bot commented Apr 15, 2025

⚠️ No Changeset found

Latest commit: 8f49c23

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@yuhldr
Copy link
Contributor Author

yuhldr commented Apr 15, 2025

机器人有一些优化 请调整一下

已调整

@yuhldr
Copy link
Contributor Author

yuhldr commented Apr 15, 2025

是否有图片预览,最终可能这样会比较优雅,当然,我说的不仅是头像: #5448

默认就支持 listType,以添加:点击设置表单值,可以看到

图片

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
playground/src/views/examples/form/basic.vue (1)

336-358: Upload component implementation looks good.

The Upload component is well configured with proper constraints (image types only, single file) and correctly uses the custom upload handler with appropriate display settings.

The previous review comments about file extension format and localization have been addressed correctly.

🧹 Nitpick comments (1)
playground/src/views/examples/form/basic.vue (1)

364-385: Well-implemented file upload handling logic.

The submission handler does a good job of:

  1. Separating successful uploads from failed ones
  2. Generating appropriate success/error messages
  3. Preventing form submission when uploads fail
  4. Transforming file objects to URLs for final submission

One small suggestion to enhance error handling:

- const failedFiles = files.filter((file) => file.status !== 'done');
+ const failedFiles = files.filter((file) => file.status !== 'done');
+ const errorMessages = failedFiles.map((file) => 
+   `${file.name}: ${file.error?.message || $t('examples.form.unknown-error')}`
+ );

This would provide more specific error information when available.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f227b44 and 8f49c23.

📒 Files selected for processing (1)
  • playground/src/views/examples/form/basic.vue (4 hunks)
🔇 Additional comments (2)
playground/src/views/examples/form/basic.vue (2)

2-15: Great job with well-organized import statements.

The necessary imports for file upload functionality are correctly organized, with proper type definitions (UploadFile), Vue utilities (toRaw), the custom upload handler, and localization function.


398-405: Good implementation of example file preset.

The form preset logic correctly demonstrates how to populate the file upload field with an existing file, which is helpful for edit scenarios where an image already exists.

@hgx98
Copy link

hgx98 commented Apr 17, 2025

这个是不是不能做成类似Textarea那种样式?就是Label在左上方对齐的。目前来看这个文件上传是左侧居中对齐的

@jinmao88 jinmao88 merged commit 4baec83 into vbenjs:main Apr 17, 2025
13 checks passed
@hgx98
Copy link

hgx98 commented Apr 17, 2025

这个是不是不能做成类似Textarea那种样式?就是Label在左上方对齐的。目前来看这个文件上传是左侧居中对齐的

image

@yuhldr
Copy link
Contributor Author

yuhldr commented Apr 17, 2025

这个是不是不能做成类似Textarea那种样式?就是Label在左上方对齐的。目前来看这个文件上传是左侧居中对齐的

image

可以问问ai,这个我没尝试过

YuchenWell added a commit to YuchenWell/vue-vben-admin that referenced this pull request Apr 19, 2025
Squashed commit of the following:

commit 79de6bc
Author: Netfan <[email protected]>
Date:   Thu Apr 17 22:23:05 2025 +0800

    fix: alert send wrong confirm state to beforeClose (vbenjs#5991)

    * 修复alert在按下Esc或者点击遮罩关闭时,可能发送错误的isConfirm状态

commit 14bd6dd
Author: Netfan <[email protected]>
Date:   Thu Apr 17 20:25:49 2025 +0800

    fix: destroyOnClose works within connectedComponent (vbenjs#5989)

    * 修复destroyOnClose没能销毁connectedComponent自身的问题

commit 7f269e0
Author: PIPEDREA_WZJ <[email protected]>
Date:   Thu Apr 17 14:01:39 2025 +0800

    Update tailwindcss.md (vbenjs#5602)

    tailwindcss最新的版本已经是v4.x,vben中使用的是3.x的tailwindcss。在未进行兼容前,会出现运行失败的问题

commit 4baec83
Author: yuh <[email protected]>
Date:   Thu Apr 17 14:00:46 2025 +0800

    feat: add examples: form-upload (vbenjs#5955)

    * feat: add examples: form-upload

    * fix: upload: accept and label

    * fix: upload: 设置表单值、图片预览

commit f7a4d13
Author: Netfan <[email protected]>
Date:   Wed Apr 16 14:11:04 2025 +0800

    fix: fixed arguments of callbacks in `formApi` (vbenjs#5970)

    * 修复 `handleValuesChange` 传递的参数不是处理后的表单值的问题

    * 修复 `handleReset` 未能传递正确参数的问题

commit 0936861
Author: Netfan <[email protected]>
Date:   Wed Apr 16 11:29:01 2025 +0800

    feat:  pass `fieldsChanged`  into the `handleValuesChange` callback function (vbenjs#5968)

    * fieldsChanged(已被改变值的字段名)将传入handleValuesChange回调函数

commit 3318d76
Author: ming4762 <[email protected]>
Date:   Wed Apr 16 11:28:36 2025 +0800

    perf: improve `destroyOnClose` for VbenModal (vbenjs#5964)

commit 8f3881e
Author: LinaBell <[email protected]>
Date:   Wed Apr 16 11:27:13 2025 +0800

    perf: `beforeClose` of drawer support promise (vbenjs#5932)

    * perf: the beforeClose function of drawer is consistent with that of modal

    * refactor: drawer test update

commit 5252480
Author: zhouda1fu <[email protected]>
Date:   Wed Apr 16 11:22:59 2025 +0800

    fix: missing await in department form(vbenjs#5967)

commit d18f561
Author: Netfan <[email protected]>
Date:   Tue Apr 15 20:52:23 2025 +0800

    docs: update alert and apiComponent docs (vbenjs#5961)

commit 333998b
Author: wyc001122 <[email protected]>
Date:   Tue Apr 15 20:51:38 2025 +0800

    fix: determine if scrollbar has been totally scrolled (vbenjs#5934)

    * 修复在系统屏幕缩放比例不为100%的情况下,滚动组件对是否已滚动到边界的判断可能不正确的问题

commit 3fb4fba
Author: ming4762 <[email protected]>
Date:   Tue Apr 15 18:49:57 2025 +0800

    fix: modal closing animation (vbenjs#5960)

commit c7e6210
Author: ming4762 <[email protected]>
Date:   Tue Apr 15 16:04:44 2025 +0800

    feat: `modal`&`drawer` support `center-footer` slot (vbenjs#5956)

commit d864085
Author: lztb <[email protected]>
Date:   Tue Apr 15 16:03:20 2025 +0800

    feat: vben-form添加arrayToStringFields属性 (vbenjs#5957)

    * feat: vben-form添加arrayToStringFields属性

    * feat: 修改handleArrayToStringFields和handleStringToArrayFields中嵌套数组格式的处理不一致

    ---------

    Co-authored-by: 米山 <[email protected]>

commit fcdc1a1
Author: Netfan <[email protected]>
Date:   Tue Apr 15 15:32:30 2025 +0800

    feat: add more expose methods for `apiComponent` (vbenjs#5958)

    * 为ApiComponent组件添加getOptions和getValue导出方法。

commit bf7496f
Author: Netfan <[email protected]>
Date:   Tue Apr 15 00:00:05 2025 +0800

    feat: add `useAlertContext` for Alert component (vbenjs#5947)

    * 新增Alert的子组件中获取弹窗上下文的能力

commit 9700150
Author: Netfan <[email protected]>
Date:   Mon Apr 14 19:56:52 2025 +0800

    fix: table actions in fixed column (vbenjs#5945)

commit f0e9e55
Author: Netfan <[email protected]>
Date:   Mon Apr 14 11:48:21 2025 +0800

    feat: alert support customize `footer` (vbenjs#5940)

    * Alert组件支持自定义footer

commit ff88274
Author: Netfan <[email protected]>
Date:   Mon Apr 14 11:18:33 2025 +0800

    fix: long navigation menu can be scrolled (vbenjs#5939)

    * 修复超长的导航菜单无法纵向滚动的问题

commit afce9dc
Author: ming4762 <[email protected]>
Date:   Sun Apr 13 23:02:07 2025 +0800

    perf: improve `destroyOnClose` for `VbenModal` (vbenjs#5935)

    * perf: 优化Vben Modal destroyOnClose,解决destroyOnClose=false,Modal依旧会被销毁的问题

    影响范围(重要):destroyOnClose默认为true,这会导致所有的modal都会默认渲染到body
    radix-vue Dialog组件默认会销毁挂载的组件,所以即使destroyOnClose=false,Modal依旧会被销毁的问题
    对于一些大表单重复渲染导致卡顿,ApiComponent也会频繁的加载数据

    * fix: modal closing animation

    ---------

    Co-authored-by: Netfan <[email protected]>

commit b5700bd
Author: ming4762 <[email protected]>
Date:   Sun Apr 13 20:03:18 2025 +0800

    perf: improve `autoSelect` of  `ApiComponent` (vbenjs#5936)

    * fix: 修复autoSelect不生效的问题,props.valueField已经被omit了

    * feat: ApiComponent autoSelect支持使用函数,可以满足灵活性要求更高的场景

commit a8c4786
Author: Netfan <[email protected]>
Date:   Sat Apr 12 14:02:35 2025 +0800

    feat: api-component support autoSelect prop (vbenjs#5931)

    * feat: api-component support autoSelect prop

    * docs: add version requirement

commit 2971ccc
Author: Netfan <[email protected]>
Date:   Sat Apr 12 13:41:40 2025 +0800

    docs: docs modal z-index fixed, update alert docs (vbenjs#5930)

commit 4a2c7b3
Author: Netfan <[email protected]>
Date:   Sat Apr 12 10:37:47 2025 +0800

    fix: alert animation (vbenjs#5927)

commit 36bf6fc
Author: Netfan <[email protected]>
Date:   Sat Apr 12 01:44:08 2025 +0800

    fix: builtin color change throttled in preference drawer (vbenjs#5924)

    修复偏好设置中的自定义主题色拖动选择颜色时页面会明显卡顿的问题

commit f46ec30
Author: Netfan <[email protected]>
Date:   Sat Apr 12 01:16:57 2025 +0800

    fix: theme mode follow the system only `auto` (vbenjs#5923)

    * 修复主题在未设置为auto时,仍然会跟随系统主题变化的问题。

commit 9bd5a19
Author: Netfan <[email protected]>
Date:   Sat Apr 12 00:59:56 2025 +0800

    fix: alert action button  focus, fixed vbenjs#5921 (vbenjs#5922)

    * 修复Alert组件的按钮焦点切换问题

commit 86da3ce
Author: zhang <[email protected]>
Date:   Wed Apr 9 16:16:56 2025 +0800

    chore: 导出框架自带的组件,方便独立页面使用 (vbenjs#5876)

commit 329a176
Author: Netfan <[email protected]>
Date:   Wed Apr 9 01:05:20 2025 +0800

    perf:  optimize bootstrap modules to speed up first-screen loading (vbenjs#5899)

    优化首屏加载速度

commit 9379093
Author: Netfan <[email protected]>
Date:   Tue Apr 8 20:28:50 2025 +0800

    feat: customizable table separator (vbenjs#5898)

    * 表格的分隔条支持定制背景色或完全移除

commit c9014d0
Author: ming4762 <[email protected]>
Date:   Tue Apr 8 20:27:03 2025 +0800

    perf: 优化关闭页面切换动画的tab切换性能 (vbenjs#5883)

commit ed26dca
Author: Netfan <[email protected]>
Date:   Tue Apr 8 16:31:41 2025 +0800

    chore: update pnpm-lock.yaml

commit 08c6496
Author: Netfan <[email protected]>
Date:   Tue Apr 8 14:56:40 2025 +0800

    chore: update deps

commit a8c5df3
Author: Netfan <[email protected]>
Date:   Tue Apr 8 14:50:05 2025 +0800

    fix: possible circular reference issue during build (vbenjs#5894)

    * 修复构建期间出现的循环引用警告

commit 71e8d12
Author: Netfan <[email protected]>
Date:   Mon Apr 7 01:21:30 2025 +0800

    fix: improve prompt component (vbenjs#5879)

    * fix: prompt component render fixed

    * fix: alert buttonAlign default value

commit d216fdc
Author: Netfan <[email protected]>
Date:   Sat Apr 5 13:07:52 2025 +0800

    feat: support logo text slot (vbenjs#5872)

    * 基础布局中的LOGO的文字区域允许通过插槽logo-text定制

commit 384c5d7
Author: wyc001122 <[email protected]>
Date:   Sat Apr 5 11:04:59 2025 +0800

    fix: 布局为双列菜单或者水平模式下, 一级菜单高亮问题 (vbenjs#5870)

    Co-authored-by: 王泳超 <[email protected]>

commit b0ad08d
Author: Netfan <[email protected]>
Date:   Fri Apr 4 15:21:09 2025 +0800

    feat: use the not-found component instead of the invalid route component in the backend mode (vbenjs#5871)

    * 后端菜单模式下,使用not-found组件代替无效的路由组件
@WhiteGIT
Copy link

@yuhldr
可以看看后台要给回什么数据格式吗? 我按文档的例子,默认取到了好多不想要的数据
20250421214824

@yuhldr
Copy link
Contributor Author

yuhldr commented Apr 21, 2025

@WhiteGIT

你的data嵌套重复了,另外就是得到一堆是正常的,那是upload默认的,在 “response”里解析真正的url

{"url": "xxxx"}

return useResponseSuccess({
url: 'https://unpkg.com/@vbenjs/[email protected]/source/logo-v1.webp',
});

YuchenWell added a commit to YuchenWell/vue-vben-admin that referenced this pull request Apr 23, 2025
Squashed commit of the following:

commit 1437770
Author: Netfan <[email protected]>
Date:   Wed Apr 23 12:20:52 2025 +0800

    fix: alert confirm state in beforeClose callback (vbenjs#6019)

commit b985ff0
Author: pangyajun123 <[email protected]>
Date:   Mon Apr 21 19:15:05 2025 +0800

    fix: vxe-table theme token follow primary color (vbenjs#6007)

commit b148b8e
Author: wyc001122 <[email protected]>
Date:   Sat Apr 19 14:35:33 2025 +0800

    fix: fix geader menu activation path (vbenjs#5997)

    Co-authored-by: 王泳超 <[email protected]>

commit 79de6bc
Author: Netfan <[email protected]>
Date:   Thu Apr 17 22:23:05 2025 +0800

    fix: alert send wrong confirm state to beforeClose (vbenjs#5991)

    * 修复alert在按下Esc或者点击遮罩关闭时,可能发送错误的isConfirm状态

commit 14bd6dd
Author: Netfan <[email protected]>
Date:   Thu Apr 17 20:25:49 2025 +0800

    fix: destroyOnClose works within connectedComponent (vbenjs#5989)

    * 修复destroyOnClose没能销毁connectedComponent自身的问题

commit 7f269e0
Author: PIPEDREA_WZJ <[email protected]>
Date:   Thu Apr 17 14:01:39 2025 +0800

    Update tailwindcss.md (vbenjs#5602)

    tailwindcss最新的版本已经是v4.x,vben中使用的是3.x的tailwindcss。在未进行兼容前,会出现运行失败的问题

commit 4baec83
Author: yuh <[email protected]>
Date:   Thu Apr 17 14:00:46 2025 +0800

    feat: add examples: form-upload (vbenjs#5955)

    * feat: add examples: form-upload

    * fix: upload: accept and label

    * fix: upload: 设置表单值、图片预览

commit f7a4d13
Author: Netfan <[email protected]>
Date:   Wed Apr 16 14:11:04 2025 +0800

    fix: fixed arguments of callbacks in `formApi` (vbenjs#5970)

    * 修复 `handleValuesChange` 传递的参数不是处理后的表单值的问题

    * 修复 `handleReset` 未能传递正确参数的问题

commit 0936861
Author: Netfan <[email protected]>
Date:   Wed Apr 16 11:29:01 2025 +0800

    feat:  pass `fieldsChanged`  into the `handleValuesChange` callback function (vbenjs#5968)

    * fieldsChanged(已被改变值的字段名)将传入handleValuesChange回调函数

commit 3318d76
Author: ming4762 <[email protected]>
Date:   Wed Apr 16 11:28:36 2025 +0800

    perf: improve `destroyOnClose` for VbenModal (vbenjs#5964)

commit 8f3881e
Author: LinaBell <[email protected]>
Date:   Wed Apr 16 11:27:13 2025 +0800

    perf: `beforeClose` of drawer support promise (vbenjs#5932)

    * perf: the beforeClose function of drawer is consistent with that of modal

    * refactor: drawer test update

commit 5252480
Author: zhouda1fu <[email protected]>
Date:   Wed Apr 16 11:22:59 2025 +0800

    fix: missing await in department form(vbenjs#5967)

commit d18f561
Author: Netfan <[email protected]>
Date:   Tue Apr 15 20:52:23 2025 +0800

    docs: update alert and apiComponent docs (vbenjs#5961)

commit 333998b
Author: wyc001122 <[email protected]>
Date:   Tue Apr 15 20:51:38 2025 +0800

    fix: determine if scrollbar has been totally scrolled (vbenjs#5934)

    * 修复在系统屏幕缩放比例不为100%的情况下,滚动组件对是否已滚动到边界的判断可能不正确的问题

commit 3fb4fba
Author: ming4762 <[email protected]>
Date:   Tue Apr 15 18:49:57 2025 +0800

    fix: modal closing animation (vbenjs#5960)

commit c7e6210
Author: ming4762 <[email protected]>
Date:   Tue Apr 15 16:04:44 2025 +0800

    feat: `modal`&`drawer` support `center-footer` slot (vbenjs#5956)

commit d864085
Author: lztb <[email protected]>
Date:   Tue Apr 15 16:03:20 2025 +0800

    feat: vben-form添加arrayToStringFields属性 (vbenjs#5957)

    * feat: vben-form添加arrayToStringFields属性

    * feat: 修改handleArrayToStringFields和handleStringToArrayFields中嵌套数组格式的处理不一致

    ---------

    Co-authored-by: 米山 <[email protected]>

commit fcdc1a1
Author: Netfan <[email protected]>
Date:   Tue Apr 15 15:32:30 2025 +0800

    feat: add more expose methods for `apiComponent` (vbenjs#5958)

    * 为ApiComponent组件添加getOptions和getValue导出方法。

commit bf7496f
Author: Netfan <[email protected]>
Date:   Tue Apr 15 00:00:05 2025 +0800

    feat: add `useAlertContext` for Alert component (vbenjs#5947)

    * 新增Alert的子组件中获取弹窗上下文的能力

commit 9700150
Author: Netfan <[email protected]>
Date:   Mon Apr 14 19:56:52 2025 +0800

    fix: table actions in fixed column (vbenjs#5945)

commit f0e9e55
Author: Netfan <[email protected]>
Date:   Mon Apr 14 11:48:21 2025 +0800

    feat: alert support customize `footer` (vbenjs#5940)

    * Alert组件支持自定义footer

commit ff88274
Author: Netfan <[email protected]>
Date:   Mon Apr 14 11:18:33 2025 +0800

    fix: long navigation menu can be scrolled (vbenjs#5939)

    * 修复超长的导航菜单无法纵向滚动的问题

commit afce9dc
Author: ming4762 <[email protected]>
Date:   Sun Apr 13 23:02:07 2025 +0800

    perf: improve `destroyOnClose` for `VbenModal` (vbenjs#5935)

    * perf: 优化Vben Modal destroyOnClose,解决destroyOnClose=false,Modal依旧会被销毁的问题

    影响范围(重要):destroyOnClose默认为true,这会导致所有的modal都会默认渲染到body
    radix-vue Dialog组件默认会销毁挂载的组件,所以即使destroyOnClose=false,Modal依旧会被销毁的问题
    对于一些大表单重复渲染导致卡顿,ApiComponent也会频繁的加载数据

    * fix: modal closing animation

    ---------

    Co-authored-by: Netfan <[email protected]>

commit b5700bd
Author: ming4762 <[email protected]>
Date:   Sun Apr 13 20:03:18 2025 +0800

    perf: improve `autoSelect` of  `ApiComponent` (vbenjs#5936)

    * fix: 修复autoSelect不生效的问题,props.valueField已经被omit了

    * feat: ApiComponent autoSelect支持使用函数,可以满足灵活性要求更高的场景

commit a8c4786
Author: Netfan <[email protected]>
Date:   Sat Apr 12 14:02:35 2025 +0800

    feat: api-component support autoSelect prop (vbenjs#5931)

    * feat: api-component support autoSelect prop

    * docs: add version requirement

commit 2971ccc
Author: Netfan <[email protected]>
Date:   Sat Apr 12 13:41:40 2025 +0800

    docs: docs modal z-index fixed, update alert docs (vbenjs#5930)

commit 4a2c7b3
Author: Netfan <[email protected]>
Date:   Sat Apr 12 10:37:47 2025 +0800

    fix: alert animation (vbenjs#5927)

commit 36bf6fc
Author: Netfan <[email protected]>
Date:   Sat Apr 12 01:44:08 2025 +0800

    fix: builtin color change throttled in preference drawer (vbenjs#5924)

    修复偏好设置中的自定义主题色拖动选择颜色时页面会明显卡顿的问题

commit f46ec30
Author: Netfan <[email protected]>
Date:   Sat Apr 12 01:16:57 2025 +0800

    fix: theme mode follow the system only `auto` (vbenjs#5923)

    * 修复主题在未设置为auto时,仍然会跟随系统主题变化的问题。

commit 9bd5a19
Author: Netfan <[email protected]>
Date:   Sat Apr 12 00:59:56 2025 +0800

    fix: alert action button  focus, fixed vbenjs#5921 (vbenjs#5922)

    * 修复Alert组件的按钮焦点切换问题

commit 86da3ce
Author: zhang <[email protected]>
Date:   Wed Apr 9 16:16:56 2025 +0800

    chore: 导出框架自带的组件,方便独立页面使用 (vbenjs#5876)

commit 329a176
Author: Netfan <[email protected]>
Date:   Wed Apr 9 01:05:20 2025 +0800

    perf:  optimize bootstrap modules to speed up first-screen loading (vbenjs#5899)

    优化首屏加载速度

commit 9379093
Author: Netfan <[email protected]>
Date:   Tue Apr 8 20:28:50 2025 +0800

    feat: customizable table separator (vbenjs#5898)

    * 表格的分隔条支持定制背景色或完全移除

commit c9014d0
Author: ming4762 <[email protected]>
Date:   Tue Apr 8 20:27:03 2025 +0800

    perf: 优化关闭页面切换动画的tab切换性能 (vbenjs#5883)

commit ed26dca
Author: Netfan <[email protected]>
Date:   Tue Apr 8 16:31:41 2025 +0800

    chore: update pnpm-lock.yaml

commit 08c6496
Author: Netfan <[email protected]>
Date:   Tue Apr 8 14:56:40 2025 +0800

    chore: update deps

commit a8c5df3
Author: Netfan <[email protected]>
Date:   Tue Apr 8 14:50:05 2025 +0800

    fix: possible circular reference issue during build (vbenjs#5894)

    * 修复构建期间出现的循环引用警告

commit 71e8d12
Author: Netfan <[email protected]>
Date:   Mon Apr 7 01:21:30 2025 +0800

    fix: improve prompt component (vbenjs#5879)

    * fix: prompt component render fixed

    * fix: alert buttonAlign default value

commit d216fdc
Author: Netfan <[email protected]>
Date:   Sat Apr 5 13:07:52 2025 +0800

    feat: support logo text slot (vbenjs#5872)

    * 基础布局中的LOGO的文字区域允许通过插槽logo-text定制

commit 384c5d7
Author: wyc001122 <[email protected]>
Date:   Sat Apr 5 11:04:59 2025 +0800

    fix: 布局为双列菜单或者水平模式下, 一级菜单高亮问题 (vbenjs#5870)

    Co-authored-by: 王泳超 <[email protected]>

commit b0ad08d
Author: Netfan <[email protected]>
Date:   Fri Apr 4 15:21:09 2025 +0800

    feat: use the not-found component instead of the invalid route component in the backend mode (vbenjs#5871)

    * 后端菜单模式下,使用not-found组件代替无效的路由组件
@QizhouYang
Copy link

ERROR: Invalid prop: type check failed for prop "fileList". Expected Array, got Object ,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants