feat(template)!: flatten components and improve project discovery

Document the template in English and Chinese with a project tree and a
runnable TablePro example. Generate public metadata and a sitemap for the demo.

BREAKING CHANGE: Shared components now live directly under src/components.
Update deep imports from components/base and components/pro. RCollapse was removed.
This commit is contained in:
XiaoDaiGua-Ray 2026-11-03 16:52:23 +08:00
parent 8079e2d4f5
commit 548de9427d
116 changed files with 567 additions and 598 deletions

View File

@ -46,6 +46,8 @@ jobs:
- uses: pnpm/action-setup@v6.1.0
- run: pnpm install --frozen-lockfile
- run: pnpm build
env:
RAY_TEMPLATE_SITE_ORIGIN: ${{ github.repository == 'XiaoDaiGua-Ray/ray-template' && 'https://xiaodaigua-ray.github.io' || vars.RAY_TEMPLATE_SITE_ORIGIN }}
- uses: JamesIves/github-pages-deploy-action@v4.9.0
with:
branch: dist

264
README.md
View File

@ -1,197 +1,145 @@
<div align="center">
<a href="https://github.com/XiaoDaiGua-Ray/ray-template">
<img
alt="Ray Template"
width="200"
height="200"
src="https://avatars.githubusercontent.com/u/51957438?v=4"
/>
</a>
<br />
<br />
<a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/vite.svg" alt="node compatibility"></a>
<a href="https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/LICENSE"
><img
src="https://img.shields.io/github/license/XiaoDaiGua-Ray/ray-template"
alt="LICENSE"
/></a>
<a href="#badge"><img src="https://img.shields.io/github/languages/top/XiaoDaiGua-Ray/ray-template" alt="language"></a>
<a href="https://www.npmjs.com/package/ray-template"><img src="https://img.shields.io/npm/v/ray-template" alt="npm package"></a>
</div>
# Ray Template · Vue 3 Admin Dashboard Template
<div align="center">
[简体中文](README.zh-CN.md) · **[Live demo](https://xiaodaigua-ray.github.io/ray-template/)** · **[Documentation](https://xiaodaigua-ray.github.io/ray-template-doc/)** · [Quick start](#quick-start)
# Ray Template
Ray Template is an **open-source, ready-to-run frontend template** for admin dashboards, back-office tools, and internal apps. Run the demo to try a workspace with role-based menus and page tabs, then reuse TablePro list pages, workspace layouts, and route modules in your own app.
English | [简体中文](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/README.zh-CN.md)
**Stack**: Vue 3 · TypeScript / TSX · Naive UI · Vue Router · Pinia · Vue I18n · Vite / Rolldown · Axios · Vitest
A `completely free`, `efficient`, `feature complete` and based on Vite 8, TypeScript, Pinia and Vue 3 in the background template.
[![Ray Template's TablePro people directory with search, pagination, column settings, and sidebar navigation](docs/assets/tablepro-preview.jpg)](https://xiaodaigua-ray.github.io/ray-template/)
</div>
Sign in with the prefilled form. Open **Tables → Remote search and pagination** to try the list shown above, or **Layout playground** to experiment with the workspace.
## 🌻 Intro
## Core features
`Ray Template` uses cutting-edge front-end technology, abandoning complexity and bloat, using modular design, decoupling data, methods and views, focusing on business development. Provide rich configuration and rich template `Hooks`, support personalized customization, to meet your project needs.
### TablePro for simple tables and data-heavy pages
## ✨ Features
Use `RTablePro` with `bare` for a plain table, or add search, pagination, and a toolbar for a full list page. Column definitions, selection, sorting, and custom cells follow Naive UI DataTable.
- `New technology stack:` using Vue 3 + TSX, Vite 8 / Rolldown, Pinia 4, Vue Router 5 and Naive UI
- `Theme:` configurable theme
- `Internationalization:` built-in perfect internationalization solution
- `Permissions:` built-in perfect dynamic routing permission generation solution
- `Components:` secondary encapsulation of multiple common components
- `Toolkit:` common tool function packaging
- `Cache:` arbitrary depth page caching
- `Modular design:` decoupling management data, methods, views, rest assured secondary development
- `Configurable:` support rich configuration items
- `Code style:` built-in prettier, eslint and other code style tools
- `Multi-terminal adaptation:` support pc, phone, pad
- `Documentation:` complete documentation
- `Mock data:` built-in Mock data solution
- `Axios request:` the plug-in design is used to encapsulate the axios library interceptor twice, which makes the interceptor more flexible
- `SVG:` built-in svg icon solution
- `Hooks:` based on the template characteristics of the encapsulated hooks to make it easier to use some functions of the template
- `TypeScript:` provide a complete type
- `Vitest:` built-in vitest test solution
- **Search and pagination**: Pass local `data` or a `request(params, signal)` function that returns `{ data, total }`. Remote queries accept only the latest result. A failed query keeps existing rows visible and lets users retry.
- **Long lists and column controls**: Fill the available workspace and use virtual scrolling for large lists. Users can show, hide, reorder, or pin columns. Set `columnStateKey` to remember hidden columns across reloads.
- **CSV and printing**: Export or print the current page's visible data columns by default. Point printing at a custom region for documents that need their own layout.
## 👀 Preview
[TablePro API and data contract](src/components/RTablePro/README.md)
- [Preview](https://xiaodaigua-ray.github.io/ray-template/#/)
### A configurable workspace
## 📌 Documentation
Switch between sidebar, top, and mixed navigation. Narrow screens use a menu drawer. The workspace supports fixed or fluid width, a pinned header and footer, and a maximized content area. Pinia saves layout preferences. Try changes live in the layout playground or use named slots to replace the header, sidebar, tabs, and footer.
- [Documentation](https://xiaodaigua-ray.github.io/ray-template-doc/)
Page tabs keep multiple tasks open, and breadcrumbs show where you are. Find menu items with `⌘/Ctrl + K`, and switch between light and dark themes or English and Simplified Chinese.
## 🔋 Change Log
[Layout playground source](src/views/demo/layout-demo.tsx) · [Layout configuration and slots](src/layout/README.md)
- [Change Log](https://github.com/XiaoDaiGua-Ray/xiaodaigua-ray.github.io/blob/main/CHANGELOG.md)
### Route modules connect pages, menus, and permissions
## 🪴 Prepare
Declare a page in `src/router/modules` to generate its navigation and breadcrumbs. Route metadata controls menu labels and icons, roles, visibility, and `keepAlive`. Detail pages can extend the breadcrumb while keeping the current menu and tab. Role checks cover both menu filtering and direct navigation. Connect your backend to validate sessions and authorize API requests.
- [Node](https://nodejs.org/) and [git](https://git-scm.com/) - project development environment
- [Vite](https://vite.dev/) - familiar with vite features
- [Vue3](https://vuejs.org/) - familiar with Vue basic syntax
- [TypeScript](https://www.typescriptlang.org/) - familiar with TypeScript basic syntax
- [ES6+](http://es6.ruanyifeng.com/) - familiar with es6 basic syntax
- [Vue-Hooks-Plus](https://inhiblabcore.github.io/docs/hooks/) - familiar with vue-hooks-plus useRequest method basic use
- [Vue-Router-Next](https://router.vuejs.org/) - familiar with vue-router4.x basic use
- [Naive-UI](https://www.naiveui.com) - naive ui basic use
- [Faker](https://fakerjs.dev/) - localized demo data with vite-plugin-mock-dev-server
- [Pinia](https://pinia.vuejs.org/zh/introduction.html) - state manager pinia usage
- [TSX](https://github.com/vuejs/babel-plugin-jsx/blob/main/packages/babel-plugin-jsx/README-zh_CN.md) - tsx basic syntax
- [Vitest](https://cn.vitest.dev/guide/) - vitest basic use
[Routing guide](src/router/README.md) · [Nested navigation and caching example](src/router/modules/demo/multi-menu.ts)
## Toolchain and AI Harness
### Reusable components, composables, and SVG icons
Use Node.js **26.13.0 LTS** and pnpm **12.16.1**. Versions are pinned in `.nvmrc`, `package.json` and `pnpm-lock.yaml`. All retained direct dependencies use current stable versions, except TypeScript **6.0.3**: Vue Language Tools and typescript-eslint do not yet support TypeScript 7. See [upgrade notes and verification](docs/toolchain-upgrade.md).
- **Components**: Start with `RForm` and `RModal` for forms and dialogs. `RChart` manages ECharts initialization, resizing, and theme changes. The demo also includes LogicFlow diagrams, barcodes, and draggable cards. [Component guide](src/components/README.md)
- **Composables**: Template hooks cover page refresh, content maximization, menu badges, and watermarks. Web hooks demonstrate screenshots, printing, and element fullscreen. The examples include expandable usage code. [Composables and examples](src/hooks/README.md)
- **SVG icons**: Add an SVG to a group under `src/icons` to generate typed names and sprites. Routes and `RIcon` share names such as `navigation/dashboard`. The icon gallery lets you browse by group and copy TSX usage. [SVG icon workflow](src/icons/A_README.md)
The example uses nvm; with fnm, replace the first two commands with `fnm install && fnm use`.
## Quick start
Use the pinned **Node.js 26.13.0** and **pnpm 12.16.1**. With nvm:
```sh
git clone https://github.com/XiaoDaiGua-Ray/ray-template.git
cd ray-template
nvm install
nvm use
npm install --global pnpm@12.16.1
pnpm install --frozen-lockfile
pnpm env:check
pnpm check
```
| Command | Purpose / output |
| --------------------------------- | ---------------------------------------------------------- |
| `pnpm dev` | Start development at `http://127.0.0.1:9527/ray-template/` |
| `pnpm typecheck` | Check application, test and build configuration types |
| `pnpm lint` / `pnpm format:check` | Read-only lint / formatting checks |
| `pnpm lint:fix` / `pnpm format` | Explicit code fixes / formatting |
| `pnpm test:run` | Run unit tests once; `pnpm test` starts watch mode |
| `pnpm build` | Typecheck and build into `dist/production` |
| `pnpm dev-build` | Build with sourcemaps into `dist/development` |
| `pnpm preview` | Serve the production build locally |
| `pnpm report` | Write a static bundle report without opening a browser |
| `pnpm check` | Validate the harness, types, lint, format, tests and build |
CLI commands return a nonzero exit code on failure. Use `pnpm dev --host 0.0.0.0` only when you need LAN access. Build modes, CDN configuration, aliases and the deployment base are in `vite.custom.config.ts`.
Start with [AGENTS.md](AGENTS.md) and the [AI Harness](harness/README.md). Run `pnpm harness context` to find task entry points and `pnpm harness verify` to run the full checks and save a local verification report.
CI runs `pnpm check` on Linux, Windows and macOS. Only successful `main` pushes deploy to the existing `dist` branch. Dependabot proposes weekly dependency and Actions updates.
## 📦 Setup
### Get Project
```sh
# github
git clone https://github.com/XiaoDaiGua-Ray/ray-template.git
```
### Pull dependencies
```sh
pnpm install --frozen-lockfile
```
### Test project
```sh
pnpm test:run
```
### Startup project
```sh
pnpm dev
```
### Build project
Open [http://127.0.0.1:9527/ray-template/](http://127.0.0.1:9527/ray-template/) or use the URL printed by Vite. The prefilled demo sign-in and mock data let you run the template before connecting a backend.
```sh
pnpm build
## Project structure
```text
.
├── src/
│ ├── main.ts # Bootstraps the app, router, state, and i18n
│ ├── App.tsx # Root component with global providers and layout
│ ├── views/ # Sign-in, dashboard, business pages, and demos
│ │ └── demo/ # TablePro, layout playground, and hook examples
│ ├── router/
│ │ └── modules/ # Page routes, menu metadata, and roles
│ ├── layout/ # Navigation, page tabs, breadcrumbs, and content
│ ├── components/ # Shared UI exported through @/components
│ ├── app-components/ # App-specific UI and global providers
│ ├── api/ # API functions grouped by feature
│ ├── axios/ # HTTP client, interceptors, and cancellation
│ ├── store/ # Pinia modules and access methods
│ ├── hooks/ # Template, component, and browser composables
│ ├── app-config/ # App, routing, theme, and language settings
│ ├── locales/ # English and Simplified Chinese messages
│ ├── icons/ # Grouped SVG sources and generated manifest
│ ├── styles/ # Global styles, design tokens, and theme overrides
│ ├── directives/ # Global Vue directives
│ ├── types/ # Shared types and declarations
│ ├── utils/ # Shared utility functions
│ └── demo-data/ # Sample data for mock APIs and the static demo
├── mock/ # Mock endpoints for local development
├── public/ # Static assets copied into the build as is
├── vite-helper/ # Build helpers for icons, CDN, and SEO
├── vite.config.ts # Vite entry for development and builds
├── vite.custom.config.ts # Deployment base, dev proxy, and build options
├── tsconfig.json # References the app, Node, and test TS projects
├── package.json # Dependencies, runtime versions, and commands
├── scripts/ # Environment checks and icon generation
├── __test__/ # Vitest suites and test utilities
├── harness/ # Task scopes, targeted checks, and report generation
├── .github/workflows/ # CI checks and GitHub Pages deployment
└── docs/ # Architecture, design, and engineering conventions
```
### Preview project
See the [architecture map](docs/architecture.md) for how these modules work together.
```sh
pnpm preview
## Build your first business page
This small people directory uses the template's mock query function. To adapt it for orders or inventory, replace the columns, search fields, and request function.
```tsx
import { getPersonList } from '@/api/demo/mock/person'
import { RTablePro } from '@/components'
import { defineComponent } from 'vue'
export default defineComponent({
setup() {
return () => (
<RTablePro
columns={[
{ title: 'Name', key: 'name' },
{ title: 'Email', key: 'email' },
]}
request={getPersonList}
search={[{ key: 'name', label: 'Name' }]}
columnStateKey="demo:people"
/>
)
},
})
```
### Report project
1. **Build the view.** Add a page in `src/views`. The [remote table example](src/views/demo/tables/remote.tsx) shows sorting, row selection, and toolbar actions.
2. **Connect navigation.** Add a route in `src/router/modules` and give its menu entry English and Simplified Chinese labels. Follow the [routing guide](src/router/README.md) when setting up page caching.
3. **Connect your data.** Define your API in `src/api`, use `src/axios` for interceptors and request cancellation, and connect your real sign-in and session. The people directory uses a mock HTTP endpoint in development and sample data in the static preview. [Request layer guide](src/axios/README.md)
```sh
pnpm report
```
## Checks, builds, and deployment
### Development
| Command | What it does |
| ----------------------------- | ------------------------------------------------------------------------------------------- |
| `pnpm test:run` | Run the Vitest suite |
| `pnpm check` | Run the same checks as CI, including types, lint, formatting, tests, and a production build |
| `pnpm harness context` | Find entry points and checks for areas such as routing, UI, and APIs |
| `pnpm harness verify` | Run the full check and save a local report, or pass a scope to run targeted checks |
| `pnpm build` / `pnpm preview` | Build into `dist/production` or serve the build locally |
Just delete the files under `views/demo`, `router/modules/demo` to get a clean project template.
Use the [architecture map](docs/architecture.md) to find module and configuration entry points. See the [deployment guide](docs/architecture.md#deployment-and-search-discovery) for root or subpath hosting and search metadata. Contributors and coding agents share the instructions in [AGENTS.md](AGENTS.md) and the [AI Harness](harness/README.md).
## 🪴 Project Activities
![Alt](https://repobeats.axiom.co/api/embed/fab6071297ab281913a42f07a2779b488cfd62b8.svg 'Repobeats analytics image')
### Contributors
Thanks for all their contributions 🐝 !
<a href="https://github.com/XiaoDaiGua-Ray/ray-template/graphs/contributors">
<img src="https://contrib.rocks/image?repo=XiaoDaiGua-Ray/ray-template" />
</a>
## Browser Support
Build target: Vite 8 Baseline Widely Available (Chrome/Edge 111+, Firefox 114+, Safari/iOS 16.4+). Test product changes in current browsers; no IE support.
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt=" Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt=" Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
## 📄 License
[MIT License](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/LICENSE) © 2022-PRESENT [Ray](https://github.com/XiaoDaiGua-Ray)
## Hooks, Layout & Icons
- [Hooks examples](src/hooks/README.md): `/template-hooks`, `/web-hooks`, covering all 19 custom hooks.
- [Layout modes and slots](src/layout/README.md): `/layout-demo`, with live persistent preferences.
- [Namespaced SVG icons](src/icons/A_README.md): `/svg-icons`; `pnpm icons:generate`, `pnpm icons:check`.
- [Pinia state](src/store/README.md): temporary UI state in `runtime`, saved preferences in `setting`.
[MIT License](LICENSE) · [Changelog](CHANGELOG.md) · [Issues](https://github.com/XiaoDaiGua-Ray/ray-template/issues)

View File

@ -1,198 +1,145 @@
<div align="center">
<a href="https://github.com/XiaoDaiGua-Ray/ray-template">
<img
alt="Ray Template"
width="200"
height="200"
src="https://avatars.githubusercontent.com/u/51957438?v=4"
/>
</a>
<br />
<br />
<a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/vite.svg" alt="node compatibility"></a>
<a href="https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/LICENSE"
><img
src="https://img.shields.io/github/license/XiaoDaiGua-Ray/ray-template"
alt="LICENSE"
/></a>
<a href="#badge"><img src="https://img.shields.io/github/languages/top/XiaoDaiGua-Ray/ray-template" alt="language"></a>
<a href="https://www.npmjs.com/package/ray-template"><img src="https://img.shields.io/npm/v/ray-template" alt="npm package"></a>
</div>
# Ray Template · Vue 3 中后台管理模板
<div align="center">
[English](README.md) · **[在线演示](https://xiaodaigua-ray.github.io/ray-template/)** · **[在线文档](https://xiaodaigua-ray.github.io/ray-template-doc/)** · [快速开始](#快速开始)
# Ray Template
Ray Template 是一套**开箱即用的中后台前端模板**,适合搭建管理后台、运营工作台和内部工具。克隆后即可体验带权限菜单和多标签页的工作台,也可以直接把 TablePro 列表页、布局和路由模块用在业务里。
简体中文 | [English](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/README.md)
**技术栈**:Vue 3 · TypeScript / TSX · Naive UI · Vue Router · Pinia · Vue I18n · Vite / Rolldown · Axios · Vitest
一个 `完全免费`、`高效`、`特性完整` 并且基于 Vite 8、TypeScript、Pinia 和 Vue 3的中后台模板。
[![Ray Template 的 TablePro 人员列表,展示查询表单、分页、列设置及侧栏导航](docs/assets/tablepro-preview.jpg)](https://xiaodaigua-ray.github.io/ray-template/)
</div>
用演示页预填的表单登录,在「表格 → 远端查询与分页」可以体验图中的列表,或打开「布局实验室」调整工作台。
## 🌻 简介
## 核心能力
`Ray Template`采用前沿前端技术,摒弃繁杂与臃肿,采用模块化设计,解耦数据、方法和视图,专注业务开发。提供丰富配置和丰富的模板 `Hooks`,支持个性化定制,满足你的项目需求。
### TablePro:从纯表格到业务列表
## ✨ 特性
同一个 `RTablePro` 可以用 `bare` 只渲染表格,也可以接入搜索、分页和工具栏。列定义、行选择、排序和自定义单元格沿用 Naive UI DataTable 的写法。
- `全新技术栈:`使用 Vue 3 + TSX、Vite 8 / Rolldown、Pinia 4、Vue Router 5 与 Naive UI
- `主题:`可配置的主题
- `国际化:`内置完善的国际化方案
- `权限:`内置完善的动态路由权限生成方案
- `组件:`二次封装了多个常用的组件
- `工具包:`常用的工具函数封装
- `缓存:`任意深度页面缓存
- `模块化设计:`解耦管理的数据、方法、视图,放心二次开发
- `配置化:`支持丰富的配置项
- `代码风格:`内置 prettier, eslint 等代码风格工具
- `多端适配:`支持 pc, phone, pad
- `文档:`完善的文档
- `Mock 数据:`内置 Mock 数据方案
- `Axios 请求:`采用插件式设计二次封装 axios 库拦截器,让拦截器更加灵活
- `SVG:`内置 svg icon 解决方案
- `Hooks:`基于模板特性封装的 hooks 让你更加方便的使用模板一些功能
- `TypeScript:`提供完整的类型
- `Vitest:`内置 vitest 测试方案
- **查询和分页**:传入本地数据 `data`,或提供返回 `{ data, total }` 的 `request(params, signal)`。远端模式只接收最新请求的结果,失败时保留已有数据并提供重试。
- **长列表和列设置**:表格可填充工作区,配合虚拟滚动;用户可调整列的显示、顺序和固定位置,通过 `columnStateKey` 跨刷新记住隐藏列。
- **导出与打印**:默认导出和打印当前页的可见数据列。报表、单据等独立排版可指定自定义打印区域。
## 👀 预览地址
[TablePro 用法与数据契约](src/components/RTablePro/README.md)
- [点击预览](https://xiaodaigua-ray.github.io/ray-template/#/)
### 应用外壳:适配不同的后台工作方式
## 📌 文档地址
侧栏、顶部、混合导航可切换,窄屏自动改用菜单抽屉。工作区支持定宽或铺满、顶栏与页脚固定、内容最大化;用户的布局偏好由 Pinia 保存。可以在布局实验室实时调试,也可以用具名插槽替换顶栏、侧栏、标签栏和页脚。
- [文档](https://xiaodaigua-ray.github.io/ray-template-doc/)
标签页可在多个页面之间切换,面包屑标示当前位置,用 `⌘/Ctrl + K` 可以查找菜单。全局提供明暗主题和中英文切换。
## 🔋 更新日志
[布局实验室源码](src/views/demo/layout-demo.tsx) · [布局配置与插槽](src/layout/README.md)
- [更新日志](https://github.com/XiaoDaiGua-Ray/xiaodaigua-ray.github.io/blob/main/CHANGELOG.md)
### 路由模块:把页面、菜单与权限放在同一处配置
## 🪴 准备
在 `src/router/modules` 声明页面,模板按路由配置生成菜单和面包屑。路由 `meta` 可以配置菜单文案与图标、角色、显示条件和 `keepAlive`。从列表进入详情时,可以保留当前菜单和标签页,只在面包屑中补充详情层级。角色配置同时用于菜单过滤和直接导航时的守卫。接入业务时,由后端校验会话与接口权限。
- [Node](https://nodejs.org/) 和 [git](https://git-scm.com/) - 项目开发环境
- [Vite](https://vite.dev/) - 熟悉 vite 特性
- [Vue3](https://vuejs.org/) - 熟悉 Vue 基础语法
- [TypeScript](https://www.typescriptlang.org/) - 熟悉 TypeScript 基本语法
- [ES6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法
- [Vue-Hooks-Plus](https://inhiblabcore.github.io/docs/hooks/) - 熟悉 vue-hooks-plus useRequest 方法的基本使用
- [Vue-Router-Next](https://router.vuejs.org/) - 熟悉 vue-router4.x 基本使用
- [Naive-UI](https://www.naiveui.com) - naive ui 基本使用
- [Faker](https://fakerjs.dev/) - 本地化示例数据,配合 vite-plugin-mock-dev-server 提供 Mock 接口
- [Pinia](https://pinia.vuejs.org/zh/introduction.html) - 状态管理器 pinia 使用
- [TSX](https://github.com/vuejs/babel-plugin-jsx/blob/main/packages/babel-plugin-jsx/README-zh_CN.md) - tsx 基本语法
- [Vitest](https://cn.vitest.dev/guide/) - vitest 基本使用
[路由与菜单约定](src/router/README.md) · [多级菜单与缓存示例](src/router/modules/demo/multi-menu.ts)
## 工具链与 AI Harness
### 组件、Hooks 与图标:从可运行的示例里复用
使用 Node.js **26.13.0 LTS** 和 pnpm **12.16.1**,版本由 `.nvmrc`、`package.json` 与 `pnpm-lock.yaml` 固定。保留的直接依赖均使用当前稳定版;TypeScript 使用最新兼容版 **6.0.3**,因为 Vue 类型检查器与 ESLint 解析器尚未完整支持 TypeScript 7。详见 [升级记录与验证](docs/toolchain-upgrade.md)。
- **组件**:`RForm` 和 `RModal` 用于表单和弹窗场景,`RChart` 封装 ECharts 实例的初始化、尺寸与主题同步;另有 LogicFlow 流程图、条形码和拖拽卡片示例。[组件入口与约定](src/components/README.md)
- **Hooks**:模板 Hooks 处理页面刷新、内容最大化、菜单标记和水印;Web Hooks 展示截图、打印和元素全屏。交互示例提供可展开的用法代码。[Hooks 示例](src/hooks/README.md)
- **SVG**:把文件放入 `src/icons` 的对应分包即可生成类型提示和雪碧图。路由和 `RIcon` 使用同一套完整名称,例如 `navigation/dashboard`,图标库可按分包查找并复制 TSX 用法。[图标生成与使用](src/icons/A_README.md)
下面以 nvm 为例;使用 fnm 时,将前两行替换为 `fnm install && fnm use`。
## 快速开始
使用仓库固定的 **Node.js 26.13.0** 和 **pnpm 12.16.1**。以下以 nvm 为例:
```sh
git clone https://github.com/XiaoDaiGua-Ray/ray-template.git
cd ray-template
nvm install
nvm use
npm install --global pnpm@12.16.1
pnpm install --frozen-lockfile
pnpm env:check
pnpm check
```
| 命令 | 用途与产物 |
| --------------------------------- | ----------------------------------------------- |
| `pnpm dev` | 开发服务:`http://127.0.0.1:9527/ray-template/` |
| `pnpm typecheck` | 检查应用、测试、构建配置类型 |
| `pnpm lint` / `pnpm format:check` | 只读代码规范 / 格式检查 |
| `pnpm lint:fix` / `pnpm format` | 显式修复代码规范 / 格式 |
| `pnpm test:run` | 单次执行测试;`pnpm test` 为监听模式 |
| `pnpm build` | 类型检查并生成 `dist/production` |
| `pnpm dev-build` | 生成带 sourcemap 的 `dist/development` |
| `pnpm preview` | 本地预览生产产物 |
| `pnpm report` | 静态体积报告,不自动打开浏览器 |
| `pnpm check` | 检查 Harness、类型、规范、格式、单测和生产构建 |
检查失败时命令返回非零退出码。局域网调试按需执行 `pnpm dev --host 0.0.0.0`;部署子路径、CDN、代理和别名在 `vite.custom.config.ts` 中配置。
工程协作从 [AGENTS.md](AGENTS.md) 和 [AI Harness](harness/README.md) 开始。运行 `pnpm harness context` 查找任务入口,运行 `pnpm harness verify` 执行全量检查并保存本机验收报告。
CI 在 Linux、Windows、macOS 运行 `pnpm check`;`main` 的 push 仅在全部检查通过后更新原有 `dist` 部署分支。Dependabot 每周提出依赖与 Actions 更新 PR。
## 📦 起步
### 获取项目
```sh
# github
git clone https://github.com/XiaoDaiGua-Ray/ray-template.git
```
### 拉取依赖
```sh
pnpm install --frozen-lockfile
```
### 测试项目
```sh
pnpm test:run
```
### 启动项目
```sh
pnpm dev
```
### 项目打包
打开 [http://127.0.0.1:9527/ray-template/](http://127.0.0.1:9527/ray-template/),或使用 Vite 输出的地址。预填的演示账号可直接登录,本地开发无需先搭建业务后端。
```sh
pnpm build
## 工程结构
```text
.
├── src/
│ ├── main.ts # 初始化应用、路由、状态和国际化
│ ├── App.tsx # 根组件,挂载全局 Provider 与布局
│ ├── views/ # 登录页、工作台、业务页面和交互示例
│ │ └── demo/ # TablePro、布局实验室、Hooks 等示例
│ ├── router/
│ │ └── modules/ # 页面路由、菜单元数据与角色配置
│ ├── layout/ # 导航、标签页、面包屑与内容区
│ ├── components/ # 通用组件,统一从 @/components 导入
│ ├── app-components/ # 与应用状态绑定的组件和全局 Provider
│ ├── api/ # 按业务组织的接口函数
│ ├── axios/ # 请求实例、拦截器与取消机制
│ ├── store/ # Pinia 状态模块与访问方法
│ ├── hooks/ # 模板、组件和 Web 相关的组合式函数
│ ├── app-config/ # 应用、路由、主题与语言配置
│ ├── locales/ # 中英文语言包与加载逻辑
│ ├── icons/ # 分包 SVG 源文件与生成清单
│ ├── styles/ # 全局样式、设计变量与主题覆盖
│ ├── directives/ # 全局指令
│ ├── types/ # 共享类型与声明
│ ├── utils/ # 通用工具函数
│ └── demo-data/ # Mock 和静态演示共用的样例数据
├── mock/ # 开发环境 Mock 接口
├── public/ # 构建时原样复制的静态资源
├── vite-helper/ # 图标、CDN 和 SEO 等构建辅助
├── vite.config.ts # Vite 开发与构建入口
├── vite.custom.config.ts # 部署路径、开发代理和构建选项
├── tsconfig.json # 引用应用、Node 与测试的 TS 配置
├── package.json # 依赖、运行时版本与项目命令
├── scripts/ # 环境检查与图标生成
├── __test__/ # Vitest 测试与测试工具
├── harness/ # 任务域说明、定向验证与报告生成
├── .github/workflows/ # CI 检查与 GitHub Pages 部署
└── docs/ # 架构、设计与工程约定
```
### 预览项目
模块之间的调用关系见[架构地图](docs/architecture.md)。
```sh
pnpm preview
## 从示例改出第一个业务页面
下面是人员列表的最小接入。它使用仓库自带的 Mock 查询函数;换成订单或库存列表时,替换列定义、搜索字段与请求函数即可。
```tsx
import { getPersonList } from '@/api/demo/mock/person'
import { RTablePro } from '@/components'
import { defineComponent } from 'vue'
export default defineComponent({
setup() {
return () => (
<RTablePro
columns={[
{ title: '姓名', key: 'name' },
{ title: '邮箱', key: 'email' },
]}
request={getPersonList}
search={[{ key: 'name', label: '姓名' }]}
columnStateKey="demo:people"
/>
)
},
})
```
### 体积分析
1. **写页面**。在 `src/views` 新建页面,参考[远端查询示例](src/views/demo/tables/remote.tsx)加入排序、行选择和工具栏。
2. **接入导航**。在 `src/router/modules` 添加路由,给菜单配置中英文文案。页面需要缓存时,参考[路由约定](src/router/README.md)配置路由与组件名称。
3. **替换演示数据**。从 `src/api` 接入业务接口,通过 `src/axios` 统一处理拦截与取消,再接入实际登录和会话。人员列表示例在开发时走 Mock HTTP,静态预览使用本地样例数据。[请求层说明](src/axios/README.md)
```sh
pnpm report
```
## 检查、构建与部署
### 快速开发
| 命令 | 用途 |
| ----------------------------- | -------------------------------------------------------- |
| `pnpm test:run` | 运行 Vitest 测试 |
| `pnpm check` | 执行 CI 同款检查,包含类型、Lint、格式、测试和生产构建 |
| `pnpm harness context` | 按路由、UI、API 等任务域查找源码入口和验证命令 |
| `pnpm harness verify` | 执行全量检查并保存本地报告,也可以指定任务域进行定向验证 |
| `pnpm build` / `pnpm preview` | 输出到 `dist/production`,或在本机预览构建 |
只需要删除 `views/demo`, `router/modules/demo` 下的文件即可得到一个干净的项目模板。
二次开发可从[架构地图](docs/architecture.md)定位配置与模块。部署到域名根目录或子路径、为公开站点启用搜索元数据时,参考[部署指南](docs/architecture.md#deployment-and-search-discovery)。人工和 AI 协作共用 [AGENTS.md](AGENTS.md) 与 [AI Harness](harness/README.md)。
## 🪴 项目活动
![Alt](https://repobeats.axiom.co/api/embed/fab6071297ab281913a42f07a2779b488cfd62b8.svg 'Repobeats analytics image')
### 贡献者
感谢他们的所做的一切贡献 🐝 !
<a href="https://github.com/XiaoDaiGua-Ray/ray-template/graphs/contributors">
<img src="https://contrib.rocks/image?repo=XiaoDaiGua-Ray/ray-template" />
</a>
## 浏览器支持
构建目标为 Vite 8 Baseline Widely Available:Chrome/Edge 111+、Firefox 114+、Safari/iOS 16.4+。功能变化仍需在实际浏览器验证;不支持 IE。
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt=" Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt=" Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
## 📄 证书
[MIT License](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/LICENSE) © 2022-PRESENT [Ray](https://github.com/XiaoDaiGua-Ray)
## Hooks、布局与图标
- [工具分包与兼容契约](src/utils/README.md):公共工具入口、边界和回归测试。
- [Hooks 示例与约定](src/hooks/README.md):`/template-hooks`、`/web-hooks`,覆盖 19 个自定义 Hook。
- [布局模式与插槽](src/layout/README.md):`/layout-demo`,可即时调整并保存偏好。
- [分包图标与类型提示](src/icons/A_README.md):`/svg-icons`;使用 `pnpm icons:generate` 与 `pnpm icons:check` 维护名称。
- [全局状态](src/store/README.md):临时状态归入 Pinia `runtime`,偏好保留在 `setting`。
[MIT 许可证](LICENSE) · [更新日志](CHANGELOG.md) · [问题反馈](https://github.com/XiaoDaiGua-Ray/ray-template/issues)

View File

@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils'
import { RModal } from '../../src/components/base/RModal/index'
import { RModal } from '../../src/components/RModal/index'
describe('RModal', () => {
it('should execute the onAfterEnter callback', () => {

View File

@ -1,6 +1,6 @@
import { RTablePro } from '@/components/base/RTablePro'
import { useColumnVisibility } from '@/components/base/RTablePro/src/columns'
import ColumnSettings from '@/components/base/RTablePro/src/components/C'
import { RTablePro } from '@/components/RTablePro'
import { useColumnVisibility } from '@/components/RTablePro/src/columns'
import ColumnSettings from '@/components/RTablePro/src/components/C'
import { prefixCacheKey } from '@/utils/app/prefix-cache-key'
import { mount } from '@vue/test-utils'
import { NDataTable, NTree } from 'naive-ui'

View File

@ -1,7 +1,7 @@
import { RTablePro } from '@/components/base/RTablePro'
import type { TableProInst } from '@/components/base/RTablePro'
import { buildTableCsv } from '@/components/base/RTablePro/src/csv'
import * as printing from '@/components/base/RTablePro/src/printing'
import { RTablePro } from '@/components/RTablePro'
import type { TableProInst } from '@/components/RTablePro'
import { buildTableCsv } from '@/components/RTablePro/src/csv'
import * as printing from '@/components/RTablePro/src/printing'
import { mount } from '@vue/test-utils'
import type { DataTableColumn } from 'naive-ui'

View File

@ -1,9 +1,9 @@
import { RTablePro } from '@/components/base/RTablePro'
import { RTablePro } from '@/components/RTablePro'
import type {
TableProInst,
TableProParams,
TableProResult,
} from '@/components/base/RTablePro'
} from '@/components/RTablePro'
import { flushPromises, mount } from '@vue/test-utils'
import { NDataTable, NPagination } from 'naive-ui'

View File

@ -3,7 +3,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { iconNameFromPath, scanIcons } from '../../scripts/icons.mjs'
import type { IconProps } from '../../src/components/base/RIcon'
import type { IconProps } from '../../src/components/RIcon'
import { iconNames, isIconName, resolveIconName } from '../../src/icons'
import type { IconName } from '../../src/icons'

View File

@ -17,7 +17,7 @@ Ray Template 是前端中后台模板,包含可运行的组件与路由示例
| 全局状态 | `src/store/modules`、`src/store/hooks` | [Store 文档](../src/store/README.md),持久化配置使用 `pick`/`omit` |
| 请求与接口 | `src/api`、`src/axios` | [请求文档](../src/axios/README.md),请求/响应拦截器分开注册 |
| 演示接口 | `mock/demo`、`src/demo-data` | `vite-plugin-mock-dev-server`,生产环境按实际后端切换 |
| 通用组件 | `src/components/base`、`src/components/pro` | 组件、props、types、hook、样式放在同一功能目录 |
| 通用组件 | `src/components` | 组件、props、types、hook、样式放在同一功能目录 |
| 模板绑定组件 | `src/app-components` | [组件说明](../src/app-components/README.md) |
| 公共工具 | `src/utils` | [分包、兼容入口和测试](../src/utils/README.md) |
| 组合式函数 | `src/hooks/web`、`template`、`components` | [19 个 Hook 的示例与生命周期](../src/hooks/README.md),回归测试在 `__test__/hooks` |
@ -52,3 +52,11 @@ Ray Template 是前端中后台模板,包含可运行的组件与路由示例
| [测试](../tsconfig.test.json) | `__test__` 与引用源码,加载 Happy DOM 和 Node 类型 |
`pnpm typecheck` 通过 `vue-tsc --build` 检查三个项目,增量缓存存放于 `node_modules/.cache/ray-template/`。需要完整重查时使用 `pnpm exec vue-tsc --build --force`。单独检查应用或测试可用 `pnpm exec vue-tsc -p tsconfig.app.json` 或 `pnpm exec vue-tsc -p tsconfig.test.json`,Node 配置可用 `pnpm exec tsc -p tsconfig.node.json`。
## Deployment and search discovery
`pnpm build` 生成 `dist/production`;将该目录的内容部署到 `vite.custom.config.ts` 中 `base` 对应的路径。默认路径为 `/ray-template/`,部署在域名根目录时改用 `/`。
官方 GitHub Pages 部署会设置 `RAY_TEMPLATE_SITE_ORIGIN=https://xiaodaigua-ray.github.io`。如需让自己的公开部署被搜索引擎检索,在生产构建中设置该变量为实际站点源地址,例如 `https://example.com`,路径由 Vite 的 `base` 提供。在 fork 的 GitHub Actions 中可以使用同名的仓库变量。未设置时,构建输出 `noindex`,适合预览和内部部署。
公开构建在 HTML 中输出页面描述、规范链接(canonical)和分享预览,并生成 `sitemap.xml`。站点地图只列出公开首页;登录后的 hash 路由仍用作交互演示。可在 [Google Search Console](https://search.google.com/search-console/about) 提交部署路径下的 sitemap。若管理整个域名,也可从域名根目录的 `/robots.txt` 指向 sitemap;子目录里的 `robots.txt` 不会被识别。

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -153,6 +153,14 @@ Pinia 设置沿用原持久化 key,旧裸 Logo 名称在读取时迁移;锁
本机报告保存在 `.harness-local/runs/`,`npm pack --dry-run --ignore-scripts` 确认本机证据目录不进入发布包。Windows 和 Linux 的执行结果待远端 CI 验证,浏览器验收按 Harness 中的独立步骤执行。
## 2026-11-03 组件目录与公开演示的检索配置
通用组件统一放在 `src/components`,保留 `@/components` 入口并删除没有调用方的 `RCollapse`。双语 README 补充实际工作台截图、快速开始和二次开发入口。公开构建的 canonical、分享图和 sitemap 按 Vite base 生成,配置方式见[部署指南](architecture.md#deployment-and-search-discovery)。
- `pnpm harness verify` 通过类型、ESLint、Prettier、63 个测试文件的 265 个用例和生产构建。
- 检查了官方路径、自定义子路径与未设置站点源地址的构建。公开版本的首页、sitemap 和资源 URL 一致;普通构建输出 `noindex`。
- Chrome 生产预览验证了桌面双列、390px 单列、中英文与明暗切换、预填演示登录,以及关闭 JavaScript 时的项目介绍和链接。GitHub About 描述、演示地址和主题已回读确认;未部署网站构建或验证搜索引擎收录。
## 参考资料
- [Node.js 26.13.0 LTS](https://nodejs.org/en/blog/release/v26.13.0)

View File

@ -1,131 +1,150 @@
<!doctype html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/ray.svg" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>Vite + Vue + TS</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= siteInfo.title %></title>
<meta name="description" content="<%= siteInfo.description %>" />
<style>
:root {
--preloading-tag-color: <%= preloadingConfig.tagColor %>;
--preloading-title-color: <%= preloadingConfig.titleColor %>;
--r-theme-primary-fade-color: <%= appPrimaryColor.primaryFadeColor %>;
--r-theme-primary-color: <%= appPrimaryColor.primaryColor %>;
--global-loading-bg-color: #ffffff;
}
@media (prefers-color-scheme: dark) {
#pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
}
@media (prefers-color-scheme: light) {
#pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
}
html.dark #pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
html.light #pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
#pre-loading-animation {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
color: var(--preloading-title-color);
text-align: center;
background-color: var(--global-loading-bg-color);
}
#pre-loading-animation .pre-loading-animation__wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#pre-loading-animation
.pre-loading-animation__wrapper
.pre-loading-animation__wrapper-title {
font-size: 32px;
padding-bottom: 48px;
font-weight: 500;
}
.pre-loading-animation__wrapper-loading {
display: block;
position: relative;
width: 6px;
height: 10px;
animation: rectangle infinite 1s ease-in-out -0.2s;
background-color: var(--preloading-tag-color);
}
.pre-loading-animation__wrapper-loading:before,
.pre-loading-animation__wrapper-loading:after {
position: absolute;
width: 6px;
height: 10px;
content: '';
background-color: var(--preloading-tag-color);
}
.pre-loading-animation__wrapper-loading:before {
left: -14px;
animation: rectangle infinite 1s ease-in-out -0.4s;
}
.pre-loading-animation__wrapper-loading:after {
right: -14px;
animation: rectangle infinite 1s ease-in-out;
}
@keyframes rectangle {
0%,
80%,
100% {
height: 20px;
box-shadow: 0 0 var(--preloading-tag-color);
}
40% {
height: 30px;
box-shadow: 0 -20px var(--preloading-tag-color);
}
}
</style>
<script>
;(function () {
const html = document.documentElement
const store = window.localStorage.getItem('piniaSettingStore')
const { _appTheme = false } = store ? JSON.parse(store) : {}
const loadingBgColor = _appTheme ? '#1c1e23' : '#ffffff'
html.classList.add(_appTheme ? 'dark' : 'light')
html.style.setProperty('--global-loading-bg-color', loadingBgColor)
html.style.setProperty('background-color', loadingBgColor)
})()
</script>
<noscript>
<style>
#pre-loading-animation {
display: none;
}
</style>
</noscript>
</head>
<style>
:root {
--preloading-tag-color: <%= preloadingConfig.tagColor %>;
--preloading-title-color: <%= preloadingConfig.titleColor %>;
--r-theme-primary-fade-color: <%= appPrimaryColor.primaryFadeColor %>;
--r-theme-primary-color: <%= appPrimaryColor.primaryColor %>;
--global-loading-bg-color: #ffffff;
}
@media (prefers-color-scheme: dark) {
#pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
}
@media (prefers-color-scheme: light) {
#pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
}
html.dark #pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
html.light #pre-loading-animation {
background-color: var(--global-loading-bg-color);
}
#pre-loading-animation {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
color: var(--preloading-title-color);
text-align: center;
background-color: var(--global-loading-bg-color);
}
#pre-loading-animation .pre-loading-animation__wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#pre-loading-animation
.pre-loading-animation__wrapper
.pre-loading-animation__wrapper-title {
font-size: 32px;
padding-bottom: 48px;
font-weight: 500;
}
.pre-loading-animation__wrapper-loading {
display: block;
position: relative;
width: 6px;
height: 10px;
animation: rectangle infinite 1s ease-in-out -0.2s;
background-color: var(--preloading-tag-color);
}
.pre-loading-animation__wrapper-loading:before,
.pre-loading-animation__wrapper-loading:after {
position: absolute;
width: 6px;
height: 10px;
content: '';
background-color: var(--preloading-tag-color);
}
.pre-loading-animation__wrapper-loading:before {
left: -14px;
animation: rectangle infinite 1s ease-in-out -0.4s;
}
.pre-loading-animation__wrapper-loading:after {
right: -14px;
animation: rectangle infinite 1s ease-in-out;
}
@keyframes rectangle {
0%,
80%,
100% {
height: 20px;
box-shadow: 0 0 var(--preloading-tag-color);
}
40% {
height: 30px;
box-shadow: 0 -20px var(--preloading-tag-color);
}
}
</style>
<script>
;(function () {
const html = document.documentElement
const store = window.localStorage.getItem('piniaSettingStore')
const { _appTheme = false } = store ? JSON.parse(store) : {}
const loadingBgColor = _appTheme ? '#1c1e23' : '#ffffff'
html.classList.add(_appTheme ? 'dark' : 'light')
html.style.setProperty('--global-loading-bg-color', loadingBgColor)
html.style.setProperty('background-color', loadingBgColor)
})()
</script>
<body>
<div id="app"></div>
<noscript>
<main>
<h1><%= siteInfo.title %></h1>
<p><%= siteInfo.description %></p>
<p>启用 JavaScript 后可体验在线演示。</p>
<p>
<a href="<%= siteInfo.repository %>">GitHub 源码</a>
·
<a href="<%= siteInfo.repository %>/blob/main/README.zh-CN.md"
>中文使用指南</a
>
</p>
</main>
</noscript>
<div id="pre-loading-animation">
<div class="pre-loading-animation__wrapper">
<div class="pre-loading-animation__wrapper-title">

View File

@ -107,19 +107,22 @@
"vue-eslint-parser": "10.4.1",
"vue-tsc": "3.3.14"
},
"description": "Vue 3 + TypeScript + Vite admin template with Naive UI, Pinia and a repository engineering harness.",
"description": "Ray Template is an open-source Vue 3 admin dashboard template built with TypeScript (TSX), Vite and Naive UI. Includes role-based routing, responsive layouts and data tables.",
"main": "index.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/XiaoDaiGua-Ray/xiaodaigua-ray.github.io.git"
"url": "git+https://github.com/XiaoDaiGua-Ray/ray-template.git"
},
"keywords": [
"ray-template",
"vue3-tsx-vite-pinia",
"ray template",
"vite",
"admin-dashboard",
"admin-template",
"vue3",
"admin template",
"typescript",
"tsx",
"vite",
"naive-ui",
"pinia",
"中后台模板"
],
"license": "MIT",
@ -128,8 +131,8 @@
"url": "https://github.com/XiaoDaiGua-Ray"
},
"bugs": {
"url": "https://github.com/XiaoDaiGua-Ray/xiaodaigua-ray.github.io/issues"
"url": "https://github.com/XiaoDaiGua-Ray/ray-template/issues"
},
"homepage": "https://github.com/XiaoDaiGua-Ray/xiaodaigua-ray.github.io#readme",
"homepage": "https://xiaodaigua-ray.github.io/ray-template/",
"packageManager": "pnpm@12.16.1"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

View File

@ -50,11 +50,7 @@ export const LAYOUT_CONTENT_SPIN_WHEN_ROUTE_CHANGE = false
*/
export const APP_GLOBAL_LOADING = 'loading'
/**
*
* 首屏加载信息配置
* 其中 title 属性会是默认的浏览器标题(初始化时)
*/
/** 首屏加载动画显示的标题和颜色。 */
export const PRE_LOADING_CONFIG: PreloadingConfig = {
title: 'Ray Template',
tagColor: '#ff6700',

View File

@ -1,7 +1,7 @@
import type {
ChartThemeRawArray,
ChartThemeRawModules,
} from '@/components/base/RChart/src/types'
} from '@/components/RChart/src/types'
/**
*

View File

@ -1,4 +1,4 @@
import type { LoadingOptions } from '@/components/base/RChart/src/types'
import type { LoadingOptions } from '@/components/RChart/src/types'
import { useTheme } from '@/hooks'
/**

View File

@ -1,13 +1,13 @@
# 组件使用约定
基础组件在 `base`,组合组件在 `pro`;对外入口为 `src/components/index.ts`。优先复用 Naive UI 与现有组件,不把组件介绍复制到 `defineComponent` 前。
可复用组件按名称放在 `src/components` 下;通过 `@/components` 导入组件和类型。优先复用 Naive UI 与现有组件,不把组件介绍复制到 `defineComponent` 前。
## 非显然的调用约束
- `RCollapseGrid` 基于 Naive UI Grid,子项需要使用 `NGridItem`;折叠表单 `RCollapse` 的表单项需要使用 `NFormItemGi` / `NGridItem`。不要用普通容器替代 Grid 子项。
- `RCollapseGrid` 基于 Naive UI Grid,子项需要使用 `NGridItem`。不要用普通容器替代 Grid 子项。
- `RChart` 与 `useChart` 负责实例初始化、销毁、尺寸与主题同步;调用方维护 ECharts options,需要的图表与组件按现有 ECharts 注册方式引入。
- `PageResult` 基于 Naive UI Result,可作为组件或错误页面使用,保留继承的 props 与 slots。
- [TablePro](base/RTablePro/README.md) 统一支持纯表格、搜索与分页及自适应高度。列顺序配置以第一层列为单位,深层子列跟随根列。
- [TablePro](RTablePro/README.md) 统一支持纯表格、搜索与分页及自适应高度。列顺序配置以第一层列为单位,深层子列跟随根列。
- `RIcon.name` 为生成的完整分包路径类型,图标改动会在开发、HMR 和构建时同步;不要手工修改生成清单。
组件样式随组件入口加载。调整 Naive UI 内部元素时,使用当前组件的类名限定作用范围;组件需填满容器时由调用处或组件自身声明尺寸。全屏 `RModal` 的卡片正文仅在溢出时滚动,`RBarcode` 的加载区域随条码尺寸或响应式容器伸缩。

View File

@ -1,4 +1,4 @@
import { RIcon } from '@/components/base/RIcon'
import { RIcon } from '@/components/RIcon'
import type { IconName } from '@/icons'
import { NButton } from 'naive-ui'
import type { PropType } from 'vue'

View File

@ -1,34 +1,33 @@
import RDraggableCard from '../components/base/RDraggableCard/DraggableCard'
import RCollapse from '../components/pro/RCollapse/Collapse'
import RDraggableCard from './RDraggableCard/DraggableCard'
// 导出所有自定义组件
export * from './base/RChart'
export * from './base/RCollapseGrid'
export * from './base/RIcon'
export * from './base/RIframe'
export * from './base/RModal'
export * from './base/RMoreDropdown'
export * from './base/RTablePro'
export * from './base/RTransitionComponent'
export * from './base/RForm'
export * from './base/RSegment'
export * from './base/RBarcode'
export * from './base/RFlow'
export { RCollapse, RDraggableCard }
export * from './RChart'
export * from './RCollapseGrid'
export * from './RIcon'
export * from './RIframe'
export * from './RModal'
export * from './RMoreDropdown'
export * from './RTablePro'
export * from './RTransitionComponent'
export * from './RForm'
export * from './RSegment'
export * from './RBarcode'
export * from './RFlow'
export { RDraggableCard }
// 导出自定义组件类型
export type * from './base/RChart/src/types'
export type * from './base/RCollapseGrid/src/types'
export type * from './base/RIframe/src/types'
export type * from './base/RTransitionComponent/src/types'
export type * from './base/RForm/src/types'
export type * from './base/RModal/src/types'
export type * from './base/RSegment/src/types'
export type * from './base/RBarcode/src/types'
export type * from './RChart/src/types'
export type * from './RCollapseGrid/src/types'
export type * from './RIframe/src/types'
export type * from './RTransitionComponent/src/types'
export type * from './RForm/src/types'
export type * from './RModal/src/types'
export type * from './RSegment/src/types'
export type * from './RBarcode/src/types'
export type {
NodeConfig,
EdgeConfig,
FlowGraphData,
FlowOptions,
} from './base/RFlow/src/types'
export type { DefaultPosition } from './base/RDraggableCard/DraggableCard'
} from './RFlow/src/types'
export type { DefaultPosition } from './RDraggableCard/DraggableCard'

Some files were not shown because too many files have changed in this diff Show More