newlifex/newlife.cube/cube-page-override
Claude Code and agent skill by newlifex/newlife.cube
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
使用 @newlifex/cube-vue 的 Section 机制覆盖/扩展页面组件。 当用户说"覆盖页面"、"扩展页面"、"自定义组件"、"修改框架组件"时使用。 Section 机制允许在不修改框架源码的情况下,覆盖搜索栏、表格、操作按钮等页面区块。
Install
npx vskill@latest install newlifex/newlife.cube/cube-page-overrideSKILL.md
@newlifex/cube-vue 页面覆盖 (Section)
什么时候用
当用户需要修改/覆盖框架默认组件(如搜索栏、表格、分页),又不希望修改框架源码时使用。
Section 机制原理
命名规则
| 规则 | 说明 | |
|---|---|---|
| 大写开头 | 文件名必须以大写字母开头,如 ListSearchBar.vue | |
| PascalCase | 多个单词时首字母都大写,如 UserDetailHeader.vue | |
| 禁止小写 | index.vue、form.vue 等小写开头的文件不会被扫描 |
常用 Section 覆盖点
| Section 名称 | 覆盖位置 | 用途 | |
|---|---|---|---|
ListSearchBar.vue | 列表页面搜索栏 | 自定义搜索条件 | |
ListToolbar.vue | 列表工具栏 | 添加自定义按钮 | |
TableColumns.vue | 表格列配置 | 修改列定义 | |
FormFields.vue | 表单字段 | 自定义表单控件 | |
DetailHeader.vue | 详情页头部 | 自定义详情头部 | |
Pagination.vue | 分页组件 | 自定义分页样式 |
创建 Section 组件
示例:覆盖列表页搜索栏
1. 在应用的 views 目录下创建
2. 编写 Section 组件
示例:覆盖工具栏
红线 / 禁止自行发挥
以下为历史踩坑固化的强制约束,落实时严格照办,禁止凭记忆或"想当然"自行发挥:
- Section 文件名必须 PascalCase 大写开头:
ListSearchBar.vue/ListToolbar.vue合法;index.vue/form.vue/listSearchBar.vue不被扫描(Vite 插件只收大写开头文件,且排除index.vue)。命名错 = 覆盖不生效且无明显报错。 - Section 只能覆盖框架预设的覆盖点:先用「常用 Section 覆盖点」表确认框架有对应槽位,再写组件;不要臆造不存在的 Section 名。
- 样式规范(硬约束):Section 组件里也禁止硬编码色值、禁止私占
--cube-layout-*、禁止在scoped style覆盖--el-*、禁止定义任何自定义 CSS 变量;统一用--el-*token(如本技能示例中的.custom-search-bar/.custom-toolbar已改为var(--el-bg-color)、var(--el-border-color-lighter)等)。 - 不要手写路由注册 Section:Section 由
initApp()的registerPageSections()自动注册(虚拟模块virtual:@newlifex/cube-vue-sections),不要在routes.ts/main.ts里手动引入。 - 与父组件通信只允许 `defineEmits` 约定事件:不要直接改父组件内部状态,按示例用
search/reset/refresh/open等事件回传。
与父组件通信
Section 组件通过 defineEmits 与父组件通信:
自动注册
Vite 插件会自动扫描并注册 Section 组件:
- 插件在构建时扫描
views/目录 - 收集所有以大写字母开头的
.vue文件 - 通过
virtual:@newlifex/cube-vue-sections虚拟模块导出 initApp()时自动调用registerPageSections()注册
调试 Section
确认 Section 是否生效:
- 打开浏览器开发者工具
- 在 Vue Devtools 中查看
pageSections状态 - 或检查控制台输出的 Section 注册信息
限制
- Section 组件只能覆盖框架预设的覆盖点
- 需要先确认框架是否有对应的覆盖点
- 组件名称必须严格遵守大写开头规则
示例:完整覆盖用户列表页
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingNewLife.Cube.Vue/skills/cube-page-override/SKILL.md
Popularity
- Repository stars
- 629
- Repository forks
- 167
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/newlifex/newlife.cube/cube-page-override)