5.2 KiB
Pages, shared components, hooks, and directives
Use this topic when adding or changing pages, shared UI, themes, bilingual copy, Vue hooks, or directives. TablePro and layout have narrower entry points: tables and layout.
| Question | Read first | Follow through |
|---|---|---|
| Pages, login, and demos | Views, login page, demo page structure | Route registration, visual conventions |
| Shared components such as Modal, Segment, charts, and barcodes | Application component entry point, shared UI exports | Implementations, API reference |
| Components and providers that depend on template state | Application component guide | App composition, Naive UI autocomplete defaults |
| Themes, styles, and application copy | Design configuration, style entry point, locale resources | Application theme hook, shared theme, documentation-site styles |
| Hooks and global directives | Application hooks, shared composables, application directive registration | Hook guide, shared directives, directive usage |
The application's @/components and some hook/directive paths retain compatibility exports. Follow exports into the owning shared package before fixing common behavior. Inject host-specific services instead of referencing application aliases from shared packages. Add both Chinese and English for new interface copy.
For custom CSS, follow the semantic-token and scope contract, then use the reader recipe or independent-host example. The authoritative token definitions remain in theme.css and its mapping; do not copy preset palettes into page styles.
Before adding a component, check existing capabilities using the Harness reuse conventions. For full-height content and independent scrolling, start with TablePro height styles, layout height variables, and the user management page. RTablePro autoHeight uses --r-table-height to fill its host. Naive UI's NCard contentScrollable and NScrollbar handle scrolling; the parent uses Flex/Grid and min-block-size: 0 to provide a definite height that can shrink.
Targeted verification: for small fixes, run the relevant component, hook, or cross-package consumer test file. Use pnpm harness verify ui for scope-level regression coverage; it runs Vitest without launching a browser. For visible effects or interactions, choose pages and dimensions using Harness browser verification.