docs: 说明文档调整和已知警告问题修复

This commit is contained in:
Ray.Hao
2026-04-24 21:37:24 +08:00
parent aad936a243
commit 4231ca000f
19 changed files with 179 additions and 101 deletions

View File

@@ -32,6 +32,7 @@ module.exports = {
}, },
], ],
// 允许使用未知伪元素 // 允许使用未知伪元素
"no-invalid-position-declaration": null, // Vue 模板内联 style 误报
"at-rule-no-unknown": null, // 禁用默认的未知 at-rule 检查 "at-rule-no-unknown": null, // 禁用默认的未知 at-rule 检查
"scss/at-rule-no-unknown": true, // 启用 SCSS 特定的 at-rule 检查 "scss/at-rule-no-unknown": true, // 启用 SCSS 特定的 at-rule 检查
}, },

View File

@@ -1,35 +1,27 @@
<div align="center"> <div align="center">
<img alt="vue3-element-admin" width="80" height="80" src="./src/assets/images/logo.png">
<h1>vue3-element-admin</h1>
<img src="https://img.shields.io/badge/Vue-3.5.22-brightgreen.svg"/> <img alt="vue3-element-admin" width="80" src="./src/assets/images/logo.png">
<img src="https://img.shields.io/badge/Vite-7.3.0-green.svg"/>
<img src="https://img.shields.io/badge/Element Plus-2.3.2-blue.svg"/>
<img src="https://img.shields.io/badge/license-MIT-green.svg"/>
<a href="https://gitee.com/youlaiorg" target="_blank">
<img src="https://img.shields.io/badge/Author-%E6%9C%89%E6%9D%A5%E5%BC%80%E6%BA%90%E7%BB%84%E7%BB%87-orange.svg"/>
</a>
<a href="https://gitee.com/youlaiorg/vue3-element-admin" target="_blank"> # vue3-element-admin
<img alt="有来技术" src="https://gitee.com/youlaiorg/vue3-element-admin/badge/star.svg"/>
</a>
<a href="https://github.com/youlaitech/vue3-element-admin" target="_blank">
<img alt="有来技术" src="https://img.shields.io/github/stars/youlaitech/vue3-element-admin.svg?style=social&label=Stars"/>
</a>
<a href="https://gitcode.com/youlai/vue3-element-admin" target="_blank">
<img alt="有来技术" src="https://gitcode.com/youlai/vue3-element-admin/star/badge.svg"/>
</a>
<a href="https://atomgit.com/youlai/vue3-element-admin" target="_blank"> **Vue3 + Vite + TypeScript Enterprise Admin Frontend**
<img alt="有来技术" src="https://atomgit.com/youlai/vue3-element-admin/star/2025top.svg"/>
</a> [![Vue](https://img.shields.io/badge/Vue-3.5.22-brightgreen.svg)](https://vuejs.org/)
[![Vite](https://img.shields.io/badge/Vite-7.3.0-green.svg)](https://vitejs.dev/)
[![Element Plus](https://img.shields.io/badge/Element%20Plus-2.3.2-blue.svg)](https://element-plus.org/)
[![Gitee Star](https://gitee.com/youlaiorg/vue3-element-admin/badge/star.svg)](https://gitee.com/youlaiorg/vue3-element-admin/stargazers)
[![GitHub Star](https://img.shields.io/github/stars/youlaitech/vue3-element-admin?style=social)](https://github.com/youlaitech/vue3-element-admin)
[![GitCode Star](https://gitcode.com/youlai/vue3-element-admin/star/badge.svg)](https://gitcode.com/youlai/vue3-element-admin/stargazers)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
</div> </div>
![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png") ![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png")
<div align="center"> <div align="center">
<a target="_blank" href="https://vue.youlai.tech">🖥️ Live Preview</a> | <a target="_blank" href="https://app.youlai.tech">📲 Mobile Preview</a> | <a target="_blank" href="https://juejin.cn/post/7228990409909108793">📑 Documentation</a>| <a target="_blank" href="https://www.youlai.tech//vue3-element-admin">🌐 Official Website</a> | <a href="./README.md">💬 中文</a> | <a href="./README.en-US.md">💬 English</a>
[🖥️ Live Preview](https://vue.youlai.tech) | [<EFBFBD> Mobile Preview](https://app.youlai.tech) | [<EFBFBD> Documentation](https://www.youlai.tech/vue3-element-admin) | [💬 中文](README.md)
</div> </div>
## Introduction ## Introduction
@@ -49,31 +41,61 @@
- **Infrastructure**: Provides internationalization, multiple layouts, dark mode, full screen, watermark, API documentation, and code generator functionality. - **Infrastructure**: Provides internationalization, multiple layouts, dark mode, full screen, watermark, API documentation, and code generator functionality.
- **Continuous Updates**: Project is continuously updated with real-time updates of tools and dependencies. - **Continuous Updates**: Project is continuously updated with real-time updates of tools and dependencies.
## Project Screenshots ## System Preview
🖥️ **Dashboard** **PC**
![](https://www.youlai.tech/storage/blog/2025/04/30/20250430085342.png) <table align="center">
<tr>
<td><img alt="PC Preview 1" width="400" src="./src/assets/images/preview/pc-01.png"></td>
<td><img alt="PC Preview 2" width="400" src="./src/assets/images/preview/pc-02.png"></td>
</tr>
<tr>
<td><img alt="PC Preview 3" width="400" src="./src/assets/images/preview/pc-03.png"></td>
<td><img alt="PC Preview 4" width="400" src="./src/assets/images/preview/pc-04.png"></td>
</tr>
<tr>
<td><img alt="PC Preview 5" width="400" src="./src/assets/images/preview/pc-05.png"></td>
<td><img alt="PC Preview 6" width="400" src="./src/assets/images/preview/pc-06.png"></td>
</tr>
</table>
**API Documentation** **Mobile**
![](https://www.youlai.tech/storage/blog/2025/01/18/20250118183539.png) <table align="center">
<tr>
<td><img alt="APP Preview 1" width="200" src="./src/assets/images/preview/app-01.png"></td>
<td><img alt="APP Preview 2" width="200" src="./src/assets/images/preview/app-02.png"></td>
<td><img alt="APP Preview 3" width="200" src="./src/assets/images/preview/app-03.png"></td>
<td><img alt="APP Preview 4" width="200" src="./src/assets/images/preview/app-04.png"></td>
</tr>
</table>
📲 **Mobile Version** ## Ecosystem
![](https://www.youlai.tech/storage/blog/2025/04/30/app.jpg) **Frontend**
## Project Source Code | Project | Tech Stack | Description |
|:-----|:-------|:-----|
| [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | Vue 3 + Vite + TS + Element Plus | PC Admin (Main) |
| [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin-js) | Vue 3 + Vite + JS + Element Plus | JavaScript Version |
| [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | Vue 3 + Vite + TS + Element Plus | Lite Template |
| [youlai-app](https://gitee.com/youlaiorg/youlai-app) | Vue 3 + UniApp | Mobile App |
| Project | Gitee | Github | GitCode | **Backend**
| ------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| vue3-element-admin ✅ | [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | [vue3-element-admin](https://github.com/youlaitech/vue3-element-admin) | [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) | | Project | Tech Stack | Description |
| vue3-element-admin JS Version | [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin-js) | [vue3-element-admin-js](https://github.com/youlaitech/vue3-element-admin-js) | [vue3-element-admin-js](https://gitcode.com/youlai/vue3-element-admin-js) | |:-----|:-------|:-----|
| vue3-element-admin Lite Version | [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | [vue3-element-template](https://github.com/youlaitech/vue3-element-template) | [vue3-element-template](https://gitcode.com/youlai/vue3-element-template) | | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | Spring Boot + MyBatis-Plus | Java Backend (Main) |
| vue-uniapp-admin Mobile Version | [vue-uniapp-admin](https://gitee.com/youlaiorg/vue-uniapp-admin) | [vue-uniapp-admin](https://github.com/youlaitech/vue-uniapp-admin) | [vue-uniapp-admin](https://gitcode.com/youlai/vue-uniapp-admin) | | [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) | NestJS + TypeORM | Node.js |
| Java Backend | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | [youlai-boot](https://github.com/haoxianrui/youlai-boot.git) | [youlai-boot](https://gitcode.com/youlai/youlai-boot.git) | | [youlai-gin](https://gitee.com/youlaiorg/youlai-gin) | Go + Gorm | Go |
| Java Multi-tenant Backend | [youlai-boot-tenant](https://gitee.com/youlaiorg/youlai-boot-tenant) | - | - | | [youlai-django](https://gitee.com/youlaiorg/youlai-django) | Django + DRF | Python |
| Node Backend | [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) | [youlai-nest](https://github.com/haoxianrui/youlai-nest.git) | [youlai-nest](https://gitcode.com/youlai/youlai-nest.git) | | [youlai-think](https://gitee.com/youlaiorg/youlai-think) | ThinkPHP 8 | PHP |
| [youlai-aspnet](https://gitee.com/youlaiorg/youlai-aspnet) | ASP.NET Core | C# |
> **youlai-boot** also provides variants: [Multi-tenant](https://gitee.com/youlaiorg/youlai-boot-tenant) · [MyBatis-Flex](https://gitee.com/youlaiorg/youlai-boot-flex) · [Spring Boot 3](https://gitee.com/youlaiorg/youlai-boot/tree/spring-boot-3) · [PostgreSQL](https://gitee.com/youlaiorg/youlai-boot/tree/db-pg) · [Multi-module](https://gitee.com/youlaiorg/youlai-boot/tree/multi-module)
>
> All six backends share the same **RESTful API** and **database schema**, frontends can switch seamlessly.
## Development Guide ## Development Guide
@@ -199,15 +221,29 @@ Thanks to all the contributors!
[![contributors](https://contrib.rocks/image?repo=youlaitech/vue3-element-admin)](https://github.com/youlaitech/vue3-element-admin/graphs/contributors) [![contributors](https://contrib.rocks/image?repo=youlaitech/vue3-element-admin)](https://github.com/youlaitech/vue3-element-admin/graphs/contributors)
## Special Thanks ---
- Thanks to the [GitCode](https://gitcode.com/) official [G-Star](https://gitcode.com/g-star) certification <table align="center">
![](https://foruda.gitee.com/images/1728577513089814203/95f2a70d_716974.jpeg) <tr>
<td align="center">
<img src="./src/assets/images/qr/wechat-offical.png" height="180" alt="WeChat Official Account"><br>
<sub>WeChat Official Account</sub>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="center">
<img src="./src/assets/images/qr/wechat-mp.jpg" height="180" alt="Mini Program"><br>
<sub>Mini Program</sub>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="center">
<img src="./src/assets/images/qr/wechat-personal.png" height="180" alt="Add Author WeChat"><br>
<sub>Add Author WeChat</sub>
</td>
</tr>
</table>
## Community <p align="center"><em>Technical Exchange · Issue Feedback · Business Cooperation</em></p>
① Follow the "Youlai Tech" WeChat Official Account, click the **Group Chat** menu to get the QR code (this measure is taken to prevent ads from entering the group, thanks for your understanding and support). ## License
② Directly add WeChat **`haoxianrui`** with a note indicating "Frontend/Backend/Full Stack". [MIT](LICENSE)
![Youlai Tech WeChat Official Account](https://foruda.gitee.com/images/1737108820762592766/3390ed0d_716974.png)

123
README.md
View File

@@ -1,25 +1,18 @@
<div align="center"> <div align="center">
<img alt="vue3-element-admin" width="80" height="80" src="./src/assets/images/logo.png">
<h1>vue3-element-admin</h1>
<img src="https://img.shields.io/badge/Vue-3.5.30-brightgreen.svg"/> <img alt="vue3-element-admin" width="80" src="./src/assets/images/logo.png">
<img src="https://img.shields.io/badge/Vite-8.0.0-green.svg"/>
<img src="https://img.shields.io/badge/Element Plus-2.13.6-blue.svg"/>
<img src="https://img.shields.io/badge/license-MIT-green.svg"/>
<a href="https://gitee.com/youlaiorg/vue3-element-admin" target="_blank"> # vue3-element-admin
<img alt="有来技术" src="https://gitee.com/youlaiorg/vue3-element-admin/badge/star.svg"/>
</a> **Vue3 + Vite + TypeScript 企业级后台管理前端**
<a href="https://github.com/youlaitech/vue3-element-admin" target="_blank">
<img alt="有来技术" src="https://img.shields.io/github/stars/youlaitech/vue3-element-admin.svg?style=social&label=Stars"/> [![Vue](https://img.shields.io/badge/Vue-3.5.30-brightgreen.svg)](https://vuejs.org/)
</a> [![Element Plus](https://img.shields.io/badge/Element%20Plus-2.13.6-blue.svg)](https://element-plus.org/)
<a href="https://gitcode.com/youlai/vue3-element-admin" target="_blank"> [![Gitee Star](https://gitee.com/youlaiorg/vue3-element-admin/badge/star.svg)](https://gitee.com/youlaiorg/vue3-element-admin/stargazers)
<img alt="有来技术" src="https://gitcode.com/youlai/vue3-element-admin/star/badge.svg"/> [![GitHub Star](https://img.shields.io/github/stars/youlaitech/vue3-element-admin?style=social)](https://github.com/youlaitech/vue3-element-admin)
</a> [![GitCode Star](https://gitcode.com/youlai/vue3-element-admin/star/badge.svg)](https://gitcode.com/youlai/vue3-element-admin/stargazers)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
<a href="https://atomgit.com/youlai/vue3-element-admin" target="_blank">
<img alt="有来技术" src="https://atomgit.com/youlai/vue3-element-admin/star/2025top.svg"/>
</a>
</div> </div>
![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png") ![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png")
@@ -45,31 +38,61 @@
- **基础设施:** 提供国际化、多布局、暗黑模式、全屏、水印、接口文档和代码生成器等功能。 - **基础设施:** 提供国际化、多布局、暗黑模式、全屏、水印、接口文档和代码生成器等功能。
- **持续更新**:项目持续开源更新,实时更新工具和依赖。 - **持续更新**:项目持续开源更新,实时更新工具和依赖。
## 项目截图 ## 系统预览
🖥️ **控制台** **PC 端**
![](https://www.youlai.tech/storage/blog/2025/04/30/20250430085342.png) <table align="center">
<tr>
<td><img alt="PC预览1" width="400" src="./src/assets/images/preview/pc-01.png"></td>
<td><img alt="PC预览2" width="400" src="./src/assets/images/preview/pc-02.png"></td>
</tr>
<tr>
<td><img alt="PC预览3" width="400" src="./src/assets/images/preview/pc-03.png"></td>
<td><img alt="PC预览4" width="400" src="./src/assets/images/preview/pc-04.png"></td>
</tr>
<tr>
<td><img alt="PC预览5" width="400" src="./src/assets/images/preview/pc-05.png"></td>
<td><img alt="PC预览6" width="400" src="./src/assets/images/preview/pc-06.png"></td>
</tr>
</table>
**接口文档** **移动端**
![](https://www.youlai.tech/storage/blog/2025/01/18/20250118183539.png) <table align="center">
<tr>
<td><img alt="APP预览1" width="200" src="./src/assets/images/preview/app-01.png"></td>
<td><img alt="APP预览2" width="200" src="./src/assets/images/preview/app-02.png"></td>
<td><img alt="APP预览3" width="200" src="./src/assets/images/preview/app-03.png"></td>
<td><img alt="APP预览4" width="200" src="./src/assets/images/preview/app-04.png"></td>
</tr>
</table>
📲 **移动端** ## 生态矩阵
![](https://www.youlai.tech/storage/blog/2025/04/30/app.jpg) **前端**
## 项目源码 | 项目 | 技术栈 | 说明 |
|:-----|:-------|:-----|
| [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | Vue 3 + Vite + TS + Element Plus | PC 管理前端(主推) |
| [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin-js) | Vue 3 + Vite + JS + Element Plus | JavaScript 版本 |
| [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | Vue 3 + Vite + TS + Element Plus | 精简模板 |
| [youlai-app](https://gitee.com/youlaiorg/youlai-app) | Vue 3 + UniApp | 移动端 App |
| 项目 | Gitee | Github | GitCode | **后端**
| ------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| vue3-element-admin ✅ | [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | [vue3-element-admin](https://github.com/youlaitech/vue3-element-admin) | [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) | | 项目 | 技术栈 | 说明 |
| vue3-element-admin JS版 | [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin-js) | [vue3-element-admin-js](https://github.com/youlaitech/vue3-element-admin-js) | [vue3-element-admin-js](https://gitcode.com/youlai/vue3-element-admin-js) | |:-----|:-------|:-----|
| vue3-element-admin 精简版 | [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | [vue3-element-template](https://github.com/youlaitech/vue3-element-template) | [vue3-element-template](https://gitcode.com/youlai/vue3-element-template) | | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | Spring Boot + MyBatis-Plus | Java 后端(主推) |
| vue-uniapp-admin 移动版 | [vue-uniapp-admin](https://gitee.com/youlaiorg/vue-uniapp-admin) | [vue-uniapp-admin](https://github.com/youlaitech/vue-uniapp-admin) | [vue-uniapp-admin](https://gitcode.com/youlai/vue-uniapp-admin) | | [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) | NestJS + TypeORM | Node.js |
| Java 后端 | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | [youlai-boot](https://github.com/haoxianrui/youlai-boot.git) | [youlai-boot](https://gitcode.com/youlai/youlai-boot.git) | | [youlai-gin](https://gitee.com/youlaiorg/youlai-gin) | Go + Gorm | Go |
| Java 多租户后端 | [youlai-boot-tenant](https://gitee.com/youlaiorg/youlai-boot-tenant) | - | - | | [youlai-django](https://gitee.com/youlaiorg/youlai-django) | Django + DRF | Python |
| Node 后端 | [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) | [youlai-nest](https://github.com/haoxianrui/youlai-nest.git) | [youlai-nest](https://gitcode.com/youlai/youlai-nest.git) | | [youlai-think](https://gitee.com/youlaiorg/youlai-think) | ThinkPHP 8 | PHP |
| [youlai-aspnet](https://gitee.com/youlaiorg/youlai-aspnet) | ASP.NET Core | C# |
> **youlai-boot** 还提供以下变种和分支版本:[多租户](https://gitee.com/youlaiorg/youlai-boot-tenant)Spring Boot 4· [MyBatis-Flex](https://gitee.com/youlaiorg/youlai-boot-flex)Spring Boot 4· [Spring Boot 3](https://gitee.com/youlaiorg/youlai-boot/tree/spring-boot-3) · [PostgreSQL](https://gitee.com/youlaiorg/youlai-boot/tree/db-pg) · [多模块](https://gitee.com/youlaiorg/youlai-boot/tree/multi-module)
>
> 六种后端共享同一套 **RESTful API 规范** 和 **数据库结构**,前端可无缝切换。
## 开发指南 ## 开发指南
@@ -195,15 +218,25 @@ Thanks to all the contributors!
[![contributors](https://contrib.rocks/image?repo=youlaitech/vue3-element-admin)](https://github.com/youlaitech/vue3-element-admin/graphs/contributors) [![contributors](https://contrib.rocks/image?repo=youlaitech/vue3-element-admin)](https://github.com/youlaitech/vue3-element-admin/graphs/contributors)
## 特别感谢 ---
- 感谢 [GitCode](https://gitcode.com/) 官方的 [G-Star](https://gitcode.com/g-star) 认证 <table align="center">
![](https://foruda.gitee.com/images/1728577513089814203/95f2a70d_716974.jpeg) <tr>
<td align="center">
<img src="./src/assets/images/qr/wechat-offical.png" height="180" alt="公众号「有来技术」"><br>
<sub>公众号「有来技术」</sub>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="center">
<img src="./src/assets/images/qr/wechat-mp.jpg" height="180" alt="小程序「有来技术」"><br>
<sub>小程序「有来技术」</sub>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="center">
<img src="./src/assets/images/qr/wechat-personal.png" height="180" alt="添加作者微信"><br>
<sub>添加作者微信</sub>
</td>
</tr>
</table>
## 加群交流 <p align="center"><em>技术交流 · 问题反馈 · 商务合作</em></p>
① 关注「有来技术」公众号,点击菜单 **交流群** 获取加群二维码(此举防止广告进群,感谢理解和支持)。
② 直接添加微信 **`haoxianrui`** 备注「前端/后端/全栈」。
![有来技术公众号](https://foruda.gitee.com/images/1737108820762592766/3390ed0d_716974.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

View File

@@ -88,6 +88,8 @@
:overwrite-mode="overwriteMode" :overwrite-mode="overwriteMode"
:write-progress="writeProgress" :write-progress="writeProgress"
:write-running="writeRunning" :write-running="writeRunning"
@update:write-scope="writeScope = $event"
@update:overwrite-mode="overwriteMode = $event"
@pick-frontend-dir="pickFrontendDir" @pick-frontend-dir="pickFrontendDir"
@pick-backend-dir="pickBackendDir" @pick-backend-dir="pickBackendDir"
@confirm-write="confirmWrite" @confirm-write="confirmWrite"

View File

@@ -162,10 +162,10 @@ const props = defineProps<{
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: "update:previewScope", val: "all" | "frontend" | "backend"): void; (_e: "update:previewScope", _val: "all" | "frontend" | "backend"): void;
(e: "update:previewTypes", val: string[]): void; (_e: "update:previewTypes", _val: string[]): void;
(e: "file-click", data: any): void; (_e: "file-click", _data: any): void;
(e: "copy"): void; (_e: "copy"): void;
}>(); }>();
const cmRef = ref<CmComponentRef>(); const cmRef = ref<CmComponentRef>();

View File

@@ -93,7 +93,8 @@ export function useLocalWrite(genConfigFormData: Ref<GenConfigForm>) {
) { ) {
const normalized = filePath.replace(/\\/g, "/"); const normalized = filePath.replace(/\\/g, "/");
const parts = normalized.split("/").filter(Boolean); const parts = normalized.split("/").filter(Boolean);
const fileName = parts.pop()!; const fileName = parts.pop();
if (!fileName) return;
const targetDir = await ensureDir(dirHandle, parts, true); const targetDir = await ensureDir(dirHandle, parts, true);
const fileHandle = await targetDir.getFileHandle(fileName, { create: true }); const fileHandle = await targetDir.getFileHandle(fileName, { create: true });
const writable = await fileHandle.createWritable(); const writable = await fileHandle.createWritable();
@@ -108,7 +109,8 @@ export function useLocalWrite(genConfigFormData: Ref<GenConfigForm>) {
try { try {
const normalized = filePath.replace(/\\/g, "/"); const normalized = filePath.replace(/\\/g, "/");
const parts = normalized.split("/").filter(Boolean); const parts = normalized.split("/").filter(Boolean);
const fileName = parts.pop()!; const fileName = parts.pop();
if (!fileName) return false;
const targetDir = await ensureDir(dirHandle, parts, false); const targetDir = await ensureDir(dirHandle, parts, false);
await targetDir.getFileHandle(fileName, { create: false }); await targetDir.getFileHandle(fileName, { create: false });
return true; return true;
@@ -125,7 +127,8 @@ export function useLocalWrite(genConfigFormData: Ref<GenConfigForm>) {
try { try {
const normalized = filePath.replace(/\\/g, "/"); const normalized = filePath.replace(/\\/g, "/");
const parts = normalized.split("/").filter(Boolean); const parts = normalized.split("/").filter(Boolean);
const fileName = parts.pop()!; const fileName = parts.pop();
if (!fileName) return false;
const targetDir = await ensureDir(dirHandle, parts, false); const targetDir = await ensureDir(dirHandle, parts, false);
const fileHandle = await targetDir.getFileHandle(fileName, { create: false }); const fileHandle = await targetDir.getFileHandle(fileName, { create: false });
const file = await fileHandle.getFile(); const file = await fileHandle.getFile();
@@ -172,7 +175,8 @@ export function useLocalWrite(genConfigFormData: Ref<GenConfigForm>) {
async function worker() { async function worker() {
while (queue.length) { while (queue.length) {
const item = queue.shift()!; const item = queue.shift();
if (!item) break;
try { try {
await (async () => { await (async () => {
const root = resolveRootForItem(item); const root = resolveRootForItem(item);
@@ -180,7 +184,9 @@ export function useLocalWrite(genConfigFormData: Ref<GenConfigForm>) {
writeProgress.current = relativePath; writeProgress.current = relativePath;
const targetRoot = const targetRoot =
root === "frontend" ? frontendDirHandle.value! : backendDirHandle.value!; root === "frontend" ? frontendDirHandle.value : backendDirHandle.value;
if (!targetRoot) return;
if (overwriteMode.value === "ifChanged") { if (overwriteMode.value === "ifChanged") {
const same = await isSameFile(targetRoot, relativePath, item.content || ""); const same = await isSameFile(targetRoot, relativePath, item.content || "");