本文へ移動
cccskills
無料GitHub で公開

nuxt-components

PowerX Nuxt 组件与 UModal/UFormField 规则。

インストール方法を見る

含まれるファイル(1)

  • SKILL.md3.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

PowerX Nuxt Components

步骤

  1. 打开 本文件内嵌规则。
  2. 按规则执行实现/校对。
  3. 完成后按核对清单验收。

核对点

  • 与 PowerX 当前代码结构、路径与命名一致。
  • 仅在传输层/契约层做职责内改动,不跨层越界。

规则(内嵌)

nuxt_components.yaml

kind: ruleset
name: plugin/crud/frontend/nuxt_components
version: 1

components:
  files:
    - target: web-admin/app/components/templates/TemplateForm.vue
      template: builtin/nuxt_component_form_modal
      params:
        # Nuxt UI 3.3.2:使用 UModal + v-model:open;按钮 color 使用 {primary|secondary|...}
        fields:
          - { key: "name", label: "Name", type: "text", required: true, max: 255 }
          - { key: "description", label: "Description", type: "textarea" }
          - { key: "content", label: "Content", type: "textarea" }

nuxt_ui:
  colors: [primary, secondary, success, info, warning, error, neutral]  # palette reference
  select:
    syntax: '<USelect v-model="value" :items="items" class="w-48" />'
    notes:
      - Use `items` (not `options`) to pass choices.
      - Add width classes (e.g., `w-full`) when needed.
  select_menu:
    syntax: |
      <USelectMenu
        v-model="value"
        :items="items"
        value-key="value"
        label-key="label"
        :portal="false"
        class="w-full"
      />
    notes:
      - "USelectMenu 支持搜索、多选,列表项仍然用 items 数组;可用于头像/自定义插槽场景。"
      - "在 UModal、抽屉等容器里必须设置 :portal=\"false\"(或传入 portal={ to: '#id' } 指向弹层外 DOM 节点),防止内容被 Teleport 到 aria-hidden 的祖先之外触发 `descendant retained focus` 告警。"
      - "如需默认选项结构,可使用 Nuxt UI 示例:const items = ref([{ label: 'xxx', value: 'xxx', avatar: { src: '...' } }]) 并传给 <USelectMenu v-model='value' :avatar='value?.avatar' :items='items' />。"
  modal:
    preferUModal: true
    paddingClass: "p-4 sm:p-5"
    width: "max-w-3xl w-full"
    notes:
      - 如需更宽的编辑表单,可覆盖 `ui.content`(例如 `'max-w-6xl w-[90vw] mx-auto'`)而不是直接设置 inline 样式,保持组件一致性。
      - 需要弹层交互的表单/内容必须放在 UModal 的 `#body` 内,由 `v-model:open` 控制显隐;不要把表单直接渲染在页面上再“看起来像弹层”。
    close:
      useCloseProp: true
      preventClose: true
    slots:
      body: Place form fields in `#body` slot to ensure they render.
      footer: Place action buttons in `#footer`.
      contentSlot: content
    accessibility:
      - Blur active element before closing to avoid aria-hidden focus warnings.
      - Provide `title` and `description` for dialog accessibility.
  form:
    useFormComponent: true
    schemaLibrary: valibot
    submitEvent: FormSubmitEvent
    layout:
      spacingClass: space-y-4
      containerClass: "p-4 sm:p-5"
      buttonsAlign: end
    fields:
      wrapWithFormField: true
      labelI18nKey: recommended
      inputs:
        useModelValue: true
        textareaRowsDefault: 3
    buttons:
      cancel:
        color: neutral
        variant: subtle
        type: button
      submit:
        color: primary
        type: submit
    dropdown_menu:
      items:
        handlerProp: onSelect
        notes:
          - "子项点击使用 `onSelect` 回调(Nuxt UI 3 语义),而不是自定义 click。例:`[{ label: '删除', icon: 'i-heroicons-trash', onSelect() { ... } }]`。"
    errorHandling:
      schemaValidation: true
      toastOnError: optional

gates.require: [PG-FE-UI-001]

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

PowerX API 命名与访问规范(/api/v1、/admin、/internal 边界)。

日本語の概要は準備中です。原文の説明を表示しています。

ArtisanCloud/PowerX3812026年10月11日 更新

PowerX 底座 Capability 治理与发布准入规则。用于审计 REST/OpenAPI/gRPC/Gin 生成的能力候选、正式 platform_capabilities 目录、Capability Registry 登记、agent_usable/permission_code/risk_level 元数据、ignore 清单和缺失能力;当用户要求“重新识别能力”“能力是否能发布”“补齐能力登记”“检查 capability-gen/audit/check”“底座接口暴露给插件/agent”时使用。

日本語の概要は準備中です。原文の説明を表示しています。

ArtisanCloud/PowerX3812026年10月11日 更新

PowerX REST 契约规则(资源命名、分页、错误、版本化)。

日本語の概要は準備中です。原文の説明を表示しています。

ArtisanCloud/PowerX3812026年10月11日 更新

crud-di

無料

PowerX CRUD 依赖注入规则(Deps 单入口、构造注入、跨传输复用)。

日本語の概要は準備中です。原文の説明を表示しています。

ArtisanCloud/PowerX3812026年10月11日 更新

crud-dto

無料

PowerX CRUD DTO 规则(输入输出分离、分页、校验)。

日本語の概要は準備中です。原文の説明を表示しています。

ArtisanCloud/PowerX3812026年10月11日 更新

crud-grpc

無料

PowerX CRUD gRPC 开发规范(proto、server、拦截器、错误映射)。

日本語の概要は準備中です。原文の説明を表示しています。

ArtisanCloud/PowerX3812026年10月11日 更新

ArtisanCloud のスキルをすべて見る

このスキルの問題を報告する