From cf350b3c30d70586412335d442f89968cf743c4e Mon Sep 17 00:00:00 2001 From: XiaoDaiGua-Ray <51957438+XiaoDaiGua-Ray@users.noreply.github.com> Date: Wed, 4 Nov 2026 06:13:31 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20dist=20from=20@=20XiaoDaiGua-R?= =?UTF-8?q?ay/ray-template@97f832c66fd112c37f09071f26955deec1d53cff=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/404.html | 2 +- ...bFh.js => guide_appearance.md.CJX6CZmO.js} | 4 ++-- ...s => guide_appearance.md.CJX6CZmO.lean.js} | 2 +- .../guide_architecture.md.C6HIHYR1.lean.js | 1 - ...1.js => guide_architecture.md.DA6wtiPl.js} | 4 ++-- .../guide_architecture.md.DA6wtiPl.lean.js | 1 + ...Crx.js => guide_first-page.md.BrDGu5p2.js} | 2 +- ...s => guide_first-page.md.BrDGu5p2.lean.js} | 0 ...7nfsGPS.js => guide_layout.md.C3sxtphB.js} | 2 +- ...an.js => guide_layout.md.C3sxtphB.lean.js} | 0 ...GH_Ni.js => guide_requests.md.bt5MV3ze.js} | 4 ++-- ....js => guide_requests.md.bt5MV3ze.lean.js} | 0 ...hQoTmx.js => guide_routing.md.saWWeode.js} | 6 +++--- ...n.js => guide_routing.md.saWWeode.lean.js} | 4 ++-- ...B6oCR027.js => guide_start.md.DGuorSaq.js} | 4 ++-- ...ean.js => guide_start.md.DGuorSaq.lean.js} | 2 +- ...JoP04H.js => guide_tooling.md.-PnA0rJL.js} | 2 +- docs/assets/guide_tooling.md.-PnA0rJL.lean.js | 1 + docs/assets/guide_tooling.md.CkJoP04H.lean.js | 1 - ...js => reference_components.md.Vx6LcOjp.js} | 2 +- ... reference_components.md.Vx6LcOjp.lean.js} | 2 +- ...> reference_components_app.md.Bqi2MKtD.js} | 4 ++-- ...erence_components_app.md.Bqi2MKtD.lean.js} | 0 ...ference_components_barcode.md.DepkAiNq.js} | 2 +- ...ce_components_barcode.md.DepkAiNq.lean.js} | 0 ...reference_components_chart.md.Z0MZ0zwB.js} | 2 +- ...ence_components_chart.md.Z0MZ0zwB.lean.js} | 0 ...e_components_collapse-grid.md.CV_6fiGv.js} | 2 +- ...ponents_collapse-grid.md.CV_6fiGv.lean.js} | 0 ..._components_draggable-card.md.DqkOgOtj.js} | 2 +- ...onents_draggable-card.md.DqkOgOtj.lean.js} | 0 ... reference_components_flow.md.bnqgmwU4.js} | 2 +- ...rence_components_flow.md.bnqgmwU4.lean.js} | 0 ... reference_components_form.md.DKqUuydU.js} | 2 +- ...rence_components_form.md.DKqUuydU.lean.js} | 0 ...ence_components_iframe.md.CZP63QsN.lean.js | 1 - ...eference_components_iframe.md.Dy1_3Nzn.js} | 4 ++-- ...ence_components_iframe.md.Dy1_3Nzn.lean.js | 1 + ...reference_components_modal.md.DPqflFk-.js} | 2 +- ...ence_components_modal.md.DPqflFk-.lean.js} | 0 ...e_components_more-dropdown.md.P5PZdsXi.js} | 4 ++-- ...ponents_more-dropdown.md.P5PZdsXi.lean.js} | 2 +- ...ference_components_qr-code.md.CjRPLYOy.js} | 4 ++-- ...ce_components_qr-code.md.CjRPLYOy.lean.js} | 2 +- ...omponents_route-transition.md.DhUbCAYx.js} | 2 +- ...ents_route-transition.md.DhUbCAYx.lean.js} | 0 ...ference_components_segment.md.ClmNr5bX.js} | 2 +- ...ce_components_segment.md.ClmNr5bX.lean.js} | 0 .../reference_configuration.md.B-ScBw16.js | 1 + ...eference_configuration.md.B-ScBw16.lean.js | 1 + .../reference_configuration.md.BeYwV4AY.js | 1 - ...eference_configuration.md.BeYwV4AY.lean.js | 1 - ...js => reference_directives.md.B7ge4Qql.js} | 12 ++++++------ ... reference_directives.md.B7ge4Qql.lean.js} | 2 +- ...ntnz.js => reference_hooks.md.B4xmkbad.js} | 2 +- .../reference_hooks.md.B4xmkbad.lean.js | 1 + .../reference_hooks.md.fkz_ntnz.lean.js | 1 - ...reference_hooks_appearance.md.DMkYAmsP.js} | 4 ++-- ...rence_hooks_appearance.md.DMkYAmsP.lean.js | 1 + ...rence_hooks_appearance.md.JMrRj834.lean.js | 1 - ...=> reference_hooks_browser.md.Mj7VwVYF.js} | 2 +- ...ference_hooks_browser.md.Mj7VwVYF.lean.js} | 0 ...eference_hooks_interaction.md.C4zawhnF.js} | 2 +- ...nce_hooks_interaction.md.C4zawhnF.lean.js} | 0 ... => reference_hooks_layout.md.DusPdzbc.js} | 2 +- ...eference_hooks_layout.md.DusPdzbc.lean.js} | 0 ...reference_hooks_navigation.md.BowABOxT.js} | 4 ++-- ...ence_hooks_navigation.md.BowABOxT.lean.js} | 2 +- ... => reference_hooks_output.md.D12chI92.js} | 2 +- ...eference_hooks_output.md.D12chI92.lean.js} | 0 ...uJHp.js => reference_icons.md.CbIxhVM1.js} | 4 ++-- ...js => reference_icons.md.CbIxhVM1.lean.js} | 2 +- ...IfO.js => reference_source.md.Ces0B5lP.js} | 2 +- ...s => reference_source.md.Ces0B5lP.lean.js} | 2 +- ...C8BP.js => reference_store.md.D4ZVWtNT.js} | 2 +- ...js => reference_store.md.D4ZVWtNT.lean.js} | 2 +- ...reference_store_navigation.md.W6y0Xj28.js} | 2 +- ...ence_store_navigation.md.W6y0Xj28.lean.js} | 0 ...=> reference_store_runtime.md.BH0FRgPU.js} | 4 ++-- ...ference_store_runtime.md.BH0FRgPU.lean.js} | 2 +- ...=> reference_store_setting.md.CzmU2eha.js} | 2 +- ...ference_store_setting.md.CzmU2eha.lean.js} | 0 ...=> reference_store_signing.md.wgsmw69Q.js} | 4 ++-- ...ference_store_signing.md.wgsmw69Q.lean.js} | 2 +- ....js => reference_table-pro.md.DdZZh1Tr.js} | 2 +- ...> reference_table-pro.md.DdZZh1Tr.lean.js} | 0 ...FGYU.js => reference_utils.md.B6bCkjBM.js} | 2 +- ...js => reference_utils.md.B6bCkjBM.lean.js} | 2 +- ...=> reference_utils_browser.md.JR-xHE7d.js} | 4 ++-- ...ference_utils_browser.md.JR-xHE7d.lean.js} | 2 +- ...js => reference_utils_core.md.CW4tagj9.js} | 2 +- ... reference_utils_core.md.CW4tagj9.lean.js} | 0 ...=> reference_utils_storage.md.CIn4_Wqq.js} | 4 ++-- ...ference_utils_storage.md.CIn4_Wqq.lean.js} | 2 +- docs/guide/appearance.html | 6 +++--- docs/guide/architecture.html | 6 +++--- docs/guide/first-page.html | 6 +++--- docs/guide/layout.html | 6 +++--- docs/guide/requests.html | 8 ++++---- docs/guide/routing.html | 6 +++--- docs/guide/start.html | 6 +++--- docs/guide/tooling.html | 6 +++--- docs/hashmap.json | 2 +- docs/index.html | 2 +- docs/migration.html | 2 +- docs/playground/shell.html | 2 +- docs/reference/components.html | 6 +++--- docs/reference/components/app.html | 8 ++++---- docs/reference/components/barcode.html | 6 +++--- docs/reference/components/chart.html | 6 +++--- docs/reference/components/collapse-grid.html | 6 +++--- docs/reference/components/draggable-card.html | 6 +++--- docs/reference/components/flow.html | 6 +++--- docs/reference/components/form.html | 6 +++--- docs/reference/components/iframe.html | 6 +++--- docs/reference/components/modal.html | 6 +++--- docs/reference/components/more-dropdown.html | 6 +++--- docs/reference/components/qr-code.html | 6 +++--- .../components/route-transition.html | 6 +++--- docs/reference/components/segment.html | 6 +++--- docs/reference/configuration.html | 6 +++--- docs/reference/directives.html | 14 +++++++------- docs/reference/hooks.html | 6 +++--- docs/reference/hooks/appearance.html | 6 +++--- docs/reference/hooks/browser.html | 6 +++--- docs/reference/hooks/interaction.html | 6 +++--- docs/reference/hooks/layout.html | 6 +++--- docs/reference/hooks/navigation.html | 6 +++--- docs/reference/hooks/output.html | 6 +++--- docs/reference/icons.html | 6 +++--- docs/reference/index.html | 2 +- docs/reference/source.html | 6 +++--- docs/reference/store.html | 6 +++--- docs/reference/store/navigation.html | 6 +++--- docs/reference/store/runtime.html | 6 +++--- docs/reference/store/setting.html | 6 +++--- docs/reference/store/signing.html | 6 +++--- docs/reference/table-pro.html | 6 +++--- docs/reference/utils.html | 6 +++--- docs/reference/utils/browser.html | 6 +++--- docs/reference/utils/core.html | 6 +++--- docs/reference/utils/storage.html | 6 +++--- mockServer/mock-data.js | 6 +++--- mockServer/mock-data.js.gz | Bin 1180 -> 1180 bytes 144 files changed, 232 insertions(+), 232 deletions(-) rename docs/assets/{guide_appearance.md.D-523bFh.js => guide_appearance.md.CJX6CZmO.js} (94%) rename docs/assets/{guide_appearance.md.D-523bFh.lean.js => guide_appearance.md.CJX6CZmO.lean.js} (53%) delete mode 100644 docs/assets/guide_architecture.md.C6HIHYR1.lean.js rename docs/assets/{guide_architecture.md.C6HIHYR1.js => guide_architecture.md.DA6wtiPl.js} (91%) create mode 100644 docs/assets/guide_architecture.md.DA6wtiPl.lean.js rename docs/assets/{guide_first-page.md.z-hytCrx.js => guide_first-page.md.BrDGu5p2.js} (98%) rename docs/assets/{guide_first-page.md.z-hytCrx.lean.js => guide_first-page.md.BrDGu5p2.lean.js} (100%) rename docs/assets/{guide_layout.md.B7nfsGPS.js => guide_layout.md.C3sxtphB.js} (99%) rename docs/assets/{guide_layout.md.B7nfsGPS.lean.js => guide_layout.md.C3sxtphB.lean.js} (100%) rename docs/assets/{guide_requests.md.DXAGH_Ni.js => guide_requests.md.bt5MV3ze.js} (96%) rename docs/assets/{guide_requests.md.DXAGH_Ni.lean.js => guide_requests.md.bt5MV3ze.lean.js} (100%) rename docs/assets/{guide_routing.md.CyhQoTmx.js => guide_routing.md.saWWeode.js} (95%) rename docs/assets/{guide_routing.md.CyhQoTmx.lean.js => guide_routing.md.saWWeode.lean.js} (90%) rename docs/assets/{guide_start.md.B6oCR027.js => guide_start.md.DGuorSaq.js} (92%) rename docs/assets/{guide_start.md.B6oCR027.lean.js => guide_start.md.DGuorSaq.lean.js} (83%) rename docs/assets/{guide_tooling.md.CkJoP04H.js => guide_tooling.md.-PnA0rJL.js} (89%) create mode 100644 docs/assets/guide_tooling.md.-PnA0rJL.lean.js delete mode 100644 docs/assets/guide_tooling.md.CkJoP04H.lean.js rename docs/assets/{reference_components.md.iMZjSjdU.js => reference_components.md.Vx6LcOjp.js} (86%) rename docs/assets/{reference_components.md.iMZjSjdU.lean.js => reference_components.md.Vx6LcOjp.lean.js} (62%) rename docs/assets/{reference_components_app.md.Q6aQiDRo.js => reference_components_app.md.Bqi2MKtD.js} (96%) rename docs/assets/{reference_components_app.md.Q6aQiDRo.lean.js => reference_components_app.md.Bqi2MKtD.lean.js} (100%) rename docs/assets/{reference_components_barcode.md.BbJVFbEo.js => reference_components_barcode.md.DepkAiNq.js} (99%) rename docs/assets/{reference_components_barcode.md.BbJVFbEo.lean.js => reference_components_barcode.md.DepkAiNq.lean.js} (100%) rename docs/assets/{reference_components_chart.md.JthpvMcl.js => reference_components_chart.md.Z0MZ0zwB.js} (96%) rename docs/assets/{reference_components_chart.md.JthpvMcl.lean.js => reference_components_chart.md.Z0MZ0zwB.lean.js} (100%) rename docs/assets/{reference_components_collapse-grid.md._8SHiB6D.js => reference_components_collapse-grid.md.CV_6fiGv.js} (97%) rename docs/assets/{reference_components_collapse-grid.md._8SHiB6D.lean.js => reference_components_collapse-grid.md.CV_6fiGv.lean.js} (100%) rename docs/assets/{reference_components_draggable-card.md.4XemeqwB.js => reference_components_draggable-card.md.DqkOgOtj.js} (97%) rename docs/assets/{reference_components_draggable-card.md.4XemeqwB.lean.js => reference_components_draggable-card.md.DqkOgOtj.lean.js} (100%) rename docs/assets/{reference_components_flow.md.s-rnj-8X.js => reference_components_flow.md.bnqgmwU4.js} (96%) rename docs/assets/{reference_components_flow.md.s-rnj-8X.lean.js => reference_components_flow.md.bnqgmwU4.lean.js} (100%) rename docs/assets/{reference_components_form.md.BrB2cmbN.js => reference_components_form.md.DKqUuydU.js} (98%) rename docs/assets/{reference_components_form.md.BrB2cmbN.lean.js => reference_components_form.md.DKqUuydU.lean.js} (100%) delete mode 100644 docs/assets/reference_components_iframe.md.CZP63QsN.lean.js rename docs/assets/{reference_components_iframe.md.CZP63QsN.js => reference_components_iframe.md.Dy1_3Nzn.js} (92%) create mode 100644 docs/assets/reference_components_iframe.md.Dy1_3Nzn.lean.js rename docs/assets/{reference_components_modal.md.bQ_aJsj-.js => reference_components_modal.md.DPqflFk-.js} (96%) rename docs/assets/{reference_components_modal.md.bQ_aJsj-.lean.js => reference_components_modal.md.DPqflFk-.lean.js} (100%) rename docs/assets/{reference_components_more-dropdown.md.BubiDbuv.js => reference_components_more-dropdown.md.P5PZdsXi.js} (95%) rename docs/assets/{reference_components_more-dropdown.md.BubiDbuv.lean.js => reference_components_more-dropdown.md.P5PZdsXi.lean.js} (68%) rename docs/assets/{reference_components_qr-code.md.BtXSFJtd.js => reference_components_qr-code.md.CjRPLYOy.js} (96%) rename docs/assets/{reference_components_qr-code.md.BtXSFJtd.lean.js => reference_components_qr-code.md.CjRPLYOy.lean.js} (72%) rename docs/assets/{reference_components_route-transition.md.Dg7dX5PR.js => reference_components_route-transition.md.DhUbCAYx.js} (97%) rename docs/assets/{reference_components_route-transition.md.Dg7dX5PR.lean.js => reference_components_route-transition.md.DhUbCAYx.lean.js} (100%) rename docs/assets/{reference_components_segment.md.BrQOf2XY.js => reference_components_segment.md.ClmNr5bX.js} (95%) rename docs/assets/{reference_components_segment.md.BrQOf2XY.lean.js => reference_components_segment.md.ClmNr5bX.lean.js} (100%) create mode 100644 docs/assets/reference_configuration.md.B-ScBw16.js create mode 100644 docs/assets/reference_configuration.md.B-ScBw16.lean.js delete mode 100644 docs/assets/reference_configuration.md.BeYwV4AY.js delete mode 100644 docs/assets/reference_configuration.md.BeYwV4AY.lean.js rename docs/assets/{reference_directives.md.DZcDGixq.js => reference_directives.md.B7ge4Qql.js} (93%) rename docs/assets/{reference_directives.md.DZcDGixq.lean.js => reference_directives.md.B7ge4Qql.lean.js} (54%) rename docs/assets/{reference_hooks.md.fkz_ntnz.js => reference_hooks.md.B4xmkbad.js} (84%) create mode 100644 docs/assets/reference_hooks.md.B4xmkbad.lean.js delete mode 100644 docs/assets/reference_hooks.md.fkz_ntnz.lean.js rename docs/assets/{reference_hooks_appearance.md.JMrRj834.js => reference_hooks_appearance.md.DMkYAmsP.js} (94%) create mode 100644 docs/assets/reference_hooks_appearance.md.DMkYAmsP.lean.js delete mode 100644 docs/assets/reference_hooks_appearance.md.JMrRj834.lean.js rename docs/assets/{reference_hooks_browser.md.D5n_xtb0.js => reference_hooks_browser.md.Mj7VwVYF.js} (98%) rename docs/assets/{reference_hooks_browser.md.D5n_xtb0.lean.js => reference_hooks_browser.md.Mj7VwVYF.lean.js} (100%) rename docs/assets/{reference_hooks_interaction.md.Big820ZZ.js => reference_hooks_interaction.md.C4zawhnF.js} (98%) rename docs/assets/{reference_hooks_interaction.md.Big820ZZ.lean.js => reference_hooks_interaction.md.C4zawhnF.lean.js} (100%) rename docs/assets/{reference_hooks_layout.md.BcnUJtrr.js => reference_hooks_layout.md.DusPdzbc.js} (97%) rename docs/assets/{reference_hooks_layout.md.BcnUJtrr.lean.js => reference_hooks_layout.md.DusPdzbc.lean.js} (100%) rename docs/assets/{reference_hooks_navigation.md.CGGlTsKj.js => reference_hooks_navigation.md.BowABOxT.js} (96%) rename docs/assets/{reference_hooks_navigation.md.CGGlTsKj.lean.js => reference_hooks_navigation.md.BowABOxT.lean.js} (71%) rename docs/assets/{reference_hooks_output.md.B8QXZTOo.js => reference_hooks_output.md.D12chI92.js} (97%) rename docs/assets/{reference_hooks_output.md.B8QXZTOo.lean.js => reference_hooks_output.md.D12chI92.lean.js} (100%) rename docs/assets/{reference_icons.md.lwCUuJHp.js => reference_icons.md.CbIxhVM1.js} (95%) rename docs/assets/{reference_icons.md.lwCUuJHp.lean.js => reference_icons.md.CbIxhVM1.lean.js} (68%) rename docs/assets/{reference_source.md.M6GWIIfO.js => reference_source.md.Ces0B5lP.js} (88%) rename docs/assets/{reference_source.md.M6GWIIfO.lean.js => reference_source.md.Ces0B5lP.lean.js} (69%) rename docs/assets/{reference_store.md.BykMC8BP.js => reference_store.md.D4ZVWtNT.js} (92%) rename docs/assets/{reference_store.md.BykMC8BP.lean.js => reference_store.md.D4ZVWtNT.lean.js} (67%) rename docs/assets/{reference_store_navigation.md.BBSrn9C3.js => reference_store_navigation.md.W6y0Xj28.js} (95%) rename docs/assets/{reference_store_navigation.md.BBSrn9C3.lean.js => reference_store_navigation.md.W6y0Xj28.lean.js} (100%) rename docs/assets/{reference_store_runtime.md.DN1nqjBy.js => reference_store_runtime.md.BH0FRgPU.js} (94%) rename docs/assets/{reference_store_runtime.md.DN1nqjBy.lean.js => reference_store_runtime.md.BH0FRgPU.lean.js} (71%) rename docs/assets/{reference_store_setting.md.CB2Icw7k.js => reference_store_setting.md.CzmU2eha.js} (96%) rename docs/assets/{reference_store_setting.md.CB2Icw7k.lean.js => reference_store_setting.md.CzmU2eha.lean.js} (100%) rename docs/assets/{reference_store_signing.md.453f7xx-.js => reference_store_signing.md.wgsmw69Q.js} (91%) rename docs/assets/{reference_store_signing.md.453f7xx-.lean.js => reference_store_signing.md.wgsmw69Q.lean.js} (85%) rename docs/assets/{reference_table-pro.md.DW6Gztpq.js => reference_table-pro.md.DdZZh1Tr.js} (99%) rename docs/assets/{reference_table-pro.md.DW6Gztpq.lean.js => reference_table-pro.md.DdZZh1Tr.lean.js} (100%) rename docs/assets/{reference_utils.md.CPo2FGYU.js => reference_utils.md.B6bCkjBM.js} (87%) rename docs/assets/{reference_utils.md.CPo2FGYU.lean.js => reference_utils.md.B6bCkjBM.lean.js} (68%) rename docs/assets/{reference_utils_browser.md.mqqbsAE7.js => reference_utils_browser.md.JR-xHE7d.js} (96%) rename docs/assets/{reference_utils_browser.md.mqqbsAE7.lean.js => reference_utils_browser.md.JR-xHE7d.lean.js} (71%) rename docs/assets/{reference_utils_core.md.D6K4f3-H.js => reference_utils_core.md.CW4tagj9.js} (99%) rename docs/assets/{reference_utils_core.md.D6K4f3-H.lean.js => reference_utils_core.md.CW4tagj9.lean.js} (100%) rename docs/assets/{reference_utils_storage.md.aIMEPocl.js => reference_utils_storage.md.CIn4_Wqq.js} (95%) rename docs/assets/{reference_utils_storage.md.aIMEPocl.lean.js => reference_utils_storage.md.CIn4_Wqq.lean.js} (85%) diff --git a/docs/404.html b/docs/404.html index bca4d866..d2105aff 100644 --- a/docs/404.html +++ b/docs/404.html @@ -17,7 +17,7 @@
- + \ No newline at end of file diff --git a/docs/assets/guide_appearance.md.D-523bFh.js b/docs/assets/guide_appearance.md.CJX6CZmO.js similarity index 94% rename from docs/assets/guide_appearance.md.D-523bFh.js rename to docs/assets/guide_appearance.md.CJX6CZmO.js index 51983cb7..003d492d 100644 --- a/docs/assets/guide_appearance.md.D-523bFh.js +++ b/docs/assets/guide_appearance.md.CJX6CZmO.js @@ -1,4 +1,4 @@ -import{_ as a,o as i,c as e,a3 as n}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"主题与国际化","description":"","frontmatter":{},"headers":[],"relativePath":"guide/appearance.md","filePath":"guide/appearance.md"}'),t={name:"guide/appearance.md"};function p(h,s,l,k,d,r){return i(),e("div",null,[...s[0]||(s[0]=[n(`

主题与国际化 ​

主题与样式 ​

默认主题色由 apps/admin/src/app-config/design-config.ts 管理;主题和语言由应用 Provider 同步到 Naive UI。新增组件时优先使用现有设计变量、组件库配置和局部样式。必须覆盖 Naive UI 内部样式时,以自己的组件类限定作用范围。

全局 Sass 辅助文件通过 vite.custom.config.ts 注入;CSS Modules 的名称以 camelCase 暴露。图表 options 由页面维护,RChart / useChart 负责实例生命周期、尺寸与主题同步;使用新增的 ECharts 图表类型时,按现有注册入口加载依赖。

中英文同时维护 ​

把页面文案放进 apps/admin/src/locales/lang/zh-CN 和 apps/admin/src/locales/lang/en-US 的对应 JSON;同一语言内的命名空间要唯一。新增语言时同时补 apps/admin/src/locales/lang/<locale>.ts 与应用的语言配置。

ts
import { useI18n } from '@/hooks'
+import{_ as i,o as a,c as e,a3 as n}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"主题与国际化","description":"","frontmatter":{},"headers":[],"relativePath":"guide/appearance.md","filePath":"guide/appearance.md"}'),t={name:"guide/appearance.md"};function p(h,s,l,k,r,d){return a(),e("div",null,[...s[0]||(s[0]=[n(`

主题与国际化 ​

主题与样式 ​

默认主题色由 apps/admin/src/app-config/design-config.ts 管理;主题和语言由应用 Provider 同步到 Naive UI。新增组件时优先使用现有设计变量、组件库配置和局部样式。必须覆盖 Naive UI 内部样式时,以自己的组件类限定作用范围。

全局 Sass 辅助文件通过 vite.custom.config.ts 注入;CSS Modules 的名称以 camelCase 暴露。图表 options 由页面维护,RChart / useChart 负责实例生命周期、尺寸与主题同步;使用新增的 ECharts 图表类型时,按现有注册入口加载依赖。

中英文同时维护 ​

把页面文案放进 apps/admin/src/locales/lang/zh-CN 和 apps/admin/src/locales/lang/en-US 的对应 JSON;同一语言内的命名空间要唯一。新增语言时同时补 apps/admin/src/locales/lang/<locale>.ts 与应用的语言配置。

ts
import { useI18n } from '@/hooks'
 import { useSettingActions } from '@/store'
 import { computed } from 'vue'
 
@@ -6,4 +6,4 @@ import{_ as a,o as i,c as e,a3 as n}from"./chunks/framework.BNdm2jZV.js";const c
 const orderLabel = computed(() => t('Orders'))
 
 const { updateLocale } = useSettingActions()
-updateLocale('en-US')

在需要随语言更新的 UI 中,于渲染函数或 computed 内调用 t。通过 updateLocale 切换应用语言,以同步日期和组件库。

语言包约定 · 主题配置

`,9)])])}const E=a(t,[["render",p]]);export{c as __pageData,E as default}; +updateLocale('en-US')

在需要随语言更新的 UI 中,于渲染函数或 computed 内调用 t。通过 updateLocale 切换应用语言,以同步日期和组件库。

语言包约定 · 主题配置

`,9)])])}const E=i(t,[["render",p]]);export{c as __pageData,E as default}; diff --git a/docs/assets/guide_appearance.md.D-523bFh.lean.js b/docs/assets/guide_appearance.md.CJX6CZmO.lean.js similarity index 53% rename from docs/assets/guide_appearance.md.D-523bFh.lean.js rename to docs/assets/guide_appearance.md.CJX6CZmO.lean.js index 1eb76676..ae6410ed 100644 --- a/docs/assets/guide_appearance.md.D-523bFh.lean.js +++ b/docs/assets/guide_appearance.md.CJX6CZmO.lean.js @@ -1 +1 @@ -import{_ as a,o as i,c as e,a3 as n}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"主题与国际化","description":"","frontmatter":{},"headers":[],"relativePath":"guide/appearance.md","filePath":"guide/appearance.md"}'),t={name:"guide/appearance.md"};function p(h,s,l,k,d,r){return i(),e("div",null,[...s[0]||(s[0]=[n("",9)])])}const E=a(t,[["render",p]]);export{c as __pageData,E as default}; +import{_ as i,o as a,c as e,a3 as n}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"主题与国际化","description":"","frontmatter":{},"headers":[],"relativePath":"guide/appearance.md","filePath":"guide/appearance.md"}'),t={name:"guide/appearance.md"};function p(h,s,l,k,r,d){return a(),e("div",null,[...s[0]||(s[0]=[n("",9)])])}const E=i(t,[["render",p]]);export{c as __pageData,E as default}; diff --git a/docs/assets/guide_architecture.md.C6HIHYR1.lean.js b/docs/assets/guide_architecture.md.C6HIHYR1.lean.js deleted file mode 100644 index 8ed40601..00000000 --- a/docs/assets/guide_architecture.md.C6HIHYR1.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,o as t,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"v6 Monorepo 架构","description":"","frontmatter":{},"headers":[],"relativePath":"guide/architecture.md","filePath":"guide/architecture.md"}'),o={name:"guide/architecture.md"};function r(p,a,i,n,c,l){return t(),s("div",null,[...a[0]||(a[0]=[d("",17)])])}const b=e(o,[["render",r]]);export{m as __pageData,b as default}; diff --git a/docs/assets/guide_architecture.md.C6HIHYR1.js b/docs/assets/guide_architecture.md.DA6wtiPl.js similarity index 91% rename from docs/assets/guide_architecture.md.C6HIHYR1.js rename to docs/assets/guide_architecture.md.DA6wtiPl.js index fc08f1fc..09b00a9d 100644 --- a/docs/assets/guide_architecture.md.C6HIHYR1.js +++ b/docs/assets/guide_architecture.md.DA6wtiPl.js @@ -1,8 +1,8 @@ -import{_ as e,o as t,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"v6 Monorepo 架构","description":"","frontmatter":{},"headers":[],"relativePath":"guide/architecture.md","filePath":"guide/architecture.md"}'),o={name:"guide/architecture.md"};function r(p,a,i,n,c,l){return t(),s("div",null,[...a[0]||(a[0]=[d(`

v6 Monorepo 架构 ​

Ray Template 6.0.0 把后台应用、官网文档和共享能力放到同一个 pnpm workspace。Ray Admin 是完整后台,官网则按页加载同一套组件和工具做交互示例。

text
ray-template/
+import{_ as a,o as t,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"v6 Monorepo 架构","description":"","frontmatter":{},"headers":[],"relativePath":"guide/architecture.md","filePath":"guide/architecture.md"}'),o={name:"guide/architecture.md"};function r(p,e,i,n,c,l){return t(),s("div",null,[...e[0]||(e[0]=[d(`

v6 Monorepo 架构 ​

Ray Template 6.0.0 把后台应用、官网文档和共享能力放到同一个 pnpm workspace。Ray Admin 是完整后台,官网则按页加载同一套组件和工具做交互示例。

text
ray-template/
 ├── apps/
 │   ├── admin/          # Ray Admin:登录、会话、路由和业务页面
 │   └── docs/           # VitePress:指南、API 与交互示例
 ├── packages/           # 两个应用共用的八个私有 workspace 包
 ├── harness/            # 任务入口与验收命令
 └── pnpm-lock.yaml      # 工作区共用锁文件

各包负责什么 ​

包公开能力与使用方式
@ray-template/utils精度运算、对象和类型处理、文件工具、接收存储实现的 JSON 工具。精度运算从 /precision 导入。
@ray-template/composables设备宽度、元素全屏、截图、打印和其他独立 Vue Hooks,例如 /useElementFullscreen。
@ray-template/directives复制、防抖、节流、省略、水波纹等指令,可单独导入或统一注册。
@ray-template/iconsSVG 资源、图标名称类型和资源查找。组件和路由配置使用同一套名称。
@ray-template/ui组件、样式、主题与类型。通过 /table-pro、/barcode 或 /chart 等入口按需导入。
@ray-template/httpcreateHttpClient 创建实例与独立的取消器。宿主提供地址、请求头和拦截器。
@ray-template/routing路由 Schema、配置校验、路由展开和菜单处理。宿主提供页面注册表。
@ray-template/admin-shell布局、顶部导航、标签、设置和路由过渡。宿主提供菜单、选中状态、偏好和内容。

共享包通过 package.json 的 exports 暴露入口,只依赖自己声明的包。pnpm packages:check 检查跨包导入和依赖循环。应用的登录、路由守卫、业务 API、Pinia 实例和语言加载由 apps/admin 负责。

Ray Admin 怎么组装 ​

apps/admin/src/main.ts 安装 Pinia、国际化、路由和指令。应用入口为组件提供主题、翻译、图标和列偏好存储,路由层把注册的页面交给后台外壳。登录、角色和会话由应用处理,真实业务的服务端负责接口授权。

以 TablePro 为例,组件负责展示、搜索、分页与请求状态。后台传入业务查询,文档传入可取消的模拟查询。两边从同一个入口导入:

ts
import { RTablePro } from '@ray-template/ui/table-pro'
-import { add } from '@ray-template/utils/precision'

后台应用入口 · 应用组装 · 完整工程地图

文档怎样运行组件 ​

apps/docs/examples 保存实际运行的 Vue 示例。Markdown 引用同一个文件展示源码。TablePro 使用本地数据或可控的模拟请求;布局实验在独立预览框内运行,使用自己的内存路由和主题状态。

精度运算 · RBarcode · TablePro · 布局实验

构建与部署 ​

pnpm dev 启动后台,pnpm docs:dev 启动文档。pnpm build 输出后台,pnpm docs:build 输出文档,pnpm pages:build 组装两者到 dist/pages。官方部署地址分别是 /ray-template/ 和 /ray-template/docs/。构建与部署指南

如果当前项目基于 v5,请先看版本分界,再决定是否接入 v6。

`,17)])])}const b=e(o,[["render",r]]);export{m as __pageData,b as default}; +import { add } from '@ray-template/utils/precision'

后台应用入口 · 应用组装 · 完整工程地图

文档怎样运行组件 ​

apps/docs/examples 保存实际运行的 Vue 示例。Markdown 引用同一个文件展示源码。TablePro 使用本地数据或可控的模拟请求;布局实验在独立预览框内运行,使用自己的内存路由和主题状态。

精度运算 · RBarcode · TablePro · 布局实验

构建与部署 ​

pnpm dev 启动后台,pnpm docs:dev 启动文档。pnpm build 输出后台,pnpm docs:build 输出文档,pnpm pages:build 组装两者到 dist/pages。官方部署地址分别是 /ray-template/ 和 /ray-template/docs/。构建与部署指南

如果当前项目基于 v5,请先看版本分界,再决定是否接入 v6。

`,17)])])}const u=a(o,[["render",r]]);export{m as __pageData,u as default}; diff --git a/docs/assets/guide_architecture.md.DA6wtiPl.lean.js b/docs/assets/guide_architecture.md.DA6wtiPl.lean.js new file mode 100644 index 00000000..ccef9e39 --- /dev/null +++ b/docs/assets/guide_architecture.md.DA6wtiPl.lean.js @@ -0,0 +1 @@ +import{_ as a,o as t,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"v6 Monorepo 架构","description":"","frontmatter":{},"headers":[],"relativePath":"guide/architecture.md","filePath":"guide/architecture.md"}'),o={name:"guide/architecture.md"};function r(p,e,i,n,c,l){return t(),s("div",null,[...e[0]||(e[0]=[d("",17)])])}const u=a(o,[["render",r]]);export{m as __pageData,u as default}; diff --git a/docs/assets/guide_first-page.md.z-hytCrx.js b/docs/assets/guide_first-page.md.BrDGu5p2.js similarity index 98% rename from docs/assets/guide_first-page.md.z-hytCrx.js rename to docs/assets/guide_first-page.md.BrDGu5p2.js index 02f99605..5dbe04b5 100644 --- a/docs/assets/guide_first-page.md.z-hytCrx.js +++ b/docs/assets/guide_first-page.md.BrDGu5p2.js @@ -31,4 +31,4 @@ import{_ as i,o as a,c as n,a3 as p}from"./chunks/framework.BNdm2jZV.js";const o }, } -export default orders

在 apps/admin/src/locales/lang/zh-CN/menu.json 和 apps/admin/src/locales/lang/en-US/menu.json 分别加入 Orders 的翻译。重新加载工作台,从菜单打开订单页,再刷新一次,确认路由可恢复。

接入 API ​

在 apps/admin/src/api 写订单请求函数,将 TablePro 的分页、筛选条件映射成后端的字段,并把 data 替换成 request={loadOrders}。接口需返回当前页数据和筛选后的总数。参照远端 TablePro 示例接入排序、取消和错误重试。

下一步:TablePro · 路由与权限 · 接口约定

`,13)])])}const g=i(h,[["render",l]]);export{o as __pageData,g as default}; +export default orders

在 apps/admin/src/locales/lang/zh-CN/menu.json 和 apps/admin/src/locales/lang/en-US/menu.json 分别加入 Orders 的翻译。重新加载工作台,从菜单打开订单页,再刷新一次,确认路由可恢复。

接入 API ​

在 apps/admin/src/api 写订单请求函数,将 TablePro 的分页、筛选条件映射成后端的字段,并把 data 替换成 request={loadOrders}。接口需返回当前页数据和筛选后的总数。参照远端 TablePro 示例接入排序、取消和错误重试。

下一步:TablePro · 路由与权限 · 接口约定

`,13)])])}const g=i(h,[["render",l]]);export{o as __pageData,g as default}; diff --git a/docs/assets/guide_first-page.md.z-hytCrx.lean.js b/docs/assets/guide_first-page.md.BrDGu5p2.lean.js similarity index 100% rename from docs/assets/guide_first-page.md.z-hytCrx.lean.js rename to docs/assets/guide_first-page.md.BrDGu5p2.lean.js diff --git a/docs/assets/guide_layout.md.B7nfsGPS.js b/docs/assets/guide_layout.md.C3sxtphB.js similarity index 99% rename from docs/assets/guide_layout.md.B7nfsGPS.js rename to docs/assets/guide_layout.md.C3sxtphB.js index c6375cb8..a0b973b2 100644 --- a/docs/assets/guide_layout.md.B7nfsGPS.js +++ b/docs/assets/guide_layout.md.C3sxtphB.js @@ -196,4 +196,4 @@ import{o as a,c as n,a3 as i,j as h,k,g as l}from"./chunks/framework.BNdm2jZV.js contentWidth: 'fixed', contentMaxWidth: 1200, contentPadding: 16, -})

最大宽度范围是 640–2560px,间距为 0–48px。顶栏和页脚可固定或随内容滚动。旧设置补齐默认值,布局恢复默认只重置 layoutConfig。

替换布局区域 ​

RLayout 提供 header、sidebar、tabs、footer 和 default 插槽。模式和显隐开关仍生效,例如顶部导航模式不会渲染侧栏。替换 default 内容时,需要自行接入所需的路由缓存和请求取消。

状态放在哪里 ​

状态入口刷新后的行为
加载、移动抽屉、内容最大化、重载useRuntimeGetters / useRuntimeActions运行态,不持久化
布局、主题、语言等偏好useSettingGetters / useSettingActions沿用设置缓存;旧值补默认配置
锁屏锁屏 Store保留历史布尔值格式和跨标签同步

新增共享状态按职责放到 apps/admin/src/store/modules,对外用 Store hooks。持久化使用 pick / omit 选择字段;检查历史 key 和序列化格式再变更。

布局说明与插槽 · 状态实现与持久化

更细的状态字段与更新动作见 Setting Store、Runtime Store 和 布局 Hooks。

`,11))]))}});export{r as __pageData,g as default}; +})

最大宽度范围是 640–2560px,间距为 0–48px。顶栏和页脚可固定或随内容滚动。旧设置补齐默认值,布局恢复默认只重置 layoutConfig。

替换布局区域 ​

RLayout 提供 header、sidebar、tabs、footer 和 default 插槽。模式和显隐开关仍生效,例如顶部导航模式不会渲染侧栏。替换 default 内容时,需要自行接入所需的路由缓存和请求取消。

状态放在哪里 ​

状态入口刷新后的行为
加载、移动抽屉、内容最大化、重载useRuntimeGetters / useRuntimeActions运行态,不持久化
布局、主题、语言等偏好useSettingGetters / useSettingActions沿用设置缓存;旧值补默认配置
锁屏锁屏 Store保留历史布尔值格式和跨标签同步

新增共享状态按职责放到 apps/admin/src/store/modules,对外用 Store hooks。持久化使用 pick / omit 选择字段;检查历史 key 和序列化格式再变更。

布局说明与插槽 · 状态实现与持久化

更细的状态字段与更新动作见 Setting Store、Runtime Store 和 布局 Hooks。

`,11))]))}});export{r as __pageData,g as default}; diff --git a/docs/assets/guide_layout.md.B7nfsGPS.lean.js b/docs/assets/guide_layout.md.C3sxtphB.lean.js similarity index 100% rename from docs/assets/guide_layout.md.B7nfsGPS.lean.js rename to docs/assets/guide_layout.md.C3sxtphB.lean.js diff --git a/docs/assets/guide_requests.md.DXAGH_Ni.js b/docs/assets/guide_requests.md.bt5MV3ze.js similarity index 96% rename from docs/assets/guide_requests.md.DXAGH_Ni.js rename to docs/assets/guide_requests.md.bt5MV3ze.js index 061547f7..f84fe41f 100644 --- a/docs/assets/guide_requests.md.DXAGH_Ni.js +++ b/docs/assets/guide_requests.md.bt5MV3ze.js @@ -16,11 +16,11 @@ import{_ as i,o as a,c as e,a3 as n}from"./chunks/framework.BNdm2jZV.js";const c signal, cancelConfig: { cancel: false }, }) -}

默认取消器按 URL、方法、参数和请求体识别重复请求,默认布局在路由更新前取消受管理的请求。示例将信号交给 TablePro 管理,所以关闭模板的默认注入;否则默认取消器会替换调用方传入的 signal。后台任务禁用默认取消后,需要自行管理生命周期。

配置与拦截器 ​

从演示切到真实服务 ​

开发时人员列表请求 GET /api/list,Vite Mock 服务在站点根路径处理接口。静态演示改用 apps/admin/src/demo-data/people.ts 的本地数据,能在 GitHub Pages 上独立运行。业务项目应换成自己的 API 和会话,按环境配置开发代理或服务端反代;浏览器端 VITE_* 变量不能放密钥。

请求实例 · 演示接口

useRequest 与手动执行 ​

useRequest<Response>(fetchOptions, options?) 从 @/axios 导入,使用模板 Axios 实例执行同一份配置。options 传给 vue-hooks-plus,例如 manual、成功和失败回调。返回的数据、错误、加载状态与运行方法来自上游 Hook。应用在 setup 或有效 effect scope 内创建它。

ts
import { useRequest } from '@/axios'
+}

默认取消器按 URL、方法、参数和请求体识别重复请求,默认布局在路由更新前取消受管理的请求。示例将信号交给 TablePro 管理,所以关闭模板的默认注入;否则默认取消器会替换调用方传入的 signal。后台任务禁用默认取消后,需要自行管理生命周期。

配置与拦截器 ​

从演示切到真实服务 ​

开发时人员列表请求 GET /api/list,Vite Mock 服务在站点根路径处理接口。静态演示改用 apps/admin/src/demo-data/people.ts 的本地数据,能在 GitHub Pages 上独立运行。业务项目应换成自己的 API 和会话,按环境配置开发代理或服务端反代;浏览器端 VITE_* 变量不能放密钥。

请求实例 · 演示接口

useRequest 与手动执行 ​

useRequest<Response>(fetchOptions, options?) 从 @/axios 导入,使用模板 Axios 实例执行同一份配置。options 传给 vue-hooks-plus,例如 manual、成功和失败回调。返回的数据、错误、加载状态与运行方法来自上游 Hook。应用在 setup 或有效 effect scope 内创建它。

ts
import { useRequest } from '@/axios'
 
 export function useOrderSummary() {
   return useRequest<{ total: number }>(
     { url: '/api/orders/summary', method: 'get' },
     { manual: true },
   )
-}

调用 run() 触发手动加载。这个包装的请求函数从 fetchOptions 读取配置,不会把 run(...) 参数自动映射成请求体或 query;需要动态 service 时用同入口导出的 useHookPlusRequest(service, options?),在 service 中调用 request。错误提示由业务配置或响应拦截器负责,当前默认拦截器不消费 responseSuccessMessage / responseErrorMessage 两个类型字段。

默认头注入包含演示 X-TOKEN 与示例头。对接真实接口时在请求插件中校验目标来源,并按后端约定设置认证头。模板 Axios 实例用来请求自己的业务接口;第三方地址使用明确配置的独立客户端。

请求 Hook · 请求配置类型 · 头注入实现

`,16)])])}const E=i(t,[["render",p]]);export{c as __pageData,E as default}; +}

调用 run() 触发手动加载。这个包装的请求函数从 fetchOptions 读取配置,不会把 run(...) 参数自动映射成请求体或 query;需要动态 service 时用同入口导出的 useHookPlusRequest(service, options?),在 service 中调用 request。错误提示由业务配置或响应拦截器负责,当前默认拦截器不消费 responseSuccessMessage / responseErrorMessage 两个类型字段。

默认头注入包含演示 X-TOKEN 与示例头。对接真实接口时在请求插件中校验目标来源,并按后端约定设置认证头。模板 Axios 实例用来请求自己的业务接口;第三方地址使用明确配置的独立客户端。

请求 Hook · 请求配置类型 · 头注入实现

`,16)])])}const E=i(t,[["render",p]]);export{c as __pageData,E as default}; diff --git a/docs/assets/guide_requests.md.DXAGH_Ni.lean.js b/docs/assets/guide_requests.md.bt5MV3ze.lean.js similarity index 100% rename from docs/assets/guide_requests.md.DXAGH_Ni.lean.js rename to docs/assets/guide_requests.md.bt5MV3ze.lean.js diff --git a/docs/assets/guide_routing.md.CyhQoTmx.js b/docs/assets/guide_routing.md.saWWeode.js similarity index 95% rename from docs/assets/guide_routing.md.CyhQoTmx.js rename to docs/assets/guide_routing.md.saWWeode.js index cb992dc0..4339533f 100644 --- a/docs/assets/guide_routing.md.CyhQoTmx.js +++ b/docs/assets/guide_routing.md.saWWeode.js @@ -1,5 +1,5 @@ -import{d as $s,a4 as Ls,p as Is,o as Fs,c as vs,j as W,k as cs,a5 as js,a6 as Vs,t as Us,h as Ms,_ as Ks,a3 as ys,E as Gs}from"./chunks/framework.BNdm2jZV.js";import{i as Hs}from"./chunks/manifest.BPHdGMSY.js";const zs={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function bs(i){return zs}let as;function Js(i){return as==null?void 0:as.get(i)}let ns;function Xs(i){return ns==null?void 0:ns.get(i)}let ts;function Zs(i,e){var s;return(s=ts==null?void 0:ts.get(i))==null?void 0:s.get(e)}function ps(i){var s,a;const e=typeof i;return e==="string"?`"${i}"`:e==="number"||e==="bigint"||e==="boolean"?`${i}`:e==="object"||e==="function"?(i&&((a=(s=Object.getPrototypeOf(i))==null?void 0:s.constructor)==null?void 0:a.name))??"null":e}function u(i,e,s,a,n){const r=n&&"input"in n?n.input:s.value,t=(n==null?void 0:n.expected)??i.expects??null,h=(n==null?void 0:n.received)??ps(r),l={kind:i.kind,type:i.type,input:r,expected:t,received:h,message:`Invalid ${e}: ${t?`Expected ${t} but r`:"R"}eceived ${h}`,requirement:i.requirement,path:n==null?void 0:n.path,issues:n==null?void 0:n.issues,lang:a.lang,abortEarly:a.abortEarly,abortPipeEarly:a.abortPipeEarly},d=i.kind==="schema",o=(n==null?void 0:n.message)??i.message??Zs(i.reference,l.lang)??(d?Xs(l.lang):null)??a.message??Js(l.lang);o!==void 0&&(l.message=typeof o=="function"?o(l):o),d&&(s.typed=!1),s.issues?s.issues.push(l):s.issues=[l]}function Ws(i,e){return i===e||Number.isNaN(i)&&Number.isNaN(e)}function Ys(i,e){return Object.prototype.hasOwnProperty.call(i,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Cs(i,e){const s=[...new Set(i)];return s.length>1?`(${s.join(` ${e} `)})`:s[0]??"never"}function m(i){return i["~standard"]={version:1,vendor:"valibot",validate:e=>i["~run"]({value:e},bs())},i}function Qs(i){if(i.path){let e="";for(const s of i.path)if(typeof s.key=="string"||typeof s.key=="number")e?e+=`.${s.key}`:e+=s.key;else return null;return e}return null}function ws(i,e){return{kind:"validation",type:"check",reference:ws,async:!1,expects:null,requirement:i,message:e,"~run"(s,a){return s.typed&&!this.requirement(s.value)&&u(this,"input",s,a),s}}}function E(i){return{kind:"metadata",type:"description",reference:E,description:i}}function As(i){return{kind:"validation",type:"finite",reference:As,async:!1,expects:null,requirement:Number.isFinite,message:i,"~run"(e,s){return e.typed&&!this.requirement(e.value)&&u(this,"finite",e,s),e}}}function P(i,e){return{kind:"validation",type:"max_length",reference:P,async:!1,expects:`<=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.length>this.requirement&&u(this,"length",s,a,{received:`${s.value.length}`}),s}}}function Bs(i){return{kind:"metadata",type:"metadata",reference:Bs,metadata:i}}function Q(i,e){return{kind:"validation",type:"min_length",reference:Q,async:!1,expects:`>=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.lengths.expects),"|"),async:!1,options:i,message:e,"~run"(s,a){let n,r,t;for(const h of this.options){const l=h["~run"]({value:s.value},a);if(l.typed)if(l.issues)r?r.push(l):r=[l];else{n=l;break}else t?t.push(l):t=[l]}if(n)return n;if(r){if(r.length===1)return r[0];u(this,"type",s,a,{issues:gs(r)}),s.typed=!0}else{if((t==null?void 0:t.length)===1)return t[0];u(this,"type",s,a,{issues:gs(t)})}return s}})}function Ss(){return m({kind:"schema",type:"unknown",reference:Ss,expects:"unknown",async:!1,"~run"(i){return i.typed=!0,i}})}function p(...i){return m({...i[0],pipe:i,"~run"(e,s){for(const a of i)if(a.kind!=="metadata"){if(e.issues&&(a.kind==="schema"||a.kind==="transformation")){e.typed=!1;break}(!e.issues||!s.abortEarly&&!s.abortPipeEarly)&&(e=a["~run"](e,s))}return e}})}function ii(i,e,s){const a=i["~run"]({value:e},bs());return{typed:a.typed,success:!a.issues,output:a.value,issues:a.issues}}const _=p(ss(),Q(1),P(256)),Ns=p(Ps(),As()),ls=G([_,Ns]),fs=p(_,j(/^[\w-]+\/[\w-]+$/)),Y="(?:[\\w~.-]+|:[A-Za-z_]\\w*\\??)",rs=p(_,j(new RegExp(`^/${Y}(?:/${Y})*$`))),ms=/^(?:[oO][nN]|innerHTML$|outerHTML$|srcdoc$|__proto__$|constructor$|prototype$)/,ei=p(Os(ss(),Ss()),ws(i=>Object.keys(i).every(e=>!ms.test(e)),"Unsafe view prop."),Bs({propertyNames:{not:{pattern:ms.source}}})),ai={path:p(_,j(new RegExp(`^/?${Y}(?:/${Y})*$`)),E("Absolute or relative child path. Supports named and optional parameters.")),name:k(p(_,j(/^[A-Za-z_][\w.-]*$/),E("Unique Vue Router name. Required for keepAlive."))),component:k(p(_,E("Registered view ID. Use layout for a menu group."))),alias:k(p(G([rs,p(V(rs),Q(1),P(16))]),E("Absolute alternative path(s) for a leaf."))),redirect:k(p(rs,E("Absolute path of another configured page."))),props:k(p(G([S(),ei]),E("Pass route params (true) or a JSON object to the view."))),meta:H({i18nKey:k(p(_,E("Translation key for the menu title."))),noLocalTitle:k(p(ls,E("Literal title if i18nKey is absent."))),icon:k(p(fs,E("IconName from src/icons/manifest.ts."))),role:k(p(V(ls),P(32),E("Allowed roles. Omitted or empty means any authenticated role."))),hidden:k(p(S(),E("Hide from the menu. Direct navigation still uses the role guard."))),sameLevel:k(p(S(),E("Append a breadcrumb without replacing the current tab."))),order:k(p(Ns,E("Menu sort order at the top level."))),env:k(p(G([_,p(V(_),P(16))]),E("Vite mode(s) in which the menu item is visible."))),windowOpen:k(p(ss(),P(2048),j(/^[Hh][Tt][Tt][Pp][Ss]?:\/\//),E("Open this HTTP(S) URL in a new tab."))),ignoreAutoResetScroll:k(p(S(),E("Keep the content scroll position on navigation."))),keepAlive:k(p(S(),E("Keep the view mounted. name must match the registered view name."))),extra:k(p(H({label:k(ls),i18nLabel:k(_),icon:k(fs),show:k(S()),type:k(qs(["default","primary","info","success","warning","error"]))}),E("Optional menu badge.")))})},Ts=H({...ai,children:k(p(V(xs(()=>Ts)),Q(1),P(300)))}),ni=p(H({version:Rs(1),routes:p(V(Ts),P(300))}),Ds("Ray Template route configuration")),ti=(i,e)=>e.startsWith("/")?e:`${i.replace(/\/$/,"")}/${e}`;function li(i){var C;const{layout:e,findRouteView:s,findRouteViewId:a,managementPath:n,homePath:r}=i,t=c=>c==="/"||c===n||c.startsWith(`${n}/`),h=new Set((C=i.reservedNames)==null?void 0:C.map(c=>c.toLowerCase())),l=256*1024,d=c=>typeof c=="string"?[c]:c??[];function o(c){if(c.length>l)throw new Error("Route configuration exceeds 256 KiB.");const w=JSON.parse(c);let A=0;const x=(B,$)=>{if(Array.isArray(B)){if(A+=B.length,A>300||$>8)throw new Error("Use at most 300 routes and 8 menu levels.");for(const f of B)x(f==null?void 0:f.children,$+1)}};x(w==null?void 0:w.routes,1);const q=ii(ni,w);if(!q.success)throw new Error(q.issues.slice(0,20).map(B=>`${Qs(B)??"config"}: ${B.message}`).join(` -`));const R=q.output,v=new Map,z=new Set(h),J=new Set,T=new Set,U=(B,$="",f=!1)=>{var M,L,hs;for(const is of B){const{name:X,component:O,children:Z,alias:ks,redirect:os,props:Es,meta:b}=is,D=ti($,is.path),y=g=>{throw new Error(`${D}: ${g}`)},es=D.toLowerCase();if((J.has(es)||t(es))&&y("Duplicate or reserved menu path."),J.add(es),b.windowOpen&&!URL.canParse(b.windowOpen)&&y("Invalid external URL."),X){const g=X.toLowerCase();z.has(g)&&y(`Duplicate or reserved name "${X}".`),z.add(g)}for(const g of[b.icon,(M=b.extra)==null?void 0:M.icon])g&&!Hs(g)&&y(`Unknown icon "${g}".`);if(Z!=null&&Z.length){(O&&O!=="layout"||ks||os||Es!==void 0||b.windowOpen)&&y("Groups accept layout, children and menu metadata."),D.includes(":")&&y("Use static paths for menu groups."),U(Z,D,f||!!((L=b.role)!=null&&L.length));continue}const K=O&&s(O);O&&!K&&y(`Unknown view "${O}".`),+!!O+ +!!os+ +!!b.windowOpen!=1&&y("Specify exactly one view, redirect or external URL."),Es!==void 0&&!K&&y("Props require a view."),b.keepAlive&&(!K||X!==K.name)&&y("keepAlive requires the registered component name."),D.includes(":")&&!b.hidden&&!b.sameLevel&&y("Parameterized paths must be hidden or sameLevel.");for(const g of[D,...d(ks)]){const I=g.toLowerCase();I.split("/").some(us=>us==="."||us==="..")&&y(`Invalid path "${g}".`),(t(I)||v.has(I))&&y(`Duplicate or reserved path "${g}".`),I===r&&(g!==D||D!==r||!K||f||(hs=b.role)!=null&&hs.length)&&y("/dashboard must be a view accessible to all authenticated roles."),g!==D&&(g.includes(":")||D.includes(":"))&&y("Aliases require a static page path.");const ds=I.replace(/:[a-z_]\w*/g,":param");T.has(ds)&&y(`Conflicting parameter pattern "${g}".`),T.add(ds),v.set(I,is)}}};U(R.routes);for(const[B,$]of v){let f=$;const M=new Set;for(;f.redirect;){const L=v.get(f.redirect.toLowerCase());if(M.has(f)||!L||L.meta.windowOpen||f.redirect.includes(":"))throw new Error(`${B}: Redirects must reach a configured page without a cycle.`);M.add(f),f=L}}return R}function F(c){const w=({component:A,children:x,meta:q,...R})=>{var v;return{...R,meta:q,component:A==="layout"?e:A?(v=s(A))==null?void 0:v.load:void 0,children:x==null?void 0:x.map(w)}};return c.routes.map(w)}function N(c){const w=({path:A,name:x,meta:q,component:R,children:v,props:z,alias:J,redirect:T})=>{const U=R===e?"layout":a(R);if(R&&!U)throw new Error(`${A}: Register the view in router/config/views.ts before exporting.`);if(T&&typeof T!="string")throw new Error(`${A}: Export requires a string redirect.`);return{path:A,name:x,meta:q,component:U,alias:J,redirect:T,props:z,children:v==null?void 0:v.map(w)}};return o(JSON.stringify({version:1,routes:c.map(w)}))}return{parseRouteConfig:o,toRuntimeRoutes:F,exportRouteConfig:N}}const ri={class:"ray-demo ray-demo-fields"},pi=["for"],hi=["id","aria-invalid"],ki={class:"ray-demo-result"},oi=$s({__name:"RouteConfigDemo",setup(i){const e=async()=>({}),{parseRouteConfig:s}=li({layout:e,homePath:"/overview",managementPath:"/route-management",findRouteView:t=>t==="overview"?{name:"Overview",load:e}:void 0,findRouteViewId:t=>t===e?"overview":void 0}),a=Ls(),n=Is(JSON.stringify({version:1,routes:[{path:"/overview",component:"overview",name:"Overview",meta:{}}]},null,2)),r=Ms(()=>{try{const{routes:t}=s(n.value);return{invalid:!1,message:`有效路由 / Valid routes: ${t.length}`}}catch(t){return{invalid:!0,message:t instanceof Error?t.message:String(t)}}});return(t,h)=>(Fs(),vs("div",ri,[W("div",null,[W("label",{for:cs(a)},"路由配置 / Route configuration",8,pi),js(W("textarea",{id:cs(a),"onUpdate:modelValue":h[0]||(h[0]=l=>n.value=l),rows:"8",spellcheck:"false","aria-invalid":r.value.invalid},null,8,hi),[[Vs,n.value]]),W("output",ki,Us(r.value.message),1)])]))}}),Ei=Ks(oi,[["__scopeId","data-v-e6a3014a"]]),yi=JSON.parse('{"title":"路由、菜单与权限","description":"","frontmatter":{},"headers":[],"relativePath":"guide/routing.md","filePath":"guide/routing.md"}'),di={name:"guide/routing.md"},gi=Object.assign(di,{setup(i){return(e,s)=>(Fs(),vs("div",null,[s[0]||(s[0]=ys('

路由、菜单与权限 ​

在 apps/admin/src/router/modules 写默认导出的路由模块。模板递归收集文件,按 meta.order 排序;路由树用于菜单与面包屑,页面记录展开后注册到 Vue Router。默认使用 hash 路由,例如 /ray-template/#/orders。

路由配置交互校验 ​

修改路径、名称或页面 ID,查看共享校验器的结果。示例注册了 overview 页面。

',4)),Gs(Ei),s[1]||(s[1]=ys(`
查看示例源码
vue
<template>
+import{d as $s,a4 as Ls,p as Is,o as Fs,c as vs,j as W,k as cs,a5 as js,a6 as Vs,t as Us,h as Ms,_ as Ks,a3 as ys,E as Gs}from"./chunks/framework.BNdm2jZV.js";import{i as Hs}from"./chunks/manifest.BPHdGMSY.js";const zs={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Cs(i){return zs}let as;function Js(i){return as==null?void 0:as.get(i)}let ns;function Xs(i){return ns==null?void 0:ns.get(i)}let ts;function Zs(i,e){var s;return(s=ts==null?void 0:ts.get(i))==null?void 0:s.get(e)}function ps(i){var s,a;const e=typeof i;return e==="string"?`"${i}"`:e==="number"||e==="bigint"||e==="boolean"?`${i}`:e==="object"||e==="function"?(i&&((a=(s=Object.getPrototypeOf(i))==null?void 0:s.constructor)==null?void 0:a.name))??"null":e}function u(i,e,s,a,n){const r=n&&"input"in n?n.input:s.value,t=(n==null?void 0:n.expected)??i.expects??null,h=(n==null?void 0:n.received)??ps(r),l={kind:i.kind,type:i.type,input:r,expected:t,received:h,message:`Invalid ${e}: ${t?`Expected ${t} but r`:"R"}eceived ${h}`,requirement:i.requirement,path:n==null?void 0:n.path,issues:n==null?void 0:n.issues,lang:a.lang,abortEarly:a.abortEarly,abortPipeEarly:a.abortPipeEarly},d=i.kind==="schema",o=(n==null?void 0:n.message)??i.message??Zs(i.reference,l.lang)??(d?Xs(l.lang):null)??a.message??Js(l.lang);o!==void 0&&(l.message=typeof o=="function"?o(l):o),d&&(s.typed=!1),s.issues?s.issues.push(l):s.issues=[l]}function Ws(i,e){return i===e||Number.isNaN(i)&&Number.isNaN(e)}function Ys(i,e){return Object.prototype.hasOwnProperty.call(i,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function bs(i,e){const s=[...new Set(i)];return s.length>1?`(${s.join(` ${e} `)})`:s[0]??"never"}function m(i){return i["~standard"]={version:1,vendor:"valibot",validate:e=>i["~run"]({value:e},Cs())},i}function Qs(i){if(i.path){let e="";for(const s of i.path)if(typeof s.key=="string"||typeof s.key=="number")e?e+=`.${s.key}`:e+=s.key;else return null;return e}return null}function ws(i,e){return{kind:"validation",type:"check",reference:ws,async:!1,expects:null,requirement:i,message:e,"~run"(s,a){return s.typed&&!this.requirement(s.value)&&u(this,"input",s,a),s}}}function E(i){return{kind:"metadata",type:"description",reference:E,description:i}}function As(i){return{kind:"validation",type:"finite",reference:As,async:!1,expects:null,requirement:Number.isFinite,message:i,"~run"(e,s){return e.typed&&!this.requirement(e.value)&&u(this,"finite",e,s),e}}}function P(i,e){return{kind:"validation",type:"max_length",reference:P,async:!1,expects:`<=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.length>this.requirement&&u(this,"length",s,a,{received:`${s.value.length}`}),s}}}function Bs(i){return{kind:"metadata",type:"metadata",reference:Bs,metadata:i}}function Q(i,e){return{kind:"validation",type:"min_length",reference:Q,async:!1,expects:`>=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.lengths.expects),"|"),async:!1,options:i,message:e,"~run"(s,a){let n,r,t;for(const h of this.options){const l=h["~run"]({value:s.value},a);if(l.typed)if(l.issues)r?r.push(l):r=[l];else{n=l;break}else t?t.push(l):t=[l]}if(n)return n;if(r){if(r.length===1)return r[0];u(this,"type",s,a,{issues:gs(r)}),s.typed=!0}else{if((t==null?void 0:t.length)===1)return t[0];u(this,"type",s,a,{issues:gs(t)})}return s}})}function Ss(){return m({kind:"schema",type:"unknown",reference:Ss,expects:"unknown",async:!1,"~run"(i){return i.typed=!0,i}})}function p(...i){return m({...i[0],pipe:i,"~run"(e,s){for(const a of i)if(a.kind!=="metadata"){if(e.issues&&(a.kind==="schema"||a.kind==="transformation")){e.typed=!1;break}(!e.issues||!s.abortEarly&&!s.abortPipeEarly)&&(e=a["~run"](e,s))}return e}})}function ii(i,e,s){const a=i["~run"]({value:e},Cs());return{typed:a.typed,success:!a.issues,output:a.value,issues:a.issues}}const _=p(ss(),Q(1),P(256)),Ns=p(Ps(),As()),ls=G([_,Ns]),fs=p(_,j(/^[\w-]+\/[\w-]+$/)),Y="(?:[\\w~.-]+|:[A-Za-z_]\\w*\\??)",rs=p(_,j(new RegExp(`^/${Y}(?:/${Y})*$`))),ms=/^(?:[oO][nN]|innerHTML$|outerHTML$|srcdoc$|__proto__$|constructor$|prototype$)/,ei=p(Os(ss(),Ss()),ws(i=>Object.keys(i).every(e=>!ms.test(e)),"Unsafe view prop."),Bs({propertyNames:{not:{pattern:ms.source}}})),ai={path:p(_,j(new RegExp(`^/?${Y}(?:/${Y})*$`)),E("Absolute or relative child path. Supports named and optional parameters.")),name:k(p(_,j(/^[A-Za-z_][\w.-]*$/),E("Unique Vue Router name. Required for keepAlive."))),component:k(p(_,E("Registered view ID. Use layout for a menu group."))),alias:k(p(G([rs,p(V(rs),Q(1),P(16))]),E("Absolute alternative path(s) for a leaf."))),redirect:k(p(rs,E("Absolute path of another configured page."))),props:k(p(G([S(),ei]),E("Pass route params (true) or a JSON object to the view."))),meta:H({i18nKey:k(p(_,E("Translation key for the menu title."))),noLocalTitle:k(p(ls,E("Literal title if i18nKey is absent."))),icon:k(p(fs,E("IconName from src/icons/manifest.ts."))),role:k(p(V(ls),P(32),E("Allowed roles. Omitted or empty means any authenticated role."))),hidden:k(p(S(),E("Hide from the menu. Direct navigation still uses the role guard."))),sameLevel:k(p(S(),E("Append a breadcrumb without replacing the current tab."))),order:k(p(Ns,E("Menu sort order at the top level."))),env:k(p(G([_,p(V(_),P(16))]),E("Vite mode(s) in which the menu item is visible."))),windowOpen:k(p(ss(),P(2048),j(/^[Hh][Tt][Tt][Pp][Ss]?:\/\//),E("Open this HTTP(S) URL in a new tab."))),ignoreAutoResetScroll:k(p(S(),E("Keep the content scroll position on navigation."))),keepAlive:k(p(S(),E("Keep the view mounted. name must match the registered view name."))),extra:k(p(H({label:k(ls),i18nLabel:k(_),icon:k(fs),show:k(S()),type:k(qs(["default","primary","info","success","warning","error"]))}),E("Optional menu badge.")))})},Ts=H({...ai,children:k(p(V(xs(()=>Ts)),Q(1),P(300)))}),ni=p(H({version:Rs(1),routes:p(V(Ts),P(300))}),Ds("Ray Template route configuration")),ti=(i,e)=>e.startsWith("/")?e:`${i.replace(/\/$/,"")}/${e}`;function li(i){var b;const{layout:e,findRouteView:s,findRouteViewId:a,managementPath:n,homePath:r}=i,t=c=>c==="/"||c===n||c.startsWith(`${n}/`),h=new Set((b=i.reservedNames)==null?void 0:b.map(c=>c.toLowerCase())),l=256*1024,d=c=>typeof c=="string"?[c]:c??[];function o(c){if(c.length>l)throw new Error("Route configuration exceeds 256 KiB.");const w=JSON.parse(c);let A=0;const x=(B,$)=>{if(Array.isArray(B)){if(A+=B.length,A>300||$>8)throw new Error("Use at most 300 routes and 8 menu levels.");for(const f of B)x(f==null?void 0:f.children,$+1)}};x(w==null?void 0:w.routes,1);const q=ii(ni,w);if(!q.success)throw new Error(q.issues.slice(0,20).map(B=>`${Qs(B)??"config"}: ${B.message}`).join(`
+`));const R=q.output,v=new Map,z=new Set(h),J=new Set,T=new Set,U=(B,$="",f=!1)=>{var M,L,hs;for(const is of B){const{name:X,component:O,children:Z,alias:ks,redirect:os,props:Es,meta:C}=is,D=ti($,is.path),y=g=>{throw new Error(`${D}: ${g}`)},es=D.toLowerCase();if((J.has(es)||t(es))&&y("Duplicate or reserved menu path."),J.add(es),C.windowOpen&&!URL.canParse(C.windowOpen)&&y("Invalid external URL."),X){const g=X.toLowerCase();z.has(g)&&y(`Duplicate or reserved name "${X}".`),z.add(g)}for(const g of[C.icon,(M=C.extra)==null?void 0:M.icon])g&&!Hs(g)&&y(`Unknown icon "${g}".`);if(Z!=null&&Z.length){(O&&O!=="layout"||ks||os||Es!==void 0||C.windowOpen)&&y("Groups accept layout, children and menu metadata."),D.includes(":")&&y("Use static paths for menu groups."),U(Z,D,f||!!((L=C.role)!=null&&L.length));continue}const K=O&&s(O);O&&!K&&y(`Unknown view "${O}".`),+!!O+ +!!os+ +!!C.windowOpen!=1&&y("Specify exactly one view, redirect or external URL."),Es!==void 0&&!K&&y("Props require a view."),C.keepAlive&&(!K||X!==K.name)&&y("keepAlive requires the registered component name."),D.includes(":")&&!C.hidden&&!C.sameLevel&&y("Parameterized paths must be hidden or sameLevel.");for(const g of[D,...d(ks)]){const I=g.toLowerCase();I.split("/").some(us=>us==="."||us==="..")&&y(`Invalid path "${g}".`),(t(I)||v.has(I))&&y(`Duplicate or reserved path "${g}".`),I===r&&(g!==D||D!==r||!K||f||(hs=C.role)!=null&&hs.length)&&y("/dashboard must be a view accessible to all authenticated roles."),g!==D&&(g.includes(":")||D.includes(":"))&&y("Aliases require a static page path.");const ds=I.replace(/:[a-z_]\w*/g,":param");T.has(ds)&&y(`Conflicting parameter pattern "${g}".`),T.add(ds),v.set(I,is)}}};U(R.routes);for(const[B,$]of v){let f=$;const M=new Set;for(;f.redirect;){const L=v.get(f.redirect.toLowerCase());if(M.has(f)||!L||L.meta.windowOpen||f.redirect.includes(":"))throw new Error(`${B}: Redirects must reach a configured page without a cycle.`);M.add(f),f=L}}return R}function F(c){const w=({component:A,children:x,meta:q,...R})=>{var v;return{...R,meta:q,component:A==="layout"?e:A?(v=s(A))==null?void 0:v.load:void 0,children:x==null?void 0:x.map(w)}};return c.routes.map(w)}function N(c){const w=({path:A,name:x,meta:q,component:R,children:v,props:z,alias:J,redirect:T})=>{const U=R===e?"layout":a(R);if(R&&!U)throw new Error(`${A}: Register the view in router/config/views.ts before exporting.`);if(T&&typeof T!="string")throw new Error(`${A}: Export requires a string redirect.`);return{path:A,name:x,meta:q,component:U,alias:J,redirect:T,props:z,children:v==null?void 0:v.map(w)}};return o(JSON.stringify({version:1,routes:c.map(w)}))}return{parseRouteConfig:o,toRuntimeRoutes:F,exportRouteConfig:N}}const ri={class:"ray-demo ray-demo-fields"},pi=["for"],hi=["id","aria-invalid"],ki={class:"ray-demo-result"},oi=$s({__name:"RouteConfigDemo",setup(i){const e=async()=>({}),{parseRouteConfig:s}=li({layout:e,homePath:"/overview",managementPath:"/route-management",findRouteView:t=>t==="overview"?{name:"Overview",load:e}:void 0,findRouteViewId:t=>t===e?"overview":void 0}),a=Ls(),n=Is(JSON.stringify({version:1,routes:[{path:"/overview",component:"overview",name:"Overview",meta:{}}]},null,2)),r=Ms(()=>{try{const{routes:t}=s(n.value);return{invalid:!1,message:`有效路由 / Valid routes: ${t.length}`}}catch(t){return{invalid:!0,message:t instanceof Error?t.message:String(t)}}});return(t,h)=>(Fs(),vs("div",ri,[W("div",null,[W("label",{for:cs(a)},"路由配置 / Route configuration",8,pi),js(W("textarea",{id:cs(a),"onUpdate:modelValue":h[0]||(h[0]=l=>n.value=l),rows:"8",spellcheck:"false","aria-invalid":r.value.invalid},null,8,hi),[[Vs,n.value]]),W("output",ki,Us(r.value.message),1)])]))}}),Ei=Ks(oi,[["__scopeId","data-v-e6a3014a"]]),yi=JSON.parse('{"title":"路由、菜单与权限","description":"","frontmatter":{},"headers":[],"relativePath":"guide/routing.md","filePath":"guide/routing.md"}'),di={name:"guide/routing.md"},gi=Object.assign(di,{setup(i){return(e,s)=>(Fs(),vs("div",null,[s[0]||(s[0]=ys('

路由、菜单与权限 ​

在 apps/admin/src/router/modules 写默认导出的路由模块。模板递归收集文件,按 meta.order 排序;路由树用于菜单与面包屑,页面记录展开后注册到 Vue Router。默认使用 hash 路由,例如 /ray-template/#/orders。

路由配置交互校验 ​

修改路径、名称或页面 ID,查看共享校验器的结果。示例注册了 overview 页面。

',4)),Gs(Ei),s[1]||(s[1]=ys(`
查看示例源码
vue
<template>
   <div class="ray-demo ray-demo-fields">
     <div>
       <label :for="id">路由配置 / Route configuration</label>
@@ -73,4 +73,4 @@ import{d as $s,a4 as Ls,p as Is,o as Fs,c as vs,j as W,k as cs,a5 as js,a6 as Vs
   font-family: var(--vp-font-family-mono);
   resize: vertical;
 }
-</style>

常用元数据 ​

字段作用
i18nKey / noLocalTitle使用翻译键,或提供不经翻译的菜单标题
icon使用完整分包图标名,也接受 VNode
role同时影响菜单与守卫;角色值类型要和会话一致
hidden、env控制菜单显隐;不充当接口或路由权限
sameLevel详情页可保留当前菜单与标签,只在面包屑补充层级
keepAlive允许页面加入内容区的缓存
windowOpen菜单点击时打开指定地址。
ignoreAutoResetScroll允许页面保留内容区滚动位置,详见滚动工具实现。
extra菜单标记的文本、图标、类型和显隐,见 useBadge。

嵌套子路由使用相对路径;如果父路由需要承载子内容,参考 多级菜单示例 与 @/router/constant 中的 LAYOUT。

登录和角色 ​

默认登录页为 /。守卫启用时,无会话会返回登录页;有会话时按白名单、角色和应用首页决定导航。菜单隐藏的页面仍可能允许直达。接入真实业务时,在后端校验会话、权限和资源归属。

KeepAlive 排查 ​

  1. 路由设置 meta.keepAlive: true,并为它配置唯一 name。
  2. TSX 的 defineComponent({ name }) 或 SFC 的组件名应与路由名一致。检查懒加载模块是否导出了预期组件。
  3. 从菜单进入,改变页内状态,切到另一个标签再返回;随后检查关闭标签、直达和刷新是否符合预期。KeepAlive 不跨浏览器刷新保留组件实例。
  4. 替换布局的默认内容插槽后,应用接入方需要自行保留需要的路由渲染和缓存逻辑。

路由契约 · 守卫实现

`,9))]))}});export{yi as __pageData,gi as default}; +</style>

常用元数据 ​

字段作用
i18nKey / noLocalTitle使用翻译键,或提供不经翻译的菜单标题
icon使用完整分包图标名,也接受 VNode
role同时影响菜单与守卫;角色值类型要和会话一致
hidden、env控制菜单显隐;不充当接口或路由权限
sameLevel详情页可保留当前菜单与标签,只在面包屑补充层级
keepAlive允许页面加入内容区的缓存
windowOpen菜单点击时打开指定地址。
ignoreAutoResetScroll允许页面保留内容区滚动位置,详见滚动工具实现。
extra菜单标记的文本、图标、类型和显隐,见 useBadge。

嵌套子路由使用相对路径;如果父路由需要承载子内容,参考 多级菜单示例 与 @/router/constant 中的 LAYOUT。

登录和角色 ​

默认登录页为 /。守卫启用时,无会话会返回登录页;有会话时按白名单、角色和应用首页决定导航。菜单隐藏的页面仍可能允许直达。接入真实业务时,在后端校验会话、权限和资源归属。

KeepAlive 排查 ​

  1. 路由设置 meta.keepAlive: true,并为它配置唯一 name。
  2. TSX 的 defineComponent({ name }) 或 SFC 的组件名应与路由名一致。检查懒加载模块是否导出了预期组件。
  3. 从菜单进入,改变页内状态,切到另一个标签再返回;随后检查关闭标签、直达和刷新是否符合预期。KeepAlive 不跨浏览器刷新保留组件实例。
  4. 替换布局的默认内容插槽后,应用接入方需要自行保留需要的路由渲染和缓存逻辑。

路由契约 · 守卫实现

`,9))]))}});export{yi as __pageData,gi as default}; diff --git a/docs/assets/guide_routing.md.CyhQoTmx.lean.js b/docs/assets/guide_routing.md.saWWeode.lean.js similarity index 90% rename from docs/assets/guide_routing.md.CyhQoTmx.lean.js rename to docs/assets/guide_routing.md.saWWeode.lean.js index 25d466fe..bad3f3fa 100644 --- a/docs/assets/guide_routing.md.CyhQoTmx.lean.js +++ b/docs/assets/guide_routing.md.saWWeode.lean.js @@ -1,2 +1,2 @@ -import{d as $s,a4 as Ls,p as Is,o as Fs,c as vs,j as W,k as cs,a5 as js,a6 as Vs,t as Us,h as Ms,_ as Ks,a3 as ys,E as Gs}from"./chunks/framework.BNdm2jZV.js";import{i as Hs}from"./chunks/manifest.BPHdGMSY.js";const zs={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function bs(i){return zs}let as;function Js(i){return as==null?void 0:as.get(i)}let ns;function Xs(i){return ns==null?void 0:ns.get(i)}let ts;function Zs(i,e){var s;return(s=ts==null?void 0:ts.get(i))==null?void 0:s.get(e)}function ps(i){var s,a;const e=typeof i;return e==="string"?`"${i}"`:e==="number"||e==="bigint"||e==="boolean"?`${i}`:e==="object"||e==="function"?(i&&((a=(s=Object.getPrototypeOf(i))==null?void 0:s.constructor)==null?void 0:a.name))??"null":e}function u(i,e,s,a,n){const r=n&&"input"in n?n.input:s.value,t=(n==null?void 0:n.expected)??i.expects??null,h=(n==null?void 0:n.received)??ps(r),l={kind:i.kind,type:i.type,input:r,expected:t,received:h,message:`Invalid ${e}: ${t?`Expected ${t} but r`:"R"}eceived ${h}`,requirement:i.requirement,path:n==null?void 0:n.path,issues:n==null?void 0:n.issues,lang:a.lang,abortEarly:a.abortEarly,abortPipeEarly:a.abortPipeEarly},d=i.kind==="schema",o=(n==null?void 0:n.message)??i.message??Zs(i.reference,l.lang)??(d?Xs(l.lang):null)??a.message??Js(l.lang);o!==void 0&&(l.message=typeof o=="function"?o(l):o),d&&(s.typed=!1),s.issues?s.issues.push(l):s.issues=[l]}function Ws(i,e){return i===e||Number.isNaN(i)&&Number.isNaN(e)}function Ys(i,e){return Object.prototype.hasOwnProperty.call(i,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Cs(i,e){const s=[...new Set(i)];return s.length>1?`(${s.join(` ${e} `)})`:s[0]??"never"}function m(i){return i["~standard"]={version:1,vendor:"valibot",validate:e=>i["~run"]({value:e},bs())},i}function Qs(i){if(i.path){let e="";for(const s of i.path)if(typeof s.key=="string"||typeof s.key=="number")e?e+=`.${s.key}`:e+=s.key;else return null;return e}return null}function ws(i,e){return{kind:"validation",type:"check",reference:ws,async:!1,expects:null,requirement:i,message:e,"~run"(s,a){return s.typed&&!this.requirement(s.value)&&u(this,"input",s,a),s}}}function E(i){return{kind:"metadata",type:"description",reference:E,description:i}}function As(i){return{kind:"validation",type:"finite",reference:As,async:!1,expects:null,requirement:Number.isFinite,message:i,"~run"(e,s){return e.typed&&!this.requirement(e.value)&&u(this,"finite",e,s),e}}}function P(i,e){return{kind:"validation",type:"max_length",reference:P,async:!1,expects:`<=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.length>this.requirement&&u(this,"length",s,a,{received:`${s.value.length}`}),s}}}function Bs(i){return{kind:"metadata",type:"metadata",reference:Bs,metadata:i}}function Q(i,e){return{kind:"validation",type:"min_length",reference:Q,async:!1,expects:`>=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.lengths.expects),"|"),async:!1,options:i,message:e,"~run"(s,a){let n,r,t;for(const h of this.options){const l=h["~run"]({value:s.value},a);if(l.typed)if(l.issues)r?r.push(l):r=[l];else{n=l;break}else t?t.push(l):t=[l]}if(n)return n;if(r){if(r.length===1)return r[0];u(this,"type",s,a,{issues:gs(r)}),s.typed=!0}else{if((t==null?void 0:t.length)===1)return t[0];u(this,"type",s,a,{issues:gs(t)})}return s}})}function Ss(){return m({kind:"schema",type:"unknown",reference:Ss,expects:"unknown",async:!1,"~run"(i){return i.typed=!0,i}})}function p(...i){return m({...i[0],pipe:i,"~run"(e,s){for(const a of i)if(a.kind!=="metadata"){if(e.issues&&(a.kind==="schema"||a.kind==="transformation")){e.typed=!1;break}(!e.issues||!s.abortEarly&&!s.abortPipeEarly)&&(e=a["~run"](e,s))}return e}})}function ii(i,e,s){const a=i["~run"]({value:e},bs());return{typed:a.typed,success:!a.issues,output:a.value,issues:a.issues}}const _=p(ss(),Q(1),P(256)),Ns=p(Ps(),As()),ls=G([_,Ns]),fs=p(_,j(/^[\w-]+\/[\w-]+$/)),Y="(?:[\\w~.-]+|:[A-Za-z_]\\w*\\??)",rs=p(_,j(new RegExp(`^/${Y}(?:/${Y})*$`))),ms=/^(?:[oO][nN]|innerHTML$|outerHTML$|srcdoc$|__proto__$|constructor$|prototype$)/,ei=p(Os(ss(),Ss()),ws(i=>Object.keys(i).every(e=>!ms.test(e)),"Unsafe view prop."),Bs({propertyNames:{not:{pattern:ms.source}}})),ai={path:p(_,j(new RegExp(`^/?${Y}(?:/${Y})*$`)),E("Absolute or relative child path. Supports named and optional parameters.")),name:k(p(_,j(/^[A-Za-z_][\w.-]*$/),E("Unique Vue Router name. Required for keepAlive."))),component:k(p(_,E("Registered view ID. Use layout for a menu group."))),alias:k(p(G([rs,p(V(rs),Q(1),P(16))]),E("Absolute alternative path(s) for a leaf."))),redirect:k(p(rs,E("Absolute path of another configured page."))),props:k(p(G([S(),ei]),E("Pass route params (true) or a JSON object to the view."))),meta:H({i18nKey:k(p(_,E("Translation key for the menu title."))),noLocalTitle:k(p(ls,E("Literal title if i18nKey is absent."))),icon:k(p(fs,E("IconName from src/icons/manifest.ts."))),role:k(p(V(ls),P(32),E("Allowed roles. Omitted or empty means any authenticated role."))),hidden:k(p(S(),E("Hide from the menu. Direct navigation still uses the role guard."))),sameLevel:k(p(S(),E("Append a breadcrumb without replacing the current tab."))),order:k(p(Ns,E("Menu sort order at the top level."))),env:k(p(G([_,p(V(_),P(16))]),E("Vite mode(s) in which the menu item is visible."))),windowOpen:k(p(ss(),P(2048),j(/^[Hh][Tt][Tt][Pp][Ss]?:\/\//),E("Open this HTTP(S) URL in a new tab."))),ignoreAutoResetScroll:k(p(S(),E("Keep the content scroll position on navigation."))),keepAlive:k(p(S(),E("Keep the view mounted. name must match the registered view name."))),extra:k(p(H({label:k(ls),i18nLabel:k(_),icon:k(fs),show:k(S()),type:k(qs(["default","primary","info","success","warning","error"]))}),E("Optional menu badge.")))})},Ts=H({...ai,children:k(p(V(xs(()=>Ts)),Q(1),P(300)))}),ni=p(H({version:Rs(1),routes:p(V(Ts),P(300))}),Ds("Ray Template route configuration")),ti=(i,e)=>e.startsWith("/")?e:`${i.replace(/\/$/,"")}/${e}`;function li(i){var C;const{layout:e,findRouteView:s,findRouteViewId:a,managementPath:n,homePath:r}=i,t=c=>c==="/"||c===n||c.startsWith(`${n}/`),h=new Set((C=i.reservedNames)==null?void 0:C.map(c=>c.toLowerCase())),l=256*1024,d=c=>typeof c=="string"?[c]:c??[];function o(c){if(c.length>l)throw new Error("Route configuration exceeds 256 KiB.");const w=JSON.parse(c);let A=0;const x=(B,$)=>{if(Array.isArray(B)){if(A+=B.length,A>300||$>8)throw new Error("Use at most 300 routes and 8 menu levels.");for(const f of B)x(f==null?void 0:f.children,$+1)}};x(w==null?void 0:w.routes,1);const q=ii(ni,w);if(!q.success)throw new Error(q.issues.slice(0,20).map(B=>`${Qs(B)??"config"}: ${B.message}`).join(` -`));const R=q.output,v=new Map,z=new Set(h),J=new Set,T=new Set,U=(B,$="",f=!1)=>{var M,L,hs;for(const is of B){const{name:X,component:O,children:Z,alias:ks,redirect:os,props:Es,meta:b}=is,D=ti($,is.path),y=g=>{throw new Error(`${D}: ${g}`)},es=D.toLowerCase();if((J.has(es)||t(es))&&y("Duplicate or reserved menu path."),J.add(es),b.windowOpen&&!URL.canParse(b.windowOpen)&&y("Invalid external URL."),X){const g=X.toLowerCase();z.has(g)&&y(`Duplicate or reserved name "${X}".`),z.add(g)}for(const g of[b.icon,(M=b.extra)==null?void 0:M.icon])g&&!Hs(g)&&y(`Unknown icon "${g}".`);if(Z!=null&&Z.length){(O&&O!=="layout"||ks||os||Es!==void 0||b.windowOpen)&&y("Groups accept layout, children and menu metadata."),D.includes(":")&&y("Use static paths for menu groups."),U(Z,D,f||!!((L=b.role)!=null&&L.length));continue}const K=O&&s(O);O&&!K&&y(`Unknown view "${O}".`),+!!O+ +!!os+ +!!b.windowOpen!=1&&y("Specify exactly one view, redirect or external URL."),Es!==void 0&&!K&&y("Props require a view."),b.keepAlive&&(!K||X!==K.name)&&y("keepAlive requires the registered component name."),D.includes(":")&&!b.hidden&&!b.sameLevel&&y("Parameterized paths must be hidden or sameLevel.");for(const g of[D,...d(ks)]){const I=g.toLowerCase();I.split("/").some(us=>us==="."||us==="..")&&y(`Invalid path "${g}".`),(t(I)||v.has(I))&&y(`Duplicate or reserved path "${g}".`),I===r&&(g!==D||D!==r||!K||f||(hs=b.role)!=null&&hs.length)&&y("/dashboard must be a view accessible to all authenticated roles."),g!==D&&(g.includes(":")||D.includes(":"))&&y("Aliases require a static page path.");const ds=I.replace(/:[a-z_]\w*/g,":param");T.has(ds)&&y(`Conflicting parameter pattern "${g}".`),T.add(ds),v.set(I,is)}}};U(R.routes);for(const[B,$]of v){let f=$;const M=new Set;for(;f.redirect;){const L=v.get(f.redirect.toLowerCase());if(M.has(f)||!L||L.meta.windowOpen||f.redirect.includes(":"))throw new Error(`${B}: Redirects must reach a configured page without a cycle.`);M.add(f),f=L}}return R}function F(c){const w=({component:A,children:x,meta:q,...R})=>{var v;return{...R,meta:q,component:A==="layout"?e:A?(v=s(A))==null?void 0:v.load:void 0,children:x==null?void 0:x.map(w)}};return c.routes.map(w)}function N(c){const w=({path:A,name:x,meta:q,component:R,children:v,props:z,alias:J,redirect:T})=>{const U=R===e?"layout":a(R);if(R&&!U)throw new Error(`${A}: Register the view in router/config/views.ts before exporting.`);if(T&&typeof T!="string")throw new Error(`${A}: Export requires a string redirect.`);return{path:A,name:x,meta:q,component:U,alias:J,redirect:T,props:z,children:v==null?void 0:v.map(w)}};return o(JSON.stringify({version:1,routes:c.map(w)}))}return{parseRouteConfig:o,toRuntimeRoutes:F,exportRouteConfig:N}}const ri={class:"ray-demo ray-demo-fields"},pi=["for"],hi=["id","aria-invalid"],ki={class:"ray-demo-result"},oi=$s({__name:"RouteConfigDemo",setup(i){const e=async()=>({}),{parseRouteConfig:s}=li({layout:e,homePath:"/overview",managementPath:"/route-management",findRouteView:t=>t==="overview"?{name:"Overview",load:e}:void 0,findRouteViewId:t=>t===e?"overview":void 0}),a=Ls(),n=Is(JSON.stringify({version:1,routes:[{path:"/overview",component:"overview",name:"Overview",meta:{}}]},null,2)),r=Ms(()=>{try{const{routes:t}=s(n.value);return{invalid:!1,message:`有效路由 / Valid routes: ${t.length}`}}catch(t){return{invalid:!0,message:t instanceof Error?t.message:String(t)}}});return(t,h)=>(Fs(),vs("div",ri,[W("div",null,[W("label",{for:cs(a)},"路由配置 / Route configuration",8,pi),js(W("textarea",{id:cs(a),"onUpdate:modelValue":h[0]||(h[0]=l=>n.value=l),rows:"8",spellcheck:"false","aria-invalid":r.value.invalid},null,8,hi),[[Vs,n.value]]),W("output",ki,Us(r.value.message),1)])]))}}),Ei=Ks(oi,[["__scopeId","data-v-e6a3014a"]]),yi=JSON.parse('{"title":"路由、菜单与权限","description":"","frontmatter":{},"headers":[],"relativePath":"guide/routing.md","filePath":"guide/routing.md"}'),di={name:"guide/routing.md"},gi=Object.assign(di,{setup(i){return(e,s)=>(Fs(),vs("div",null,[s[0]||(s[0]=ys("",4)),Gs(Ei),s[1]||(s[1]=ys("",9))]))}});export{yi as __pageData,gi as default}; +import{d as $s,a4 as Ls,p as Is,o as Fs,c as vs,j as W,k as cs,a5 as js,a6 as Vs,t as Us,h as Ms,_ as Ks,a3 as ys,E as Gs}from"./chunks/framework.BNdm2jZV.js";import{i as Hs}from"./chunks/manifest.BPHdGMSY.js";const zs={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Cs(i){return zs}let as;function Js(i){return as==null?void 0:as.get(i)}let ns;function Xs(i){return ns==null?void 0:ns.get(i)}let ts;function Zs(i,e){var s;return(s=ts==null?void 0:ts.get(i))==null?void 0:s.get(e)}function ps(i){var s,a;const e=typeof i;return e==="string"?`"${i}"`:e==="number"||e==="bigint"||e==="boolean"?`${i}`:e==="object"||e==="function"?(i&&((a=(s=Object.getPrototypeOf(i))==null?void 0:s.constructor)==null?void 0:a.name))??"null":e}function u(i,e,s,a,n){const r=n&&"input"in n?n.input:s.value,t=(n==null?void 0:n.expected)??i.expects??null,h=(n==null?void 0:n.received)??ps(r),l={kind:i.kind,type:i.type,input:r,expected:t,received:h,message:`Invalid ${e}: ${t?`Expected ${t} but r`:"R"}eceived ${h}`,requirement:i.requirement,path:n==null?void 0:n.path,issues:n==null?void 0:n.issues,lang:a.lang,abortEarly:a.abortEarly,abortPipeEarly:a.abortPipeEarly},d=i.kind==="schema",o=(n==null?void 0:n.message)??i.message??Zs(i.reference,l.lang)??(d?Xs(l.lang):null)??a.message??Js(l.lang);o!==void 0&&(l.message=typeof o=="function"?o(l):o),d&&(s.typed=!1),s.issues?s.issues.push(l):s.issues=[l]}function Ws(i,e){return i===e||Number.isNaN(i)&&Number.isNaN(e)}function Ys(i,e){return Object.prototype.hasOwnProperty.call(i,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function bs(i,e){const s=[...new Set(i)];return s.length>1?`(${s.join(` ${e} `)})`:s[0]??"never"}function m(i){return i["~standard"]={version:1,vendor:"valibot",validate:e=>i["~run"]({value:e},Cs())},i}function Qs(i){if(i.path){let e="";for(const s of i.path)if(typeof s.key=="string"||typeof s.key=="number")e?e+=`.${s.key}`:e+=s.key;else return null;return e}return null}function ws(i,e){return{kind:"validation",type:"check",reference:ws,async:!1,expects:null,requirement:i,message:e,"~run"(s,a){return s.typed&&!this.requirement(s.value)&&u(this,"input",s,a),s}}}function E(i){return{kind:"metadata",type:"description",reference:E,description:i}}function As(i){return{kind:"validation",type:"finite",reference:As,async:!1,expects:null,requirement:Number.isFinite,message:i,"~run"(e,s){return e.typed&&!this.requirement(e.value)&&u(this,"finite",e,s),e}}}function P(i,e){return{kind:"validation",type:"max_length",reference:P,async:!1,expects:`<=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.length>this.requirement&&u(this,"length",s,a,{received:`${s.value.length}`}),s}}}function Bs(i){return{kind:"metadata",type:"metadata",reference:Bs,metadata:i}}function Q(i,e){return{kind:"validation",type:"min_length",reference:Q,async:!1,expects:`>=${i}`,requirement:i,message:e,"~run"(s,a){return s.typed&&s.value.lengths.expects),"|"),async:!1,options:i,message:e,"~run"(s,a){let n,r,t;for(const h of this.options){const l=h["~run"]({value:s.value},a);if(l.typed)if(l.issues)r?r.push(l):r=[l];else{n=l;break}else t?t.push(l):t=[l]}if(n)return n;if(r){if(r.length===1)return r[0];u(this,"type",s,a,{issues:gs(r)}),s.typed=!0}else{if((t==null?void 0:t.length)===1)return t[0];u(this,"type",s,a,{issues:gs(t)})}return s}})}function Ss(){return m({kind:"schema",type:"unknown",reference:Ss,expects:"unknown",async:!1,"~run"(i){return i.typed=!0,i}})}function p(...i){return m({...i[0],pipe:i,"~run"(e,s){for(const a of i)if(a.kind!=="metadata"){if(e.issues&&(a.kind==="schema"||a.kind==="transformation")){e.typed=!1;break}(!e.issues||!s.abortEarly&&!s.abortPipeEarly)&&(e=a["~run"](e,s))}return e}})}function ii(i,e,s){const a=i["~run"]({value:e},Cs());return{typed:a.typed,success:!a.issues,output:a.value,issues:a.issues}}const _=p(ss(),Q(1),P(256)),Ns=p(Ps(),As()),ls=G([_,Ns]),fs=p(_,j(/^[\w-]+\/[\w-]+$/)),Y="(?:[\\w~.-]+|:[A-Za-z_]\\w*\\??)",rs=p(_,j(new RegExp(`^/${Y}(?:/${Y})*$`))),ms=/^(?:[oO][nN]|innerHTML$|outerHTML$|srcdoc$|__proto__$|constructor$|prototype$)/,ei=p(Os(ss(),Ss()),ws(i=>Object.keys(i).every(e=>!ms.test(e)),"Unsafe view prop."),Bs({propertyNames:{not:{pattern:ms.source}}})),ai={path:p(_,j(new RegExp(`^/?${Y}(?:/${Y})*$`)),E("Absolute or relative child path. Supports named and optional parameters.")),name:k(p(_,j(/^[A-Za-z_][\w.-]*$/),E("Unique Vue Router name. Required for keepAlive."))),component:k(p(_,E("Registered view ID. Use layout for a menu group."))),alias:k(p(G([rs,p(V(rs),Q(1),P(16))]),E("Absolute alternative path(s) for a leaf."))),redirect:k(p(rs,E("Absolute path of another configured page."))),props:k(p(G([S(),ei]),E("Pass route params (true) or a JSON object to the view."))),meta:H({i18nKey:k(p(_,E("Translation key for the menu title."))),noLocalTitle:k(p(ls,E("Literal title if i18nKey is absent."))),icon:k(p(fs,E("IconName from src/icons/manifest.ts."))),role:k(p(V(ls),P(32),E("Allowed roles. Omitted or empty means any authenticated role."))),hidden:k(p(S(),E("Hide from the menu. Direct navigation still uses the role guard."))),sameLevel:k(p(S(),E("Append a breadcrumb without replacing the current tab."))),order:k(p(Ns,E("Menu sort order at the top level."))),env:k(p(G([_,p(V(_),P(16))]),E("Vite mode(s) in which the menu item is visible."))),windowOpen:k(p(ss(),P(2048),j(/^[Hh][Tt][Tt][Pp][Ss]?:\/\//),E("Open this HTTP(S) URL in a new tab."))),ignoreAutoResetScroll:k(p(S(),E("Keep the content scroll position on navigation."))),keepAlive:k(p(S(),E("Keep the view mounted. name must match the registered view name."))),extra:k(p(H({label:k(ls),i18nLabel:k(_),icon:k(fs),show:k(S()),type:k(qs(["default","primary","info","success","warning","error"]))}),E("Optional menu badge.")))})},Ts=H({...ai,children:k(p(V(xs(()=>Ts)),Q(1),P(300)))}),ni=p(H({version:Rs(1),routes:p(V(Ts),P(300))}),Ds("Ray Template route configuration")),ti=(i,e)=>e.startsWith("/")?e:`${i.replace(/\/$/,"")}/${e}`;function li(i){var b;const{layout:e,findRouteView:s,findRouteViewId:a,managementPath:n,homePath:r}=i,t=c=>c==="/"||c===n||c.startsWith(`${n}/`),h=new Set((b=i.reservedNames)==null?void 0:b.map(c=>c.toLowerCase())),l=256*1024,d=c=>typeof c=="string"?[c]:c??[];function o(c){if(c.length>l)throw new Error("Route configuration exceeds 256 KiB.");const w=JSON.parse(c);let A=0;const x=(B,$)=>{if(Array.isArray(B)){if(A+=B.length,A>300||$>8)throw new Error("Use at most 300 routes and 8 menu levels.");for(const f of B)x(f==null?void 0:f.children,$+1)}};x(w==null?void 0:w.routes,1);const q=ii(ni,w);if(!q.success)throw new Error(q.issues.slice(0,20).map(B=>`${Qs(B)??"config"}: ${B.message}`).join(` +`));const R=q.output,v=new Map,z=new Set(h),J=new Set,T=new Set,U=(B,$="",f=!1)=>{var M,L,hs;for(const is of B){const{name:X,component:O,children:Z,alias:ks,redirect:os,props:Es,meta:C}=is,D=ti($,is.path),y=g=>{throw new Error(`${D}: ${g}`)},es=D.toLowerCase();if((J.has(es)||t(es))&&y("Duplicate or reserved menu path."),J.add(es),C.windowOpen&&!URL.canParse(C.windowOpen)&&y("Invalid external URL."),X){const g=X.toLowerCase();z.has(g)&&y(`Duplicate or reserved name "${X}".`),z.add(g)}for(const g of[C.icon,(M=C.extra)==null?void 0:M.icon])g&&!Hs(g)&&y(`Unknown icon "${g}".`);if(Z!=null&&Z.length){(O&&O!=="layout"||ks||os||Es!==void 0||C.windowOpen)&&y("Groups accept layout, children and menu metadata."),D.includes(":")&&y("Use static paths for menu groups."),U(Z,D,f||!!((L=C.role)!=null&&L.length));continue}const K=O&&s(O);O&&!K&&y(`Unknown view "${O}".`),+!!O+ +!!os+ +!!C.windowOpen!=1&&y("Specify exactly one view, redirect or external URL."),Es!==void 0&&!K&&y("Props require a view."),C.keepAlive&&(!K||X!==K.name)&&y("keepAlive requires the registered component name."),D.includes(":")&&!C.hidden&&!C.sameLevel&&y("Parameterized paths must be hidden or sameLevel.");for(const g of[D,...d(ks)]){const I=g.toLowerCase();I.split("/").some(us=>us==="."||us==="..")&&y(`Invalid path "${g}".`),(t(I)||v.has(I))&&y(`Duplicate or reserved path "${g}".`),I===r&&(g!==D||D!==r||!K||f||(hs=C.role)!=null&&hs.length)&&y("/dashboard must be a view accessible to all authenticated roles."),g!==D&&(g.includes(":")||D.includes(":"))&&y("Aliases require a static page path.");const ds=I.replace(/:[a-z_]\w*/g,":param");T.has(ds)&&y(`Conflicting parameter pattern "${g}".`),T.add(ds),v.set(I,is)}}};U(R.routes);for(const[B,$]of v){let f=$;const M=new Set;for(;f.redirect;){const L=v.get(f.redirect.toLowerCase());if(M.has(f)||!L||L.meta.windowOpen||f.redirect.includes(":"))throw new Error(`${B}: Redirects must reach a configured page without a cycle.`);M.add(f),f=L}}return R}function F(c){const w=({component:A,children:x,meta:q,...R})=>{var v;return{...R,meta:q,component:A==="layout"?e:A?(v=s(A))==null?void 0:v.load:void 0,children:x==null?void 0:x.map(w)}};return c.routes.map(w)}function N(c){const w=({path:A,name:x,meta:q,component:R,children:v,props:z,alias:J,redirect:T})=>{const U=R===e?"layout":a(R);if(R&&!U)throw new Error(`${A}: Register the view in router/config/views.ts before exporting.`);if(T&&typeof T!="string")throw new Error(`${A}: Export requires a string redirect.`);return{path:A,name:x,meta:q,component:U,alias:J,redirect:T,props:z,children:v==null?void 0:v.map(w)}};return o(JSON.stringify({version:1,routes:c.map(w)}))}return{parseRouteConfig:o,toRuntimeRoutes:F,exportRouteConfig:N}}const ri={class:"ray-demo ray-demo-fields"},pi=["for"],hi=["id","aria-invalid"],ki={class:"ray-demo-result"},oi=$s({__name:"RouteConfigDemo",setup(i){const e=async()=>({}),{parseRouteConfig:s}=li({layout:e,homePath:"/overview",managementPath:"/route-management",findRouteView:t=>t==="overview"?{name:"Overview",load:e}:void 0,findRouteViewId:t=>t===e?"overview":void 0}),a=Ls(),n=Is(JSON.stringify({version:1,routes:[{path:"/overview",component:"overview",name:"Overview",meta:{}}]},null,2)),r=Ms(()=>{try{const{routes:t}=s(n.value);return{invalid:!1,message:`有效路由 / Valid routes: ${t.length}`}}catch(t){return{invalid:!0,message:t instanceof Error?t.message:String(t)}}});return(t,h)=>(Fs(),vs("div",ri,[W("div",null,[W("label",{for:cs(a)},"路由配置 / Route configuration",8,pi),js(W("textarea",{id:cs(a),"onUpdate:modelValue":h[0]||(h[0]=l=>n.value=l),rows:"8",spellcheck:"false","aria-invalid":r.value.invalid},null,8,hi),[[Vs,n.value]]),W("output",ki,Us(r.value.message),1)])]))}}),Ei=Ks(oi,[["__scopeId","data-v-e6a3014a"]]),yi=JSON.parse('{"title":"路由、菜单与权限","description":"","frontmatter":{},"headers":[],"relativePath":"guide/routing.md","filePath":"guide/routing.md"}'),di={name:"guide/routing.md"},gi=Object.assign(di,{setup(i){return(e,s)=>(Fs(),vs("div",null,[s[0]||(s[0]=ys("",4)),Gs(Ei),s[1]||(s[1]=ys("",9))]))}});export{yi as __pageData,gi as default}; diff --git a/docs/assets/guide_start.md.B6oCR027.js b/docs/assets/guide_start.md.DGuorSaq.js similarity index 92% rename from docs/assets/guide_start.md.B6oCR027.js rename to docs/assets/guide_start.md.DGuorSaq.js index 56b817f9..8cd28152 100644 --- a/docs/assets/guide_start.md.B6oCR027.js +++ b/docs/assets/guide_start.md.DGuorSaq.js @@ -1,8 +1,8 @@ -import{_ as s,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"快速开始","description":"","frontmatter":{},"headers":[],"relativePath":"guide/start.md","filePath":"guide/start.md"}'),n={name:"guide/start.md"};function l(p,a,h,r,d,k){return i(),e("div",null,[...a[0]||(a[0]=[t(`

快速开始 ​

本文使用 Ray Template v6。v5 项目请先查看版本分界。

启动工作台 ​

准备 Node.js 26.13.0 和 pnpm 12.16.1。以下以 nvm 为例:

sh
git clone https://github.com/XiaoDaiGua-Ray/ray-template.git
+import{_ as s,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"快速开始","description":"","frontmatter":{},"headers":[],"relativePath":"guide/start.md","filePath":"guide/start.md"}'),n={name:"guide/start.md"};function l(p,a,h,r,k,o){return i(),e("div",null,[...a[0]||(a[0]=[t(`

快速开始 ​

本文使用 Ray Template v6。v5 项目请先查看版本分界。

启动工作台 ​

准备 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 dev

打开 http://127.0.0.1:9527/ray-template/,如果端口被占用,以 Vite 输出的地址为准。使用预填表单登录,再打开「表格 → 远端查询与分页」或「布局实验室」。也可直接体验在线演示。

演示与真实业务

预填表单、会话和 Mock 用于展示前端工作流。对外部署真实业务前,接入自己的认证、服务端权限校验和 API。

启动文档 ​

在同一个工作区运行 pnpm docs:dev。按终端地址打开 /ray-template/docs/,可以直接操作 TablePro、条码和布局示例。

相关文档 ​

第一个业务页面 · v5 与 v6 的版本分界 · 工程检查与部署

运行时与依赖清单 · 项目目录与启动链路

`,12)])])}const F=s(n,[["render",l]]);export{c as __pageData,F as default}; +pnpm dev

打开 http://127.0.0.1:9527/ray-template/,如果端口被占用,以 Vite 输出的地址为准。使用预填表单登录,再打开「表格 → 远端查询与分页」或「布局实验室」。也可直接体验在线演示。

演示与真实业务

预填表单、会话和 Mock 用于展示前端工作流。对外部署真实业务前,接入自己的认证、服务端权限校验和 API。

启动文档 ​

在同一个工作区运行 pnpm docs:dev。按终端地址打开 /ray-template/docs/,可以直接操作 TablePro、条码和布局示例。

相关文档 ​

第一个业务页面 · v5 与 v6 的版本分界 · 工程检查与部署

运行时与依赖清单 · 项目目录与启动链路

`,12)])])}const F=s(n,[["render",l]]);export{c as __pageData,F as default}; diff --git a/docs/assets/guide_start.md.B6oCR027.lean.js b/docs/assets/guide_start.md.DGuorSaq.lean.js similarity index 83% rename from docs/assets/guide_start.md.B6oCR027.lean.js rename to docs/assets/guide_start.md.DGuorSaq.lean.js index 81678429..80693993 100644 --- a/docs/assets/guide_start.md.B6oCR027.lean.js +++ b/docs/assets/guide_start.md.DGuorSaq.lean.js @@ -1 +1 @@ -import{_ as s,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"快速开始","description":"","frontmatter":{},"headers":[],"relativePath":"guide/start.md","filePath":"guide/start.md"}'),n={name:"guide/start.md"};function l(p,a,h,r,d,k){return i(),e("div",null,[...a[0]||(a[0]=[t("",12)])])}const F=s(n,[["render",l]]);export{c as __pageData,F as default}; +import{_ as s,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"快速开始","description":"","frontmatter":{},"headers":[],"relativePath":"guide/start.md","filePath":"guide/start.md"}'),n={name:"guide/start.md"};function l(p,a,h,r,k,o){return i(),e("div",null,[...a[0]||(a[0]=[t("",12)])])}const F=s(n,[["render",l]]);export{c as __pageData,F as default}; diff --git a/docs/assets/guide_tooling.md.CkJoP04H.js b/docs/assets/guide_tooling.md.-PnA0rJL.js similarity index 89% rename from docs/assets/guide_tooling.md.CkJoP04H.js rename to docs/assets/guide_tooling.md.-PnA0rJL.js index 15dcf3f0..80b946de 100644 --- a/docs/assets/guide_tooling.md.CkJoP04H.js +++ b/docs/assets/guide_tooling.md.-PnA0rJL.js @@ -1 +1 @@ -import{_ as t,o as d,c as o,a3 as a}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"工程检查与部署","description":"","frontmatter":{},"headers":[],"relativePath":"guide/tooling.md","filePath":"guide/tooling.md"}'),c={name:"guide/tooling.md"};function r(i,e,p,n,s,l){return d(),o("div",null,[...e[0]||(e[0]=[a('

工程检查与部署 ​

常用命令 ​

命令用途
pnpm env:check校验 Node、pnpm 与依赖安装
pnpm dev同步图标清单并启动 Vite
pnpm harness context查任务域;追加 routing、ui、api 等可看实现入口和回归
pnpm harness verify ui按域运行定向测试
pnpm harness verify运行全量检查并生成本地报告
pnpm typecheck验证图标清单,检查应用、Node 配置和测试类型
pnpm dev-build / pnpm report构建开发版,或输出静态打包报告
pnpm build / pnpm preview构建并在本机验收产物
pnpm packages:check检查公开入口、依赖声明和循环依赖
pnpm pages:build将后台与文档组装到 dist/pages
pnpm docs:dev启动文档开发站
pnpm docs:check验证文档示例类型、站内链接与生产构建
pnpm docs:preview预览已构建的文档站

全量检查包含环境、Harness、图标同步、类型、ESLint、Prettier、Vitest 和生产构建。Harness 在 .harness-local/runs/ 写结果;Chrome 验收单独记录。改动交互或布局时,额外验收中英文、明暗主题和窄屏。

部署到子路径 ​

pnpm build 输出 dist/production。将产物部署到与 vite.custom.config.ts 中 base 对应的路径。默认应用为 /ray-template/,域名根目录部署改为 /。Vite 默认打包本地依赖;可选 CDN 模式需另外确认目标环境能访问 CDN。

组合部署使用 pnpm pages:build,将 dist/pages 作为同一个站点的产物。官方地址为 /ray-template/,其下 docs/ 目录提供 v6 官网。CI 传入 RAY_TEMPLATE_SOURCE_REF,把文档的当前源码链接固定到发布提交。

公开生产部署可在构建环境设置 RAY_TEMPLATE_SITE_ORIGIN 为实际站点源地址(例如 https://example.com),由 base 补足路径。未配置时应用产物使用 noindex。公开 sitemap 列出入口页,登录后的 hash 路由用于应用交互。

二次开发约定 ​

  • 新页面遵循 Vue 3 Composition API + TSX 或现有 SFC 模式。复用现有组件,声明按职责归档。
  • Vue、Router、Pinia 的自动导入声明由生成器维护;类型使用 import type。应用、测试、Node 配置的 TS 边界不同。
  • 格式由 Prettier 管理,ESLint 使用 flat config。提交约定和注释写法以应用仓库当前规则为准。

工程与部署入口 · AI Harness · 注释规范

',11)])])}const b=t(c,[["render",r]]);export{m as __pageData,b as default}; +import{_ as t,o as d,c as o,a3 as c}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"工程检查与部署","description":"","frontmatter":{},"headers":[],"relativePath":"guide/tooling.md","filePath":"guide/tooling.md"}'),a={name:"guide/tooling.md"};function r(i,e,p,n,s,l){return d(),o("div",null,[...e[0]||(e[0]=[c('

工程检查与部署 ​

常用命令 ​

命令用途
pnpm env:check校验 Node、pnpm 与依赖安装
pnpm dev同步图标清单并启动 Vite
pnpm harness context查任务域;追加 routing、ui、api 等可看实现入口和回归
pnpm harness verify ui按域运行定向测试
pnpm harness verify运行全量检查并生成本地报告
pnpm typecheck验证图标清单,检查应用、Node 配置和测试类型
pnpm dev-build / pnpm report构建开发版,或输出静态打包报告
pnpm build / pnpm preview构建并在本机验收产物
pnpm packages:check检查公开入口、依赖声明和循环依赖
pnpm pages:build将后台与文档组装到 dist/pages
pnpm docs:dev启动文档开发站
pnpm docs:check验证文档示例类型、站内链接与生产构建
pnpm docs:preview预览已构建的文档站

全量检查包含环境、Harness、图标同步、类型、ESLint、Prettier、Vitest 和生产构建。Harness 在 .harness-local/runs/ 写结果;Chrome 验收单独记录。改动交互或布局时,额外验收中英文、明暗主题和窄屏。

部署到子路径 ​

pnpm build 输出 dist/production。将产物部署到与 vite.custom.config.ts 中 base 对应的路径。默认应用为 /ray-template/,域名根目录部署改为 /。Vite 默认打包本地依赖;可选 CDN 模式需另外确认目标环境能访问 CDN。

组合部署使用 pnpm pages:build,将 dist/pages 作为同一个站点的产物。官方地址为 /ray-template/,其下 docs/ 目录提供 v6 官网。CI 传入 RAY_TEMPLATE_SOURCE_REF,把文档的当前源码链接固定到发布提交。

公开生产部署可在构建环境设置 RAY_TEMPLATE_SITE_ORIGIN 为实际站点源地址(例如 https://example.com),由 base 补足路径。未配置时应用产物使用 noindex。公开 sitemap 列出入口页,登录后的 hash 路由用于应用交互。

二次开发约定 ​

  • 新页面遵循 Vue 3 Composition API + TSX 或现有 SFC 模式。复用现有组件,声明按职责归档。
  • Vue、Router、Pinia 的自动导入声明由生成器维护;类型使用 import type。应用、测试、Node 配置的 TS 边界不同。
  • 格式由 Prettier 管理,ESLint 使用 flat config。提交约定和注释写法以应用仓库当前规则为准。

工程与部署入口 · AI Harness · 注释规范

',11)])])}const f=t(a,[["render",r]]);export{m as __pageData,f as default}; diff --git a/docs/assets/guide_tooling.md.-PnA0rJL.lean.js b/docs/assets/guide_tooling.md.-PnA0rJL.lean.js new file mode 100644 index 00000000..d344f272 --- /dev/null +++ b/docs/assets/guide_tooling.md.-PnA0rJL.lean.js @@ -0,0 +1 @@ +import{_ as t,o as d,c as o,a3 as c}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"工程检查与部署","description":"","frontmatter":{},"headers":[],"relativePath":"guide/tooling.md","filePath":"guide/tooling.md"}'),a={name:"guide/tooling.md"};function r(i,e,p,n,s,l){return d(),o("div",null,[...e[0]||(e[0]=[c("",11)])])}const f=t(a,[["render",r]]);export{m as __pageData,f as default}; diff --git a/docs/assets/guide_tooling.md.CkJoP04H.lean.js b/docs/assets/guide_tooling.md.CkJoP04H.lean.js deleted file mode 100644 index 9061b6cb..00000000 --- a/docs/assets/guide_tooling.md.CkJoP04H.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,o as d,c as o,a3 as a}from"./chunks/framework.BNdm2jZV.js";const m=JSON.parse('{"title":"工程检查与部署","description":"","frontmatter":{},"headers":[],"relativePath":"guide/tooling.md","filePath":"guide/tooling.md"}'),c={name:"guide/tooling.md"};function r(i,e,p,n,s,l){return d(),o("div",null,[...e[0]||(e[0]=[a("",11)])])}const b=t(c,[["render",r]]);export{m as __pageData,b as default}; diff --git a/docs/assets/reference_components.md.iMZjSjdU.js b/docs/assets/reference_components.md.Vx6LcOjp.js similarity index 86% rename from docs/assets/reference_components.md.iMZjSjdU.js rename to docs/assets/reference_components.md.Vx6LcOjp.js index 0b5fc6e7..98ca314e 100644 --- a/docs/assets/reference_components.md.iMZjSjdU.js +++ b/docs/assets/reference_components.md.Vx6LcOjp.js @@ -1 +1 @@ -import{_ as e,o,c as d,a3 as r}from"./chunks/framework.BNdm2jZV.js";const i=JSON.parse('{"title":"组件","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components.md","filePath":"reference/components.md"}'),a={name:"reference/components.md"};function c(n,t,p,s,m,l){return o(),d("div",null,[...t[0]||(t[0]=[r('

组件 ​

通用组件从 @ray-template/ui 导入,也可用 /table-pro、/barcode 等子路径按需加载。Ray Admin 内可以使用 @/components。路由过渡位于 @ray-template/admin-shell,由应用接入当前路由和缓存状态。许多组件包装 Naive UI:本文列出模板添加、改写或消费的属性、插槽和事件,原始控件的其余能力以锁定依赖的类型为准。

组件Props 类型主要用途
RTableProTableProProps纯表格、远端查询、自适应高度、列设置、打印
RFormFormProps表单加载、校验、重置和键盘提交
RModalModalProps受控弹窗、预设宽度和全屏卡片
RChartChartPropsECharts 初始化、主题和导出
RFlowFlowPropsLogicFlow 流程图与只读切换
RCollapseGridCollapseGridProps可折叠筛选区及操作列
RSegmentSegmentProps分段选项、图标和提示
RMoreDropdownMoreDropdownProps图标菜单、行操作
RIframeIframeProps外部页面与加载状态
RBarcodeBarcodePropsCanvas / SVG 条码
RDraggableCardDefaultPosition(位置类型)可拖动卡片与拖动边界
RTransitionComponentTransitionComponentProps路由过渡与 KeepAlive
RIconIconProps类型化 SVG 雪碧图

应用组件与 Provider 使用模板的状态、主题或路由,按文件导入。二维码 使用 vue3-next-qrcode,不属于 @/components 的导出。

组件实现、样式和类型放在同一个组件目录。组件属性对象也有具名导出,例如 formProps、modalProps、chartProps;业务代码通常直接使用组件和公开 Props 类型。TablePro 统一使用组件 ref 获取实例,RForm、RChart、RFlow 使用各自的 onRegister 契约。

公开导出 · 组件约定 · 示例源码

',6)])])}const f=e(a,[["render",c]]);export{i as __pageData,f as default}; +import{_ as e,o,c as d,a3 as r}from"./chunks/framework.BNdm2jZV.js";const f=JSON.parse('{"title":"组件","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components.md","filePath":"reference/components.md"}'),a={name:"reference/components.md"};function c(n,t,p,s,m,l){return o(),d("div",null,[...t[0]||(t[0]=[r('

组件 ​

通用组件从 @ray-template/ui 导入,也可用 /table-pro、/barcode 等子路径按需加载。Ray Admin 内可以使用 @/components。路由过渡位于 @ray-template/admin-shell,由应用接入当前路由和缓存状态。许多组件包装 Naive UI:本文列出模板添加、改写或消费的属性、插槽和事件,原始控件的其余能力以锁定依赖的类型为准。

组件Props 类型主要用途
RTableProTableProProps纯表格、远端查询、自适应高度、列设置、打印
RFormFormProps表单加载、校验、重置和键盘提交
RModalModalProps受控弹窗、预设宽度和全屏卡片
RChartChartPropsECharts 初始化、主题和导出
RFlowFlowPropsLogicFlow 流程图与只读切换
RCollapseGridCollapseGridProps可折叠筛选区及操作列
RSegmentSegmentProps分段选项、图标和提示
RMoreDropdownMoreDropdownProps图标菜单、行操作
RIframeIframeProps外部页面与加载状态
RBarcodeBarcodePropsCanvas / SVG 条码
RDraggableCardDefaultPosition(位置类型)可拖动卡片与拖动边界
RTransitionComponentTransitionComponentProps路由过渡与 KeepAlive
RIconIconProps类型化 SVG 雪碧图

应用组件与 Provider 使用模板的状态、主题或路由,按文件导入。二维码 使用 vue3-next-qrcode,不属于 @/components 的导出。

组件实现、样式和类型放在同一个组件目录。组件属性对象也有具名导出,例如 formProps、modalProps、chartProps;业务代码通常直接使用组件和公开 Props 类型。TablePro 统一使用组件 ref 获取实例,RForm、RChart、RFlow 使用各自的 onRegister 契约。

公开导出 · 组件约定 · 示例源码

',6)])])}const i=e(a,[["render",c]]);export{f as __pageData,i as default}; diff --git a/docs/assets/reference_components.md.iMZjSjdU.lean.js b/docs/assets/reference_components.md.Vx6LcOjp.lean.js similarity index 62% rename from docs/assets/reference_components.md.iMZjSjdU.lean.js rename to docs/assets/reference_components.md.Vx6LcOjp.lean.js index e8154d12..20bcb25b 100644 --- a/docs/assets/reference_components.md.iMZjSjdU.lean.js +++ b/docs/assets/reference_components.md.Vx6LcOjp.lean.js @@ -1 +1 @@ -import{_ as e,o,c as d,a3 as r}from"./chunks/framework.BNdm2jZV.js";const i=JSON.parse('{"title":"组件","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components.md","filePath":"reference/components.md"}'),a={name:"reference/components.md"};function c(n,t,p,s,m,l){return o(),d("div",null,[...t[0]||(t[0]=[r("",6)])])}const f=e(a,[["render",c]]);export{i as __pageData,f as default}; +import{_ as e,o,c as d,a3 as r}from"./chunks/framework.BNdm2jZV.js";const f=JSON.parse('{"title":"组件","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components.md","filePath":"reference/components.md"}'),a={name:"reference/components.md"};function c(n,t,p,s,m,l){return o(),d("div",null,[...t[0]||(t[0]=[r("",6)])])}const i=e(a,[["render",c]]);export{f as __pageData,i as default}; diff --git a/docs/assets/reference_components_app.md.Q6aQiDRo.js b/docs/assets/reference_components_app.md.Bqi2MKtD.js similarity index 96% rename from docs/assets/reference_components_app.md.Q6aQiDRo.js rename to docs/assets/reference_components_app.md.Bqi2MKtD.js index 2edc53dd..e8836546 100644 --- a/docs/assets/reference_components_app.md.Q6aQiDRo.js +++ b/docs/assets/reference_components_app.md.Bqi2MKtD.js @@ -1,4 +1,4 @@ -import{_ as s,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"应用组件与 Provider","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/app.md","filePath":"reference/components/app.md"}'),d={name:"reference/components/app.md"};function p(n,i,r,h,o,l){return a(),e("div",null,[...i[0]||(i[0]=[t(`

应用组件与 Provider ​

这些组件按文件默认导入,例如 import AppPageHeader from '@/app-components/app/AppPageHeader'。它们依赖应用 Store、路由或 DOM,按默认 App 挂载顺序集成。

页面组件 ​

组件配置和注意事项
AppPageHeadertitle 必填,description 默认空,eyebrow 默认 RAY TEMPLATE。默认插槽是右侧操作区,页面内容放在组件之外。
AppShareLinkvariant: 'compact' | 'cards',默认 compact,从 dashboard 语言包读文案。链接由组件内配置,不接收任意链接列表。
AppAvatar从 Signing Store 读头像与名字。avatarSize、spaceSize 默认 medium,vertical 默认 false;头像使用圆形、cover,空头像用名称首字。src 和 size 会被内部读取的值覆盖。
AppGlobalSpin接收 NSpin 属性与插槽。显隐以 Runtime Store 的 globalSpinning 为准,传入 show 会被覆盖;和布局内容区 Spin 独立。
AppLockScreen由 setting.lockScreenSwitch 控制锁屏设置弹窗,不允许点遮罩或 Esc 关闭。锁定后由布局读取 Lock Screen Store 呈现解锁界面。
tsx
import AppPageHeader from '@/app-components/app/AppPageHeader'
+import{_ as s,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"应用组件与 Provider","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/app.md","filePath":"reference/components/app.md"}'),d={name:"reference/components/app.md"};function p(n,i,r,h,o,l){return a(),e("div",null,[...i[0]||(i[0]=[t(`

应用组件与 Provider ​

这些组件按文件默认导入,例如 import AppPageHeader from '@/app-components/app/AppPageHeader'。它们依赖应用 Store、路由或 DOM,按默认 App 挂载顺序集成。

页面组件 ​

组件配置和注意事项
AppPageHeadertitle 必填,description 默认空,eyebrow 默认 RAY TEMPLATE。默认插槽是右侧操作区,页面内容放在组件之外。
AppShareLinkvariant: 'compact' | 'cards',默认 compact,从 dashboard 语言包读文案。链接由组件内配置,不接收任意链接列表。
AppAvatar从 Signing Store 读头像与名字。avatarSize、spaceSize 默认 medium,vertical 默认 false;头像使用圆形、cover,空头像用名称首字。src 和 size 会被内部读取的值覆盖。
AppGlobalSpin接收 NSpin 属性与插槽。显隐以 Runtime Store 的 globalSpinning 为准,传入 show 会被覆盖;和布局内容区 Spin 独立。
AppLockScreen由 setting.lockScreenSwitch 控制锁屏设置弹窗,不允许点遮罩或 Esc 关闭。锁定后由布局读取 Lock Screen Store 呈现解锁界面。
tsx
import AppPageHeader from '@/app-components/app/AppPageHeader'
 import { NButton } from 'naive-ui'
 
 export const renderOrdersHeader = (create: () => void) => (
@@ -7,4 +7,4 @@ import{_ as s,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c
       新建订单
     </NButton>
   </AppPageHeader>
-)

Provider ​

Provider职责与调用时机
AppNaiveGlobalProvider包裹默认插槽并同步明暗、主题覆盖、UI locale 和日期 locale。提供 Message、Dialog、Modal、Notification、LoadingBar 等上下文,并建立 window.$message、$dialog、$notification、$loadingBar。离散 API 在 Provider 初始化后可用,卸载时释放;不要在模块顶层提前调用。
AppStyleProvider同步 HTML 明暗类、CSS 主色和窗口尺寸变量,结束首屏加载动画。应用主题应通过设置方法更新。
AppVersionProvider启动时比较构建版本与本地版本。第一次写入缓存,变化时提示,确认会走退出并刷新;取消关闭提示。
AppWatermarkProvider按设置渲染全屏 Naive UI 水印;独立页面如需局部水印可自行在目标区域使用 NWatermark。
AppRequestCancelerProvider默认布局内容的路由更新钩子会取消模板管理的请求。替换内容插槽时,根据实际导航方式保留取消行为。

应用组件说明 · 布局配置 · Store · 请求取消

`,8)])])}const g=s(d,[["render",p]]);export{c as __pageData,g as default}; +)

Provider ​

Provider职责与调用时机
AppNaiveGlobalProvider包裹默认插槽并同步明暗、主题覆盖、UI locale 和日期 locale。提供 Message、Dialog、Modal、Notification、LoadingBar 等上下文,并建立 window.$message、$dialog、$notification、$loadingBar。离散 API 在 Provider 初始化后可用,卸载时释放;不要在模块顶层提前调用。
AppStyleProvider同步 HTML 明暗类、CSS 主色和窗口尺寸变量,结束首屏加载动画。应用主题应通过设置方法更新。
AppVersionProvider启动时比较构建版本与本地版本。第一次写入缓存,变化时提示,确认会走退出并刷新;取消关闭提示。
AppWatermarkProvider按设置渲染全屏 Naive UI 水印;独立页面如需局部水印可自行在目标区域使用 NWatermark。
AppRequestCancelerProvider默认布局内容的路由更新钩子会取消模板管理的请求。替换内容插槽时,根据实际导航方式保留取消行为。

应用组件说明 · 布局配置 · Store · 请求取消

`,8)])])}const g=s(d,[["render",p]]);export{c as __pageData,g as default}; diff --git a/docs/assets/reference_components_app.md.Q6aQiDRo.lean.js b/docs/assets/reference_components_app.md.Bqi2MKtD.lean.js similarity index 100% rename from docs/assets/reference_components_app.md.Q6aQiDRo.lean.js rename to docs/assets/reference_components_app.md.Bqi2MKtD.lean.js diff --git a/docs/assets/reference_components_barcode.md.BbJVFbEo.js b/docs/assets/reference_components_barcode.md.DepkAiNq.js similarity index 99% rename from docs/assets/reference_components_barcode.md.BbJVFbEo.js rename to docs/assets/reference_components_barcode.md.DepkAiNq.js index 90d8996e..8f56c750 100644 --- a/docs/assets/reference_components_barcode.md.BbJVFbEo.js +++ b/docs/assets/reference_components_barcode.md.DepkAiNq.js @@ -102,4 +102,4 @@ import{o as n,c as h,a3 as i,E as k,k as t,a7 as l,V as p}from"./chunks/framewor options={{ displayValue: true, height: 60 }} onError={(error) => console.error('条码格式无效', error)} /> -)
属性默认说明
text无条码文本。留空或传入不符合格式的值时可能渲染失败。
format'CODE128'条码制式,覆盖 options.format。
barcodeRender'canvas'canvas 或 svg。
options{}JsBarcode options,如 displayValue、lineColor、margin、条宽和条高。
width / height'auto'显示尺寸,数字按像素。与 options 中条码自身的条宽、条高不同。
responsivefalse监听容器尺寸;用 width="responsive" 或 height="responsive" 让对应尺寸随容器调整。
watchTexttrue文本变化时重绘。独立改变 format、options 或渲染介质时不要依赖文本 watcher,可以按配置更换组件 key。
loadingfalse控制 Spin;调用方负责开关。

onSuccess(text, format, options)、onError(error)、onFinally() 支持函数或回调数组。成功回调收到原始 options;组件响应式调整的条宽和条高不写回该对象。绘制异常通过 onError 通知,业务代码可据此提示或清理旧预览。

支持 CODE39、CODE128 及 A/B/C 变体、EAN13/EAN8/EAN5/EAN2、UPC、ITF14/ITF、MSI/MSI10/MSI11/MSI1010/MSI1110、pharmacode、codabar。使用 EAN 或 UPC 前验证输入长度和校验位。打印后是否可扫取决于设备和成品尺寸。

组件实现 · 制式和选项类型

`,7))]))}});export{g as __pageData,y as default}; +)
属性默认说明
text无条码文本。留空或传入不符合格式的值时可能渲染失败。
format'CODE128'条码制式,覆盖 options.format。
barcodeRender'canvas'canvas 或 svg。
options{}JsBarcode options,如 displayValue、lineColor、margin、条宽和条高。
width / height'auto'显示尺寸,数字按像素。与 options 中条码自身的条宽、条高不同。
responsivefalse监听容器尺寸;用 width="responsive" 或 height="responsive" 让对应尺寸随容器调整。
watchTexttrue文本变化时重绘。独立改变 format、options 或渲染介质时不要依赖文本 watcher,可以按配置更换组件 key。
loadingfalse控制 Spin;调用方负责开关。

onSuccess(text, format, options)、onError(error)、onFinally() 支持函数或回调数组。成功回调收到原始 options;组件响应式调整的条宽和条高不写回该对象。绘制异常通过 onError 通知,业务代码可据此提示或清理旧预览。

支持 CODE39、CODE128 及 A/B/C 变体、EAN13/EAN8/EAN5/EAN2、UPC、ITF14/ITF、MSI/MSI10/MSI11/MSI1010/MSI1110、pharmacode、codabar。使用 EAN 或 UPC 前验证输入长度和校验位。打印后是否可扫取决于设备和成品尺寸。

组件实现 · 制式和选项类型

`,7))]))}});export{g as __pageData,y as default}; diff --git a/docs/assets/reference_components_barcode.md.BbJVFbEo.lean.js b/docs/assets/reference_components_barcode.md.DepkAiNq.lean.js similarity index 100% rename from docs/assets/reference_components_barcode.md.BbJVFbEo.lean.js rename to docs/assets/reference_components_barcode.md.DepkAiNq.lean.js diff --git a/docs/assets/reference_components_chart.md.JthpvMcl.js b/docs/assets/reference_components_chart.md.Z0MZ0zwB.js similarity index 96% rename from docs/assets/reference_components_chart.md.JthpvMcl.js rename to docs/assets/reference_components_chart.md.Z0MZ0zwB.js index f565ce45..96d9cf98 100644 --- a/docs/assets/reference_components_chart.md.JthpvMcl.js +++ b/docs/assets/reference_components_chart.md.Z0MZ0zwB.js @@ -18,4 +18,4 @@ import{_ as i,o as e,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const k /> ) }, -})

渲染、主题与更新 ​

属性默认说明
options{}ECharts 配置。showAria 默认 false,模板会写入 aria.enabled 和 aria.decal.show。
width / height'100%'CSS 尺寸,数字按像素。
use[]额外 ECharts 注册项。内置柱、线、饼、K 线、散点、象形柱、Canvas,以及标题、提示、网格、数据集、图例等基础模块。
intersectionObservertrue进入观察范围后挂载图表;隐藏区域的实例可能尚不可用。
intersectionObserverTarget / intersectionOptions容器 / { threshold: 0.1 }自定义观察目标与参数。
autoResize / autoResizeObserverTargettrue / 外层容器容器尺寸变化后节流 resize。
watchOptions / watchDeeptrue / true是否订阅 options,是否深层观察。
watchOptionsThrottleWait500options 更新节流间隔(毫秒)。
nextTicktrue初始化前等待 Vue 更新。
setChartOptions{ notMerge: true, lazyUpdate: true, silent: false, replaceMerge: [] }ECharts setOption 的控制参数。
theme / autoChangeThemenull / true默认用应用的 ECharts 主题及暗色变体。固定主题请传注册后的主题名。
loading / loadingOptionsfalse / 模板加载样式是否显示 ECharts 加载层及参数。

Provider 指定主题时优先。当前实现中 theme="default" 在 autoChangeTheme=true 时会传内建 dark,设为 false 才使用空主题名;需要明确的渲染效果时建议传实际主题名。切换主题可能重建实例,持有实例引用的代码应重新读取或注册。

卡片预设和回调 ​

  • preset="card" 使用 Naive UI Card,支持 title(字符串或渲染函数)、bordered(默认 true)、contentStyle。cardExtra 插槽可替换右上角。
  • 默认菜单含图片下载;downloadOptions 接受 ECharts getDataURL 参数和可选 filename。传入 dropdownOptions 会替换菜单,选择项通过 onDropdownSelect(key, option) 通知。
  • onSuccess(instance)、onError()、onFinally() 对应初始化结果;错误仍可能向调用侧抛出。onRegister(instance, render, dispose) 在可用实例建立后调用。

useChart() 返回 [register, actions]。getChartInstance() 返回 { echartInst, render, dispose },注册前会抛错。isDisposed() 检查底层实例,dispose() 释放图表和监听,render() 调用组件挂载逻辑;已存在实例时不要用它替代更新 options 或 setOption。图表随组件卸载清理。

Props · 组件实现 · useChart

`,10)])])}const E=i(d,[["render",n]]);export{k as __pageData,E as default}; +})

渲染、主题与更新 ​

属性默认说明
options{}ECharts 配置。showAria 默认 false,模板会写入 aria.enabled 和 aria.decal.show。
width / height'100%'CSS 尺寸,数字按像素。
use[]额外 ECharts 注册项。内置柱、线、饼、K 线、散点、象形柱、Canvas,以及标题、提示、网格、数据集、图例等基础模块。
intersectionObservertrue进入观察范围后挂载图表;隐藏区域的实例可能尚不可用。
intersectionObserverTarget / intersectionOptions容器 / { threshold: 0.1 }自定义观察目标与参数。
autoResize / autoResizeObserverTargettrue / 外层容器容器尺寸变化后节流 resize。
watchOptions / watchDeeptrue / true是否订阅 options,是否深层观察。
watchOptionsThrottleWait500options 更新节流间隔(毫秒)。
nextTicktrue初始化前等待 Vue 更新。
setChartOptions{ notMerge: true, lazyUpdate: true, silent: false, replaceMerge: [] }ECharts setOption 的控制参数。
theme / autoChangeThemenull / true默认用应用的 ECharts 主题及暗色变体。固定主题请传注册后的主题名。
loading / loadingOptionsfalse / 模板加载样式是否显示 ECharts 加载层及参数。

Provider 指定主题时优先。当前实现中 theme="default" 在 autoChangeTheme=true 时会传内建 dark,设为 false 才使用空主题名;需要明确的渲染效果时建议传实际主题名。切换主题可能重建实例,持有实例引用的代码应重新读取或注册。

卡片预设和回调 ​

  • preset="card" 使用 Naive UI Card,支持 title(字符串或渲染函数)、bordered(默认 true)、contentStyle。cardExtra 插槽可替换右上角。
  • 默认菜单含图片下载;downloadOptions 接受 ECharts getDataURL 参数和可选 filename。传入 dropdownOptions 会替换菜单,选择项通过 onDropdownSelect(key, option) 通知。
  • onSuccess(instance)、onError()、onFinally() 对应初始化结果;错误仍可能向调用侧抛出。onRegister(instance, render, dispose) 在可用实例建立后调用。

useChart() 返回 [register, actions]。getChartInstance() 返回 { echartInst, render, dispose },注册前会抛错。isDisposed() 检查底层实例,dispose() 释放图表和监听,render() 调用组件挂载逻辑;已存在实例时不要用它替代更新 options 或 setOption。图表随组件卸载清理。

Props · 组件实现 · useChart

`,10)])])}const E=i(d,[["render",n]]);export{k as __pageData,E as default}; diff --git a/docs/assets/reference_components_chart.md.JthpvMcl.lean.js b/docs/assets/reference_components_chart.md.Z0MZ0zwB.lean.js similarity index 100% rename from docs/assets/reference_components_chart.md.JthpvMcl.lean.js rename to docs/assets/reference_components_chart.md.Z0MZ0zwB.lean.js diff --git a/docs/assets/reference_components_collapse-grid.md._8SHiB6D.js b/docs/assets/reference_components_collapse-grid.md.CV_6fiGv.js similarity index 97% rename from docs/assets/reference_components_collapse-grid.md._8SHiB6D.js rename to docs/assets/reference_components_collapse-grid.md.CV_6fiGv.js index e475d00c..ad136cd8 100644 --- a/docs/assets/reference_components_collapse-grid.md._8SHiB6D.js +++ b/docs/assets/reference_components_collapse-grid.md.CV_6fiGv.js @@ -31,4 +31,4 @@ import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const o </RCollapseGrid> ) }, -})

组件实现 · Props

`,7)])])}const c=i(l,[["render",p]]);export{o as __pageData,c as default}; +})

组件实现 · Props

`,7)])])}const c=i(l,[["render",p]]);export{o as __pageData,c as default}; diff --git a/docs/assets/reference_components_collapse-grid.md._8SHiB6D.lean.js b/docs/assets/reference_components_collapse-grid.md.CV_6fiGv.lean.js similarity index 100% rename from docs/assets/reference_components_collapse-grid.md._8SHiB6D.lean.js rename to docs/assets/reference_components_collapse-grid.md.CV_6fiGv.lean.js diff --git a/docs/assets/reference_components_draggable-card.md.4XemeqwB.js b/docs/assets/reference_components_draggable-card.md.DqkOgOtj.js similarity index 97% rename from docs/assets/reference_components_draggable-card.md.4XemeqwB.js rename to docs/assets/reference_components_draggable-card.md.DqkOgOtj.js index 76e81e9e..2b6b9a6b 100644 --- a/docs/assets/reference_components_draggable-card.md.4XemeqwB.js +++ b/docs/assets/reference_components_draggable-card.md.DqkOgOtj.js @@ -9,4 +9,4 @@ import{_ as a,o as t,c as i,a3 as e}from"./chunks/framework.BNdm2jZV.js";const c > 拖动标题可移动此卡片 </RDraggableCard> -)

组件源码

`,6)])])}const g=a(d,[["render",n]]);export{c as __pageData,g as default}; +)

组件源码

`,6)])])}const g=a(d,[["render",n]]);export{c as __pageData,g as default}; diff --git a/docs/assets/reference_components_draggable-card.md.4XemeqwB.lean.js b/docs/assets/reference_components_draggable-card.md.DqkOgOtj.lean.js similarity index 100% rename from docs/assets/reference_components_draggable-card.md.4XemeqwB.lean.js rename to docs/assets/reference_components_draggable-card.md.DqkOgOtj.lean.js diff --git a/docs/assets/reference_components_flow.md.s-rnj-8X.js b/docs/assets/reference_components_flow.md.bnqgmwU4.js similarity index 96% rename from docs/assets/reference_components_flow.md.s-rnj-8X.js rename to docs/assets/reference_components_flow.md.bnqgmwU4.js index 02fe3d2e..12157d8a 100644 --- a/docs/assets/reference_components_flow.md.s-rnj-8X.js +++ b/docs/assets/reference_components_flow.md.bnqgmwU4.js @@ -25,4 +25,4 @@ import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c onRegister={(instance) => instance.render(graph)} /> ), -})
属性默认说明
width / height'100%'容器尺寸,需要可计算的高度。
data无后续引用变化时重绘,嵌套原地修改不触发。当前挂载分支先渲染空图,首屏请在 onRegister 里主动渲染。
watchDatatrue是否监听传入数据。关闭后可从实例控制重绘。
readonlyfalse同步 LogicFlow 静默模式和节点、边文本编辑状态。
options网格开、partial: false、键盘开LogicFlow 初始化配置,包括尺寸、背景、键盘、边、交互、历史和插件等。container 由组件管理。
use无LogicFlow 全局插件列表,组件只在首次初始化时注册一次。需要实例级插件时检查 options.plugins。
onRegister(instance)无挂载后取得 LogicFlow,支持回调数组。

FlowOptions 支持的字段按用途分组:

  • 画布与布局:width、height、background、grid、partial、style、overlapMode。
  • 交互:keyboard、adjustEdge、allowRotate、allowResize、isSilentMode、stopScrollGraph、stopZoomGraph、stopMoveGraph、textEdit、textMode、edgeTextMode、nodeTextMode、guards。
  • 边和渲染:edgeType、customTrajectory、animation、history、outline、snapline。
  • 扩展:plugins、pluginsOptions、disabledPlugins、disabledTools、idGenerator、edgeGenerator。

FlowGraphData 用于包装组件的 Props。直接调用底层 instance.render 时,使用 Parameters<LogicFlow['render']>[0] 保留 LogicFlow 所要求的节点类型、坐标和连线字段。

useFlow() 返回 [register, { getFlowInstance }]。若首屏要填图,可在同一 onRegister 回调里先调用 register(instance) 再 instance.render(graph)。注册之前调用 getFlowInstance() 会抛错。程序化编辑、导入和事件监听走 LogicFlow 实例;组件目前没有公开销毁方法或卸载时的显式实例清理,频繁重挂载或绑定自定义监听时,请由接入方处理对应资源释放。

组件实现 · 图和选项类型 · 实例 Hook

`,9)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default}; +})
属性默认说明
width / height'100%'容器尺寸,需要可计算的高度。
data无后续引用变化时重绘,嵌套原地修改不触发。当前挂载分支先渲染空图,首屏请在 onRegister 里主动渲染。
watchDatatrue是否监听传入数据。关闭后可从实例控制重绘。
readonlyfalse同步 LogicFlow 静默模式和节点、边文本编辑状态。
options网格开、partial: false、键盘开LogicFlow 初始化配置,包括尺寸、背景、键盘、边、交互、历史和插件等。container 由组件管理。
use无LogicFlow 全局插件列表,组件只在首次初始化时注册一次。需要实例级插件时检查 options.plugins。
onRegister(instance)无挂载后取得 LogicFlow,支持回调数组。

FlowOptions 支持的字段按用途分组:

  • 画布与布局:width、height、background、grid、partial、style、overlapMode。
  • 交互:keyboard、adjustEdge、allowRotate、allowResize、isSilentMode、stopScrollGraph、stopZoomGraph、stopMoveGraph、textEdit、textMode、edgeTextMode、nodeTextMode、guards。
  • 边和渲染:edgeType、customTrajectory、animation、history、outline、snapline。
  • 扩展:plugins、pluginsOptions、disabledPlugins、disabledTools、idGenerator、edgeGenerator。

FlowGraphData 用于包装组件的 Props。直接调用底层 instance.render 时,使用 Parameters<LogicFlow['render']>[0] 保留 LogicFlow 所要求的节点类型、坐标和连线字段。

useFlow() 返回 [register, { getFlowInstance }]。若首屏要填图,可在同一 onRegister 回调里先调用 register(instance) 再 instance.render(graph)。注册之前调用 getFlowInstance() 会抛错。程序化编辑、导入和事件监听走 LogicFlow 实例;组件目前没有公开销毁方法或卸载时的显式实例清理,频繁重挂载或绑定自定义监听时,请由接入方处理对应资源释放。

组件实现 · 图和选项类型 · 实例 Hook

`,9)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_components_flow.md.s-rnj-8X.lean.js b/docs/assets/reference_components_flow.md.bnqgmwU4.lean.js similarity index 100% rename from docs/assets/reference_components_flow.md.s-rnj-8X.lean.js rename to docs/assets/reference_components_flow.md.bnqgmwU4.lean.js diff --git a/docs/assets/reference_components_form.md.BrB2cmbN.js b/docs/assets/reference_components_form.md.DKqUuydU.js similarity index 98% rename from docs/assets/reference_components_form.md.BrB2cmbN.js rename to docs/assets/reference_components_form.md.DKqUuydU.js index 874b5e53..9cdc3188 100644 --- a/docs/assets/reference_components_form.md.BrB2cmbN.js +++ b/docs/assets/reference_components_form.md.DKqUuydU.js @@ -39,4 +39,4 @@ import{_ as i,o as a,c as t,a3 as n}from"./chunks/framework.BNdm2jZV.js";const o </RForm> ) }, -})

属性与事件 ​

除 onSubmit 外,继承 NForm 的公开属性。默认插槽传给 NForm。

属性默认说明
loadingfalse外层 Spin 状态,由调用方开关。
loadingDescription无加载说明。
autocomplete'off'挂载时写到表单 DOM。
submitWhenEnterfalse创建时启用 Enter 捕获,阻止默认行为,校验成功后调用 onFinish。
onFinish无Enter 校验完成回调。自定义提交按钮要自行调用 validate() 并执行提交。
onRegister(inst)无挂载后传出 Naive UI Form 实例。接受单函数或回调数组。

含多行输入、搜索选择器或嵌套表单时,先确认 Enter 是否应被捕获。组件没有把 Form 方法直接暴露为模板 ref。

useForm ​

useForm(model?, rules?) 返回 [register, actions],把 register 绑定给 onRegister。初始化值和规则可用对象或工厂;对象会深拷贝,工厂结果直接使用,建议每次创建新对象。

返回项行为
formConditionRef响应式模型,传给 RForm.model 并用于输入绑定。
formModel() / formRules()重新取得初始模型和规则。
getFormInstance()获取已注册实例,未注册时抛错。
validate(callback?, shouldRuleBeApplied?)透传 Naive UI 校验;失败要处理 Promise 拒绝。
validateTargetField(key)按规则对象的唯一 key 筛选规则,key 不等同于 NFormItem.path。
restoreValidation()清除当前校验状态,保留输入。
updateFormCondition(values)浅合并当前模型,不改初始值。
reset(values?)合并初始值和覆盖值,然后清除校验。动态新增字段不会被自动删除。

实例相关方法要在表单挂载并注册后调用。可空字段应在初始模型中显式声明,并为所用输入选用合适的空值。修改嵌套字段时注意更新是浅合并。

组件源码 · useForm 源码 · 表单示例

`,12)])])}const g=i(e,[["render",h]]);export{o as __pageData,g as default}; +})

属性与事件 ​

除 onSubmit 外,继承 NForm 的公开属性。默认插槽传给 NForm。

属性默认说明
loadingfalse外层 Spin 状态,由调用方开关。
loadingDescription无加载说明。
autocomplete'off'挂载时写到表单 DOM。
submitWhenEnterfalse创建时启用 Enter 捕获,阻止默认行为,校验成功后调用 onFinish。
onFinish无Enter 校验完成回调。自定义提交按钮要自行调用 validate() 并执行提交。
onRegister(inst)无挂载后传出 Naive UI Form 实例。接受单函数或回调数组。

含多行输入、搜索选择器或嵌套表单时,先确认 Enter 是否应被捕获。组件没有把 Form 方法直接暴露为模板 ref。

useForm ​

useForm(model?, rules?) 返回 [register, actions],把 register 绑定给 onRegister。初始化值和规则可用对象或工厂;对象会深拷贝,工厂结果直接使用,建议每次创建新对象。

返回项行为
formConditionRef响应式模型,传给 RForm.model 并用于输入绑定。
formModel() / formRules()重新取得初始模型和规则。
getFormInstance()获取已注册实例,未注册时抛错。
validate(callback?, shouldRuleBeApplied?)透传 Naive UI 校验;失败要处理 Promise 拒绝。
validateTargetField(key)按规则对象的唯一 key 筛选规则,key 不等同于 NFormItem.path。
restoreValidation()清除当前校验状态,保留输入。
updateFormCondition(values)浅合并当前模型,不改初始值。
reset(values?)合并初始值和覆盖值,然后清除校验。动态新增字段不会被自动删除。

实例相关方法要在表单挂载并注册后调用。可空字段应在初始模型中显式声明,并为所用输入选用合适的空值。修改嵌套字段时注意更新是浅合并。

组件源码 · useForm 源码 · 表单示例

`,12)])])}const g=i(e,[["render",h]]);export{o as __pageData,g as default}; diff --git a/docs/assets/reference_components_form.md.BrB2cmbN.lean.js b/docs/assets/reference_components_form.md.DKqUuydU.lean.js similarity index 100% rename from docs/assets/reference_components_form.md.BrB2cmbN.lean.js rename to docs/assets/reference_components_form.md.DKqUuydU.lean.js diff --git a/docs/assets/reference_components_iframe.md.CZP63QsN.lean.js b/docs/assets/reference_components_iframe.md.CZP63QsN.lean.js deleted file mode 100644 index d3d19b01..00000000 --- a/docs/assets/reference_components_iframe.md.CZP63QsN.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,o as a,c as i,a3 as t}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"RIframe","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/iframe.md","filePath":"reference/components/iframe.md"}'),d={name:"reference/components/iframe.md"};function r(n,s,o,h,p,l){return a(),i("div",null,[...s[0]||(s[0]=[t("",6)])])}const g=e(d,[["render",r]]);export{k as __pageData,g as default}; diff --git a/docs/assets/reference_components_iframe.md.CZP63QsN.js b/docs/assets/reference_components_iframe.md.Dy1_3Nzn.js similarity index 92% rename from docs/assets/reference_components_iframe.md.CZP63QsN.js rename to docs/assets/reference_components_iframe.md.Dy1_3Nzn.js index 6b02a30b..163243ba 100644 --- a/docs/assets/reference_components_iframe.md.CZP63QsN.js +++ b/docs/assets/reference_components_iframe.md.Dy1_3Nzn.js @@ -1,5 +1,5 @@ -import{_ as e,o as a,c as i,a3 as t}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"RIframe","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/iframe.md","filePath":"reference/components/iframe.md"}'),d={name:"reference/components/iframe.md"};function r(n,s,o,h,p,l){return a(),i("div",null,[...s[0]||(s[0]=[t(`

RIframe ​

RIframe 封装原生 iframe 和 Naive UI Spin。它适合嵌入允许被加载的页面,页面自身的 CSP、嵌入授权和同源策略仍生效。load 事件并不能证明业务内容加载成功。

tsx
import { RIframe } from '@/components'
+import{_ as e,o as i,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"RIframe","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/iframe.md","filePath":"reference/components/iframe.md"}'),d={name:"reference/components/iframe.md"};function r(n,s,o,h,p,c){return i(),t("div",null,[...s[0]||(s[0]=[a(`

RIframe ​

RIframe 封装原生 iframe 和 Naive UI Spin。它适合嵌入允许被加载的页面,页面自身的 CSP、嵌入授权和同源策略仍生效。load 事件并不能证明业务内容加载成功。

tsx
import { RIframe } from '@/components'
 
 export const renderReport = (url: string) => (
   <RIframe src={url} title="库存报表" height={460} lazy="eager" />
-)
属性默认说明
src必填iframe 地址。接收用户输入时应由业务限制可嵌入来源。
width / height'100%'CSS 尺寸。百分比高度依赖父级。
frameborder0模板边框样式变量。
iframeWrapperClass / iframeClass无外层容器与原生 iframe 的类名。
title / name / allow无原生 iframe 属性。title 用于辅助技术识别。
lazytrue字符串 'lazy' 或 'eager'。当前实现把布尔 true 和 false 都映射为 'lazy',主动加载请写 'eager'。
customSpinProps{}NSpin 配置,show 由组件内状态覆盖。

onSuccess(iframe, event) 和 onError 支持函数或回调数组。当前错误分支只传 event,与 Props 类型声明的双参数有差异;需要处理错误时不要假定有元素参数。首次 load / error 后关闭 Spin,当前实现不在 src 变更时重置加载状态;每次切换地址都要显示加载时可给组件不同的 key。iframeInst 是组件实际暴露的 DOM 引用。额外插槽交给 Spin,但默认内容始终为 iframe。

组件实现 · Props

`,6)])])}const g=e(d,[["render",r]]);export{k as __pageData,g as default}; +)
属性默认说明
src必填iframe 地址。接收用户输入时应由业务限制可嵌入来源。
width / height'100%'CSS 尺寸。百分比高度依赖父级。
frameborder0模板边框样式变量。
iframeWrapperClass / iframeClass无外层容器与原生 iframe 的类名。
title / name / allow无原生 iframe 属性。title 用于辅助技术识别。
lazytrue字符串 'lazy' 或 'eager'。当前实现把布尔 true 和 false 都映射为 'lazy',主动加载请写 'eager'。
customSpinProps{}NSpin 配置,show 由组件内状态覆盖。

onSuccess(iframe, event) 和 onError 支持函数或回调数组。当前错误分支只传 event,与 Props 类型声明的双参数有差异;需要处理错误时不要假定有元素参数。首次 load / error 后关闭 Spin,当前实现不在 src 变更时重置加载状态;每次切换地址都要显示加载时可给组件不同的 key。iframeInst 是组件实际暴露的 DOM 引用。额外插槽交给 Spin,但默认内容始终为 iframe。

组件实现 · Props

`,6)])])}const f=e(d,[["render",r]]);export{k as __pageData,f as default}; diff --git a/docs/assets/reference_components_iframe.md.Dy1_3Nzn.lean.js b/docs/assets/reference_components_iframe.md.Dy1_3Nzn.lean.js new file mode 100644 index 00000000..9d0a9047 --- /dev/null +++ b/docs/assets/reference_components_iframe.md.Dy1_3Nzn.lean.js @@ -0,0 +1 @@ +import{_ as e,o as i,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"RIframe","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/iframe.md","filePath":"reference/components/iframe.md"}'),d={name:"reference/components/iframe.md"};function r(n,s,o,h,p,c){return i(),t("div",null,[...s[0]||(s[0]=[a("",6)])])}const f=e(d,[["render",r]]);export{k as __pageData,f as default}; diff --git a/docs/assets/reference_components_modal.md.bQ_aJsj-.js b/docs/assets/reference_components_modal.md.DPqflFk-.js similarity index 96% rename from docs/assets/reference_components_modal.md.bQ_aJsj-.js rename to docs/assets/reference_components_modal.md.DPqflFk-.js index 7adfd9fa..c5599ce8 100644 --- a/docs/assets/reference_components_modal.md.bQ_aJsj-.js +++ b/docs/assets/reference_components_modal.md.DPqflFk-.js @@ -28,4 +28,4 @@ import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c </> ) }, -})
属性默认作用范围
width600未指定预设时的宽度。
cardWidth600preset="card" 的宽度。
dialogWidth446preset="dialog" 的宽度。
fullscreenfalse仅 card 预设生效。

宽度接受数字或 CSS 尺寸。fullscreen 让卡片占满窗口,正文在溢出时滚动;它不调用浏览器全屏。default、header、footer 等插槽依 Naive UI 预设处理,组件原样转发。

命令式弹窗 ​

@/components 的 useModal() 已弃用,兼容代码仍可通过 create(options) 和 destroyAll() 调用。create 返回 Naive UI 弹窗句柄,支持 fullscreen、width、cardWidth、dialogWidth 等兼容配置。新代码从 naive-ui 导入 useModal,在 NModalProvider 的后代调用;需要模板专用全屏样式时用声明式 RModal。提示用户确认危险操作时也可以用全局 Dialog Provider。

组件源码 · 兼容 Hook · 回归用例

`,8)])])}const E=i(e,[["render",l]]);export{c as __pageData,E as default}; +})
属性默认作用范围
width600未指定预设时的宽度。
cardWidth600preset="card" 的宽度。
dialogWidth446preset="dialog" 的宽度。
fullscreenfalse仅 card 预设生效。

宽度接受数字或 CSS 尺寸。fullscreen 让卡片占满窗口,正文在溢出时滚动;它不调用浏览器全屏。default、header、footer 等插槽依 Naive UI 预设处理,组件原样转发。

命令式弹窗 ​

@/components 的 useModal() 已弃用,兼容代码仍可通过 create(options) 和 destroyAll() 调用。create 返回 Naive UI 弹窗句柄,支持 fullscreen、width、cardWidth、dialogWidth 等兼容配置。新代码从 naive-ui 导入 useModal,在 NModalProvider 的后代调用;需要模板专用全屏样式时用声明式 RModal。提示用户确认危险操作时也可以用全局 Dialog Provider。

组件源码 · 兼容 Hook · 回归用例

`,8)])])}const E=i(e,[["render",l]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_components_modal.md.bQ_aJsj-.lean.js b/docs/assets/reference_components_modal.md.DPqflFk-.lean.js similarity index 100% rename from docs/assets/reference_components_modal.md.bQ_aJsj-.lean.js rename to docs/assets/reference_components_modal.md.DPqflFk-.lean.js diff --git a/docs/assets/reference_components_more-dropdown.md.BubiDbuv.js b/docs/assets/reference_components_more-dropdown.md.P5PZdsXi.js similarity index 95% rename from docs/assets/reference_components_more-dropdown.md.BubiDbuv.js rename to docs/assets/reference_components_more-dropdown.md.P5PZdsXi.js index 1fcde072..6799fa0c 100644 --- a/docs/assets/reference_components_more-dropdown.md.BubiDbuv.js +++ b/docs/assets/reference_components_more-dropdown.md.P5PZdsXi.js @@ -1,4 +1,4 @@ -import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"RMoreDropdown","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/more-dropdown.md","filePath":"reference/components/more-dropdown.md"}'),e={name:"reference/components/more-dropdown.md"};function h(p,s,k,l,d,r){return a(),n("div",null,[...s[0]||(s[0]=[t(`

RMoreDropdown ​

包装 NDropdown,为行操作提供默认的更多图标。options、trigger、placement、onSelect(key, option)、受控显隐等沿用 Naive UI Dropdown。

属性默认说明
icon'action/more'类型为 IconName,使用完整分包路径。
iconSize14默认触发图标大小。
cursor'default'默认图标指针样式。

default 插槽替换图标触发器。只有图标时建议用具有可访问名称的原生按钮或 NButton,方便键盘进入。列表行中根据业务需要阻止触发器的点击冒泡,避免同时触发行导航。

tsx
import { RIcon, RMoreDropdown } from '@/components'
+import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"RMoreDropdown","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/more-dropdown.md","filePath":"reference/components/more-dropdown.md"}'),e={name:"reference/components/more-dropdown.md"};function h(p,s,k,l,r,d){return a(),n("div",null,[...s[0]||(s[0]=[t(`

RMoreDropdown ​

包装 NDropdown,为行操作提供默认的更多图标。options、trigger、placement、onSelect(key, option)、受控显隐等沿用 Naive UI Dropdown。

属性默认说明
icon'action/more'类型为 IconName,使用完整分包路径。
iconSize14默认触发图标大小。
cursor'default'默认图标指针样式。

default 插槽替换图标触发器。只有图标时建议用具有可访问名称的原生按钮或 NButton,方便键盘进入。列表行中根据业务需要阻止触发器的点击冒泡,避免同时触发行导航。

tsx
import { RIcon, RMoreDropdown } from '@/components'
 import { NButton } from 'naive-ui'
 
 export const renderRowActions = (edit: () => void) => (
@@ -18,4 +18,4 @@ import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E
       <RIcon name="action/more" />
     </NButton>
   </RMoreDropdown>
-)

组件实现 · Props

`,6)])])}const g=i(e,[["render",h]]);export{E as __pageData,g as default}; +)

组件实现 · Props

`,6)])])}const c=i(e,[["render",h]]);export{E as __pageData,c as default}; diff --git a/docs/assets/reference_components_more-dropdown.md.BubiDbuv.lean.js b/docs/assets/reference_components_more-dropdown.md.P5PZdsXi.lean.js similarity index 68% rename from docs/assets/reference_components_more-dropdown.md.BubiDbuv.lean.js rename to docs/assets/reference_components_more-dropdown.md.P5PZdsXi.lean.js index 1739156e..2677f109 100644 --- a/docs/assets/reference_components_more-dropdown.md.BubiDbuv.lean.js +++ b/docs/assets/reference_components_more-dropdown.md.P5PZdsXi.lean.js @@ -1 +1 @@ -import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"RMoreDropdown","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/more-dropdown.md","filePath":"reference/components/more-dropdown.md"}'),e={name:"reference/components/more-dropdown.md"};function h(p,s,k,l,d,r){return a(),n("div",null,[...s[0]||(s[0]=[t("",6)])])}const g=i(e,[["render",h]]);export{E as __pageData,g as default}; +import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"RMoreDropdown","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/more-dropdown.md","filePath":"reference/components/more-dropdown.md"}'),e={name:"reference/components/more-dropdown.md"};function h(p,s,k,l,r,d){return a(),n("div",null,[...s[0]||(s[0]=[t("",6)])])}const c=i(e,[["render",h]]);export{E as __pageData,c as default}; diff --git a/docs/assets/reference_components_qr-code.md.BtXSFJtd.js b/docs/assets/reference_components_qr-code.md.CjRPLYOy.js similarity index 96% rename from docs/assets/reference_components_qr-code.md.BtXSFJtd.js rename to docs/assets/reference_components_qr-code.md.CjRPLYOy.js index 2c0cce57..136182e6 100644 --- a/docs/assets/reference_components_qr-code.md.BtXSFJtd.js +++ b/docs/assets/reference_components_qr-code.md.CjRPLYOy.js @@ -1,4 +1,4 @@ -import{_ as i,o as a,c as n,a3 as e}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"二维码","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/qr-code.md","filePath":"reference/components/qr-code.md"}'),t={name:"reference/components/qr-code.md"};function p(l,s,h,k,d,r){return a(),n("div",null,[...s[0]||(s[0]=[e(`

二维码 ​

Ray Template 直接使用 vue3-next-qrcode 的 Vue3NextQrcode,公开实例类型为 QRCodeInst。组件演示和登录扫码占位页分别使用它。

tsx
import { NButton } from 'naive-ui'
+import{_ as i,o as a,c as n,a3 as e}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"二维码","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/qr-code.md","filePath":"reference/components/qr-code.md"}'),t={name:"reference/components/qr-code.md"};function p(l,s,h,k,d,r){return a(),n("div",null,[...s[0]||(s[0]=[e(`

二维码 ​

Ray Template 直接使用 vue3-next-qrcode 的 Vue3NextQrcode,公开实例类型为 QRCodeInst。组件演示和登录扫码占位页分别使用它。

tsx
import { NButton } from 'naive-ui'
 import { defineComponent, ref } from 'vue'
 import { Vue3NextQrcode, type QRCodeInst } from 'vue3-next-qrcode'
 
@@ -12,4 +12,4 @@ import{_ as i,o as a,c as n,a3 as e}from"./chunks/framework.BNdm2jZV.js";const E
       </>
     )
   },
-})

text 设置内容,默认可随内容变化重绘。logoImage、backgroundImage、gifBackgroundURL、dotScale、colorDark 可调整样式。带背景的二维码要实际扫码检查清晰度,远程素材还受跨域和浏览器加载限制。

status 可显示 loading、error 等状态,onReload 在重试时通知调用方。downloadQRCode() 等到实例挂载后调用。二维码只表达数据,生成成功与扫码认证成功是两回事;登录需要业务后端签发和验证对应凭据。

二维码示例 · 登录页扫码入口

`,6)])])}const c=i(t,[["render",p]]);export{E as __pageData,c as default}; +})

text 设置内容,默认可随内容变化重绘。logoImage、backgroundImage、gifBackgroundURL、dotScale、colorDark 可调整样式。带背景的二维码要实际扫码检查清晰度,远程素材还受跨域和浏览器加载限制。

status 可显示 loading、error 等状态,onReload 在重试时通知调用方。downloadQRCode() 等到实例挂载后调用。二维码只表达数据,生成成功与扫码认证成功是两回事;登录需要业务后端签发和验证对应凭据。

二维码示例 · 登录页扫码入口

`,6)])])}const E=i(t,[["render",p]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_components_qr-code.md.BtXSFJtd.lean.js b/docs/assets/reference_components_qr-code.md.CjRPLYOy.lean.js similarity index 72% rename from docs/assets/reference_components_qr-code.md.BtXSFJtd.lean.js rename to docs/assets/reference_components_qr-code.md.CjRPLYOy.lean.js index 4b0f87b5..217ab8e1 100644 --- a/docs/assets/reference_components_qr-code.md.BtXSFJtd.lean.js +++ b/docs/assets/reference_components_qr-code.md.CjRPLYOy.lean.js @@ -1 +1 @@ -import{_ as i,o as a,c as n,a3 as e}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"二维码","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/qr-code.md","filePath":"reference/components/qr-code.md"}'),t={name:"reference/components/qr-code.md"};function p(l,s,h,k,d,r){return a(),n("div",null,[...s[0]||(s[0]=[e("",6)])])}const c=i(t,[["render",p]]);export{E as __pageData,c as default}; +import{_ as i,o as a,c as n,a3 as e}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"二维码","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/qr-code.md","filePath":"reference/components/qr-code.md"}'),t={name:"reference/components/qr-code.md"};function p(l,s,h,k,d,r){return a(),n("div",null,[...s[0]||(s[0]=[e("",6)])])}const E=i(t,[["render",p]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_components_route-transition.md.Dg7dX5PR.js b/docs/assets/reference_components_route-transition.md.DhUbCAYx.js similarity index 97% rename from docs/assets/reference_components_route-transition.md.Dg7dX5PR.js rename to docs/assets/reference_components_route-transition.md.DhUbCAYx.js index 12ea4fe7..756e4107 100644 --- a/docs/assets/reference_components_route-transition.md.Dg7dX5PR.js +++ b/docs/assets/reference_components_route-transition.md.DhUbCAYx.js @@ -2,4 +2,4 @@ import{_ as i,o as s,c as e,a3 as a}from"./chunks/framework.BNdm2jZV.js";const c export const renderPageOutlet = () => ( <RTransitionComponent transitionPropName="fade" transitionAppear={false} /> -)

组件源码 · 缓存 Store · 路由缓存排查

`,6)])])}const g=i(n,[["render",o]]);export{c as __pageData,g as default}; +)

组件源码 · 缓存 Store · 路由缓存排查

`,6)])])}const g=i(n,[["render",o]]);export{c as __pageData,g as default}; diff --git a/docs/assets/reference_components_route-transition.md.Dg7dX5PR.lean.js b/docs/assets/reference_components_route-transition.md.DhUbCAYx.lean.js similarity index 100% rename from docs/assets/reference_components_route-transition.md.Dg7dX5PR.lean.js rename to docs/assets/reference_components_route-transition.md.DhUbCAYx.lean.js diff --git a/docs/assets/reference_components_segment.md.BrQOf2XY.js b/docs/assets/reference_components_segment.md.ClmNr5bX.js similarity index 95% rename from docs/assets/reference_components_segment.md.BrQOf2XY.js rename to docs/assets/reference_components_segment.md.ClmNr5bX.js index 045b7d4b..290761a0 100644 --- a/docs/assets/reference_components_segment.md.BrQOf2XY.js +++ b/docs/assets/reference_components_segment.md.ClmNr5bX.js @@ -18,4 +18,4 @@ import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const o /> ) }, -})

组件实现 · 选项类型 · 不支持的 Tabs 属性

`,6)])])}const c=i(n,[["render",l]]);export{o as __pageData,c as default}; +})

组件实现 · 选项类型 · 不支持的 Tabs 属性

`,6)])])}const c=i(n,[["render",l]]);export{o as __pageData,c as default}; diff --git a/docs/assets/reference_components_segment.md.BrQOf2XY.lean.js b/docs/assets/reference_components_segment.md.ClmNr5bX.lean.js similarity index 100% rename from docs/assets/reference_components_segment.md.BrQOf2XY.lean.js rename to docs/assets/reference_components_segment.md.ClmNr5bX.lean.js diff --git a/docs/assets/reference_configuration.md.B-ScBw16.js b/docs/assets/reference_configuration.md.B-ScBw16.js new file mode 100644 index 00000000..d7d9f924 --- /dev/null +++ b/docs/assets/reference_configuration.md.B-ScBw16.js @@ -0,0 +1 @@ +import{_ as o,o as t,c as d,a3 as c}from"./chunks/framework.BNdm2jZV.js";const l=JSON.parse('{"title":"应用配置","description":"","frontmatter":{},"headers":[],"relativePath":"reference/configuration.md","filePath":"reference/configuration.md"}'),a={name:"reference/configuration.md"};function r(i,e,n,s,_,p){return t(),d("div",null,[...e[0]||(e[0]=[c('

应用配置 ​

应用配置与站外文档配置分属两个仓库。这里说明 Ray Template 应用中的 @/app-config、Vite 配置和运行期设置。运行期保存的用户偏好可能覆盖源码默认值,验证默认设置时使用干净的浏览器存储。

文件配置
apps/admin/src/app-config/app-config.tsGLOBAL_CLASS_NAMES(明暗类与 CSS 变量)、MESSAGE_PROVIDER(上下文消息,默认最多 5 条、不可关闭)、LAYOUT_CONTENT_SPIN_WHEN_ROUTE_CHANGE(默认关)、APP_GLOBAL_LOADING、PRE_LOADING_CONFIG、APP_CATCH_KEY / APP_CATCH_KEY_PREFIX、CONTENT_TRANSITION_OPTIONS。
apps/admin/src/app-config/design-config.tsAPP_THEME 的候选色、默认蓝 #3b63d9、Naive UI 明暗覆盖、ECharts 默认主题。
apps/admin/src/app-config/local-config.tsLOCAL_OPTIONS、SYSTEM_DEFAULT_LOCAL、SYSTEM_FALLBACK_LOCALE、DAYJS_LOCAL_MAP、DEFAULT_DAYJS_LOCAL。默认与回退语言为 zh-CN。
apps/admin/src/app-config/request-config.tsAXIOS_CONFIG。默认同源相对地址、5 秒超时、withCredentials: false、JSON Content-Type。
apps/admin/src/app-config/router-config.tsSETUP_ROUTER_ACTION(加载条与守卫默认开)、WHITE_ROUTES(路由名白名单)、SUPER_ADMIN(默认空)、LAYOUT_CONTENT_REF / LAYOUT_SIDER_REF。
apps/admin/src/app-config/regex-config.tsAPP_REGEX,模板 CSS 尺寸规则。
vite.custom.config.tsbase、server、buildOptions(mode)、alias、cdn、copyright、Sass 注入和首屏加载配置。

选择改动入口 ​

  • 修改默认用户偏好(布局、菜单、标签、缓存)时看 Setting Store 与 apps/admin/src/store/modules/setting/constant.ts。已有用户可在应用设置里恢复默认后检查效果。
  • 修改主题或语言时看主题和国际化。新增语言同时维护翻译资源与 Day.js、Naive UI 对应关系。
  • 修改访问控制时看路由指南。白名单按区分大小写的字符串路由名判断,守卫先处理 token,再按白名单和角色处理导航。
  • 修改 API 地址、认证头和失败策略时看接口与 Mock。应用不会自动把任意 VITE_* 环境变量绑定到 Axios;需在配置中明确读取。
  • 应用默认部署子路径 /ray-template/。部署子路径改变后重新构建并验证图标、代理和直达链接,见工程与部署。

__APP_CFG__ 由 Vite 在构建时注入,用于应用包信息、版权与默认主色。任何注入到客户端的字段都可被浏览器读取。用于页面交互的运行态偏好走 Store,构建参数留在 Vite 配置。

应用配置源码 · Vite 自定义配置

',7)])])}const A=o(a,[["render",r]]);export{l as __pageData,A as default}; diff --git a/docs/assets/reference_configuration.md.B-ScBw16.lean.js b/docs/assets/reference_configuration.md.B-ScBw16.lean.js new file mode 100644 index 00000000..b3cedb9a --- /dev/null +++ b/docs/assets/reference_configuration.md.B-ScBw16.lean.js @@ -0,0 +1 @@ +import{_ as o,o as t,c as d,a3 as c}from"./chunks/framework.BNdm2jZV.js";const l=JSON.parse('{"title":"应用配置","description":"","frontmatter":{},"headers":[],"relativePath":"reference/configuration.md","filePath":"reference/configuration.md"}'),a={name:"reference/configuration.md"};function r(i,e,n,s,_,p){return t(),d("div",null,[...e[0]||(e[0]=[c("",7)])])}const A=o(a,[["render",r]]);export{l as __pageData,A as default}; diff --git a/docs/assets/reference_configuration.md.BeYwV4AY.js b/docs/assets/reference_configuration.md.BeYwV4AY.js deleted file mode 100644 index 4f5e3e35..00000000 --- a/docs/assets/reference_configuration.md.BeYwV4AY.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as d,o,c as t,a3 as c}from"./chunks/framework.BNdm2jZV.js";const f=JSON.parse('{"title":"应用配置","description":"","frontmatter":{},"headers":[],"relativePath":"reference/configuration.md","filePath":"reference/configuration.md"}'),a={name:"reference/configuration.md"};function r(i,e,n,s,_,p){return o(),t("div",null,[...e[0]||(e[0]=[c('

应用配置 ​

应用配置与站外文档配置分属两个仓库。这里说明 Ray Template 应用中的 @/app-config、Vite 配置和运行期设置。运行期保存的用户偏好可能覆盖源码默认值,验证默认设置时使用干净的浏览器存储。

文件配置
apps/admin/src/app-config/app-config.tsGLOBAL_CLASS_NAMES(明暗类与 CSS 变量)、MESSAGE_PROVIDER(上下文消息,默认最多 5 条、不可关闭)、LAYOUT_CONTENT_SPIN_WHEN_ROUTE_CHANGE(默认关)、APP_GLOBAL_LOADING、PRE_LOADING_CONFIG、APP_CATCH_KEY / APP_CATCH_KEY_PREFIX、CONTENT_TRANSITION_OPTIONS。
apps/admin/src/app-config/design-config.tsAPP_THEME 的候选色、默认蓝 #3b63d9、Naive UI 明暗覆盖、ECharts 默认主题。
apps/admin/src/app-config/local-config.tsLOCAL_OPTIONS、SYSTEM_DEFAULT_LOCAL、SYSTEM_FALLBACK_LOCALE、DAYJS_LOCAL_MAP、DEFAULT_DAYJS_LOCAL。默认与回退语言为 zh-CN。
apps/admin/src/app-config/request-config.tsAXIOS_CONFIG。默认同源相对地址、5 秒超时、withCredentials: false、JSON Content-Type。
apps/admin/src/app-config/router-config.tsSETUP_ROUTER_ACTION(加载条与守卫默认开)、WHITE_ROUTES(路由名白名单)、SUPER_ADMIN(默认空)、LAYOUT_CONTENT_REF / LAYOUT_SIDER_REF。
apps/admin/src/app-config/regex-config.tsAPP_REGEX,模板 CSS 尺寸规则。
vite.custom.config.tsbase、server、buildOptions(mode)、alias、cdn、copyright、Sass 注入和首屏加载配置。

选择改动入口 ​

  • 修改默认用户偏好(布局、菜单、标签、缓存)时看 Setting Store 与 apps/admin/src/store/modules/setting/constant.ts。已有用户可在应用设置里恢复默认后检查效果。
  • 修改主题或语言时看主题和国际化。新增语言同时维护翻译资源与 Day.js、Naive UI 对应关系。
  • 修改访问控制时看路由指南。白名单按区分大小写的字符串路由名判断,守卫先处理 token,再按白名单和角色处理导航。
  • 修改 API 地址、认证头和失败策略时看接口与 Mock。应用不会自动把任意 VITE_* 环境变量绑定到 Axios;需在配置中明确读取。
  • 应用默认部署子路径 /ray-template/。部署子路径改变后重新构建并验证图标、代理和直达链接,见工程与部署。

__APP_CFG__ 由 Vite 在构建时注入,用于应用包信息、版权与默认主色。任何注入到客户端的字段都可被浏览器读取。用于页面交互的运行态偏好走 Store,构建参数留在 Vite 配置。

应用配置源码 · Vite 自定义配置

',7)])])}const A=d(a,[["render",r]]);export{f as __pageData,A as default}; diff --git a/docs/assets/reference_configuration.md.BeYwV4AY.lean.js b/docs/assets/reference_configuration.md.BeYwV4AY.lean.js deleted file mode 100644 index 55e3db2f..00000000 --- a/docs/assets/reference_configuration.md.BeYwV4AY.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as d,o,c as t,a3 as c}from"./chunks/framework.BNdm2jZV.js";const f=JSON.parse('{"title":"应用配置","description":"","frontmatter":{},"headers":[],"relativePath":"reference/configuration.md","filePath":"reference/configuration.md"}'),a={name:"reference/configuration.md"};function r(i,e,n,s,_,p){return o(),t("div",null,[...e[0]||(e[0]=[c("",7)])])}const A=d(a,[["render",r]]);export{f as __pageData,A as default}; diff --git a/docs/assets/reference_directives.md.DZcDGixq.js b/docs/assets/reference_directives.md.B7ge4Qql.js similarity index 93% rename from docs/assets/reference_directives.md.DZcDGixq.js rename to docs/assets/reference_directives.md.B7ge4Qql.js index be7778a3..e0639b09 100644 --- a/docs/assets/reference_directives.md.DZcDGixq.js +++ b/docs/assets/reference_directives.md.B7ge4Qql.js @@ -1,6 +1,6 @@ -import{u as R}from"./chunks/index.CRUCD9CF.js";import{i as b,r as N}from"./chunks/Loading.CYk0ZDH9.js";import{i as P}from"./chunks/isSymbol.BJY0fdHu.js";import{B as V}from"./chunks/Button.B5dXaugh.js";import{d as W,o as f,c as x,a5 as M,k as B,b as X,w as G,a as L,j as O,t as H,p as U,a3 as A,E as $}from"./chunks/framework.BNdm2jZV.js";var j=/\s/;function K(s){for(var i=s.length;i--&&j.test(s.charAt(i)););return i}var J=/^\s+/;function z(s){return s&&s.slice(0,K(s)+1).replace(J,"")}var _=NaN,Q=/^[-+]0x[0-9a-f]+$/i,Y=/^0b[01]+$/i,Z=/^0o[0-7]+$/i,ss=parseInt;function q(s){if(typeof s=="number")return s;if(P(s))return _;if(b(s)){var i=typeof s.valueOf=="function"?s.valueOf():s;s=b(i)?i+"":i}if(typeof s!="string")return s===0?s:+s;s=z(s);var a=Y.test(s);return a||Z.test(s)?ss(s.slice(2),a?2:8):Q.test(s)?_:+s}var F=function(){return N.Date.now()},is="Expected a function",as=Math.max,ts=Math.min;function ns(s,i,a){var e,p,l,k,n,h,d=0,m=!1,E=!1,c=!0;if(typeof s!="function")throw new TypeError(is);i=q(i)||0,b(a)&&(m=!!a.leading,E="maxWait"in a,l=E?as(q(a.maxWait)||0,i):l,c="trailing"in a?!!a.trailing:c);function y(t){var r=e,o=p;return e=p=void 0,d=t,k=s.apply(o,r),k}function T(t){return d=t,n=setTimeout(g,i),m?y(t):k}function w(t){var r=t-h,o=t-d,D=i-r;return E?ts(D,l-o):D}function v(t){var r=t-h,o=t-d;return h===void 0||r>=i||r<0||E&&o>=l}function g(){var t=F();if(v(t))return C(t);n=setTimeout(g,w(t))}function C(t){return n=void 0,c&&e?y(t):(e=p=void 0,k)}function S(){n!==void 0&&clearTimeout(n),d=0,e=h=p=n=void 0}function I(){return n===void 0?k:C(F())}function u(){var t=F(),r=v(t);if(e=arguments,p=this,h=t,r){if(n===void 0)return T(h);if(E)return clearTimeout(n),n=setTimeout(g,i),y(h)}return n===void 0&&(n=setTimeout(g,i)),k}return u.cancel=S,u.flush=I,u}const es=()=>{const s=new WeakMap;return{beforeMount:(i,{value:a})=>{const{func:e,trigger:p="click",wait:l=500,options:k}=a;if(typeof e!="function")throw new TypeError("debounce directive value must be a function");const n=ns(e,l,k),h=R(i,p,n);s.set(i,()=>{n.cancel(),h()})},beforeUnmount(i){var a;(a=s.get(i))==null||a(),s.delete(i)}}},ls={class:"ray-demo"},hs={class:"ray-demo-result"},ps=W({__name:"DebounceDemo",setup(s){const i=es(),a=U(0),e=()=>{a.value+=1};return(p,l)=>(f(),x("div",ls,[M((f(),X(B(V),null,{default:G(()=>[...l[0]||(l[0]=[L(" 连续点击 / Click repeatedly ",-1)])]),_:1})),[[B(i),{wait:500,func:e}]]),O("output",hs,"执行次数 / Calls: "+H(a.value),1)]))}}),cs=JSON.parse('{"title":"指令","description":"","frontmatter":{},"headers":[],"relativePath":"reference/directives.md","filePath":"reference/directives.md"}'),ks={name:"reference/directives.md"},ys=Object.assign(ks,{setup(s){return(i,a)=>(f(),x("div",null,[a[0]||(a[0]=A(`

指令 ​

应用在 main.ts 调用 setupDirectives(app)。注册器查找 packages/directives/src/modules/<name>/index.ts,调用默认导出的工厂,将返回的 Vue Directive 以目录名注册。SFC 中可直接用 v-<name>;从文件名和源码进入可查各指令的绑定类型。

v-copy ​

绑定要复制的字符串;绑定值改变时销毁并重建 ClipboardJS 实例,卸载时销毁。Ray Admin 注册时接入消息提示。独立使用 createCopyDirective 时可提供自己的结果回调。复制应由用户点击触发。数字等值请先显式转为字符串。

vue
<template>
+import{u as R}from"./chunks/index.CRUCD9CF.js";import{i as f,r as N}from"./chunks/Loading.CYk0ZDH9.js";import{i as P}from"./chunks/isSymbol.BJY0fdHu.js";import{B as V}from"./chunks/Button.B5dXaugh.js";import{d as W,o as m,c as x,a5 as M,k as B,b as X,w as G,a as L,j as O,t as H,p as U,a3 as A,E as $}from"./chunks/framework.BNdm2jZV.js";var j=/\s/;function K(s){for(var i=s.length;i--&&j.test(s.charAt(i)););return i}var J=/^\s+/;function z(s){return s&&s.slice(0,K(s)+1).replace(J,"")}var _=NaN,Q=/^[-+]0x[0-9a-f]+$/i,Y=/^0b[01]+$/i,Z=/^0o[0-7]+$/i,ss=parseInt;function q(s){if(typeof s=="number")return s;if(P(s))return _;if(f(s)){var i=typeof s.valueOf=="function"?s.valueOf():s;s=f(i)?i+"":i}if(typeof s!="string")return s===0?s:+s;s=z(s);var a=Y.test(s);return a||Z.test(s)?ss(s.slice(2),a?2:8):Q.test(s)?_:+s}var F=function(){return N.Date.now()},is="Expected a function",as=Math.max,ts=Math.min;function ns(s,i,a){var e,p,l,k,n,h,d=0,v=!1,E=!1,g=!0;if(typeof s!="function")throw new TypeError(is);i=q(i)||0,f(a)&&(v=!!a.leading,E="maxWait"in a,l=E?as(q(a.maxWait)||0,i):l,g="trailing"in a?!!a.trailing:g);function y(t){var r=e,c=p;return e=p=void 0,d=t,k=s.apply(c,r),k}function T(t){return d=t,n=setTimeout(o,i),v?y(t):k}function w(t){var r=t-h,c=t-d,D=i-r;return E?ts(D,l-c):D}function b(t){var r=t-h,c=t-d;return h===void 0||r>=i||r<0||E&&c>=l}function o(){var t=F();if(b(t))return C(t);n=setTimeout(o,w(t))}function C(t){return n=void 0,g&&e?y(t):(e=p=void 0,k)}function S(){n!==void 0&&clearTimeout(n),d=0,e=h=p=n=void 0}function I(){return n===void 0?k:C(F())}function u(){var t=F(),r=b(t);if(e=arguments,p=this,h=t,r){if(n===void 0)return T(h);if(E)return clearTimeout(n),n=setTimeout(o,i),y(h)}return n===void 0&&(n=setTimeout(o,i)),k}return u.cancel=S,u.flush=I,u}const es=()=>{const s=new WeakMap;return{beforeMount:(i,{value:a})=>{const{func:e,trigger:p="click",wait:l=500,options:k}=a;if(typeof e!="function")throw new TypeError("debounce directive value must be a function");const n=ns(e,l,k),h=R(i,p,n);s.set(i,()=>{n.cancel(),h()})},beforeUnmount(i){var a;(a=s.get(i))==null||a(),s.delete(i)}}},ls={class:"ray-demo"},hs={class:"ray-demo-result"},ps=W({__name:"DebounceDemo",setup(s){const i=es(),a=U(0),e=()=>{a.value+=1};return(p,l)=>(m(),x("div",ls,[M((m(),X(B(V),null,{default:G(()=>[...l[0]||(l[0]=[L(" 连续点击 / Click repeatedly ",-1)])]),_:1})),[[B(i),{wait:500,func:e}]]),O("output",hs,"执行次数 / Calls: "+H(a.value),1)]))}}),gs=JSON.parse('{"title":"指令","description":"","frontmatter":{},"headers":[],"relativePath":"reference/directives.md","filePath":"reference/directives.md"}'),ks={name:"reference/directives.md"},ys=Object.assign(ks,{setup(s){return(i,a)=>(m(),x("div",null,[a[0]||(a[0]=A(`

指令 ​

应用在 main.ts 调用 setupDirectives(app)。注册器查找 packages/directives/src/modules/<name>/index.ts,调用默认导出的工厂,将返回的 Vue Directive 以目录名注册。SFC 中可直接用 v-<name>;从文件名和源码进入可查各指令的绑定类型。

v-copy ​

绑定要复制的字符串;绑定值改变时销毁并重建 ClipboardJS 实例,卸载时销毁。Ray Admin 注册时接入消息提示。独立使用 createCopyDirective 时可提供自己的结果回调。复制应由用户点击触发。数字等值请先显式转为字符串。

vue
<template>
   <button type="button" v-copy="'ORD-001'">复制订单号</button>
-</template>

源码

v-debounce 与 v-throttle ​

连续点击按钮,停止 500ms 后,防抖只执行一次。

`,8)),$(ps),a[1]||(a[1]=A(`
查看示例源码
vue
<template>
+</template>

源码

v-debounce 与 v-throttle ​

连续点击按钮,停止 500ms 后,防抖只执行一次。

`,8)),$(ps),a[1]||(a[1]=A(`
查看示例源码
vue
<template>
   <div class="ray-demo">
     <NButton v-debounce="{ wait: 500, func: increment }">
       连续点击 / Click repeatedly
@@ -43,13 +43,13 @@ import{u as R}from"./chunks/index.CRUCD9CF.js";import{i as b,r as N}from"./chunk
   <button type="button" v-throttle="{ func: countClick, wait: 1000 }">
     点击次数 {{ clicks }}
   </button>
-</template>
  • options.leading / trailing 决定在等待周期首尾是否执行;防抖还可设 maxWait。挂载时读取绑定值,更新不会重绑。若回调依赖变动数据,让原函数在执行时读取响应式值。
  • 当前实现将监听器句柄保存在指令工厂闭包,多个绑定实例共用同一清理位置。需要同一指令同时绑多个元素或动态修改间隔时,在组件里单独创建防抖或节流函数并清理。
  • 防抖和节流只约束事件触发,异步请求仍需独立处理取消、并发或幂等。

防抖源码 · 节流源码

v-ellipsis ​

width 必填,数字按像素;字符串可传 CSS 尺寸。type: 'block' 做单行省略,type: 'line' 使用 line 行截断,默认按单行处理。popoverText: true 把当前文本写入原生 title,不创建 Popover。挂载和更新时写入样式;切换模式或关掉悬浮文本不会自动删除上一次写入的样式或 title。经常切换的场景可以改用组件库的省略组件,或切换节点 key。

vue
<template>
+</template>
  • options.leading / trailing 决定在等待周期首尾是否执行;防抖还可设 maxWait。挂载时读取绑定值,更新不会重绑。若回调依赖变动数据,让原函数在执行时读取响应式值。
  • 当前实现将监听器句柄保存在指令工厂闭包,多个绑定实例共用同一清理位置。需要同一指令同时绑多个元素或动态修改间隔时,在组件里单独创建防抖或节流函数并清理。
  • 防抖和节流只约束事件触发,异步请求仍需独立处理取消、并发或幂等。

防抖源码 · 节流源码

v-ellipsis ​

width 必填,数字按像素;字符串可传 CSS 尺寸。type: 'block' 做单行省略,type: 'line' 使用 line 行截断,默认按单行处理。popoverText: true 把当前文本写入原生 title,不创建 Popover。挂载和更新时写入样式;切换模式或关掉悬浮文本不会自动删除上一次写入的样式或 title。经常切换的场景可以改用组件库的省略组件,或切换节点 key。

vue
<template>
   <p v-ellipsis="{ type: 'line', line: 2, width: 240, popoverText: true }">
     这里放较长的说明文字,超出两行后会被省略。
   </p>
-</template>

源码

v-ripple ​

省略绑定值或传 true 启用,false 关闭。绑定对象 { class: '...' } 可指定波纹样式。.center 从中心扩散,.circle 使用圆形计算。通过 pointer 事件渲染,属于视觉反馈,交互语义仍由外层按钮负责。

vue
<template>
+</template>

源码

v-ripple ​

省略绑定值或传 true 启用,false 关闭。绑定对象 { class: '...' } 可指定波纹样式。.center 从中心扩散,.circle 使用圆形计算。通过 pointer 事件渲染,属于视觉反馈,交互语义仍由外层按钮负责。

vue
<template>
   <button type="button" v-ripple.center.circle>查看详情</button>
-</template>

源码 · 绑定与清理

v-disabled ​

接收布尔值并修改原生 disabled 属性和模板禁用样式。当前实现关闭禁用时仍会写入空的 disabled 属性,HTML 原生按钮将继续视为禁用。因此原生控件使用 :disabled="busy",Naive UI 使用对应 disabled prop。对自定义控件,要同时处理指针、键盘与可访问状态;样式不能取代业务权限检查。

源码

新增指令 ​

每个指令放在单独目录,工厂默认导出。可用 CustomDirectiveFC<HTMLElement, T> 标注绑定值。在 mounted 取得元素,在 updated 处理值更新,在 beforeUnmount 释放事件、计时器和第三方实例。多个元素需要独立数据时,把状态放在元素关联的 WeakMap,避免用单个变量保存全部实例的资源。

ts
import type { CustomDirectiveFC } from '@/directives/types'
+</template>

源码 · 绑定与清理

v-disabled ​

接收布尔值并修改原生 disabled 属性和模板禁用样式。当前实现关闭禁用时仍会写入空的 disabled 属性,HTML 原生按钮将继续视为禁用。因此原生控件使用 :disabled="busy",Naive UI 使用对应 disabled prop。对自定义控件,要同时处理指针、键盘与可访问状态;样式不能取代业务权限检查。

源码

新增指令 ​

每个指令放在单独目录,工厂默认导出。可用 CustomDirectiveFC<HTMLElement, T> 标注绑定值。在 mounted 取得元素,在 updated 处理值更新,在 beforeUnmount 释放事件、计时器和第三方实例。多个元素需要独立数据时,把状态放在元素关联的 WeakMap,避免用单个变量保存全部实例的资源。

ts
import type { CustomDirectiveFC } from '@/directives/types'
 
 const focusWhen: CustomDirectiveFC<HTMLElement, boolean> = () => ({
   mounted(el, { value }) {
@@ -60,4 +60,4 @@ import{u as R}from"./chunks/index.CRUCD9CF.js";import{i as b,r as N}from"./chunk
   },
 })
 
-export default focusWhen

将示例保存为 packages/directives/src/modules/focus-when/index.ts,在组件中用 v-focus-when。目录名按现有约定用单段小写 kebab-case。注册器要求默认导出函数,缺失会抛错。

注册入口 · 指令类型

`,21))]))}});export{cs as __pageData,ys as default}; +export default focusWhen

将示例保存为 packages/directives/src/modules/focus-when/index.ts,在组件中用 v-focus-when。目录名按现有约定用单段小写 kebab-case。注册器要求默认导出函数,缺失会抛错。

注册入口 · 指令类型

`,21))]))}});export{gs as __pageData,ys as default}; diff --git a/docs/assets/reference_directives.md.DZcDGixq.lean.js b/docs/assets/reference_directives.md.B7ge4Qql.lean.js similarity index 54% rename from docs/assets/reference_directives.md.DZcDGixq.lean.js rename to docs/assets/reference_directives.md.B7ge4Qql.lean.js index b2fb0275..a059a455 100644 --- a/docs/assets/reference_directives.md.DZcDGixq.lean.js +++ b/docs/assets/reference_directives.md.B7ge4Qql.lean.js @@ -1 +1 @@ -import{u as R}from"./chunks/index.CRUCD9CF.js";import{i as b,r as N}from"./chunks/Loading.CYk0ZDH9.js";import{i as P}from"./chunks/isSymbol.BJY0fdHu.js";import{B as V}from"./chunks/Button.B5dXaugh.js";import{d as W,o as f,c as x,a5 as M,k as B,b as X,w as G,a as L,j as O,t as H,p as U,a3 as A,E as $}from"./chunks/framework.BNdm2jZV.js";var j=/\s/;function K(s){for(var i=s.length;i--&&j.test(s.charAt(i)););return i}var J=/^\s+/;function z(s){return s&&s.slice(0,K(s)+1).replace(J,"")}var _=NaN,Q=/^[-+]0x[0-9a-f]+$/i,Y=/^0b[01]+$/i,Z=/^0o[0-7]+$/i,ss=parseInt;function q(s){if(typeof s=="number")return s;if(P(s))return _;if(b(s)){var i=typeof s.valueOf=="function"?s.valueOf():s;s=b(i)?i+"":i}if(typeof s!="string")return s===0?s:+s;s=z(s);var a=Y.test(s);return a||Z.test(s)?ss(s.slice(2),a?2:8):Q.test(s)?_:+s}var F=function(){return N.Date.now()},is="Expected a function",as=Math.max,ts=Math.min;function ns(s,i,a){var e,p,l,k,n,h,d=0,m=!1,E=!1,c=!0;if(typeof s!="function")throw new TypeError(is);i=q(i)||0,b(a)&&(m=!!a.leading,E="maxWait"in a,l=E?as(q(a.maxWait)||0,i):l,c="trailing"in a?!!a.trailing:c);function y(t){var r=e,o=p;return e=p=void 0,d=t,k=s.apply(o,r),k}function T(t){return d=t,n=setTimeout(g,i),m?y(t):k}function w(t){var r=t-h,o=t-d,D=i-r;return E?ts(D,l-o):D}function v(t){var r=t-h,o=t-d;return h===void 0||r>=i||r<0||E&&o>=l}function g(){var t=F();if(v(t))return C(t);n=setTimeout(g,w(t))}function C(t){return n=void 0,c&&e?y(t):(e=p=void 0,k)}function S(){n!==void 0&&clearTimeout(n),d=0,e=h=p=n=void 0}function I(){return n===void 0?k:C(F())}function u(){var t=F(),r=v(t);if(e=arguments,p=this,h=t,r){if(n===void 0)return T(h);if(E)return clearTimeout(n),n=setTimeout(g,i),y(h)}return n===void 0&&(n=setTimeout(g,i)),k}return u.cancel=S,u.flush=I,u}const es=()=>{const s=new WeakMap;return{beforeMount:(i,{value:a})=>{const{func:e,trigger:p="click",wait:l=500,options:k}=a;if(typeof e!="function")throw new TypeError("debounce directive value must be a function");const n=ns(e,l,k),h=R(i,p,n);s.set(i,()=>{n.cancel(),h()})},beforeUnmount(i){var a;(a=s.get(i))==null||a(),s.delete(i)}}},ls={class:"ray-demo"},hs={class:"ray-demo-result"},ps=W({__name:"DebounceDemo",setup(s){const i=es(),a=U(0),e=()=>{a.value+=1};return(p,l)=>(f(),x("div",ls,[M((f(),X(B(V),null,{default:G(()=>[...l[0]||(l[0]=[L(" 连续点击 / Click repeatedly ",-1)])]),_:1})),[[B(i),{wait:500,func:e}]]),O("output",hs,"执行次数 / Calls: "+H(a.value),1)]))}}),cs=JSON.parse('{"title":"指令","description":"","frontmatter":{},"headers":[],"relativePath":"reference/directives.md","filePath":"reference/directives.md"}'),ks={name:"reference/directives.md"},ys=Object.assign(ks,{setup(s){return(i,a)=>(f(),x("div",null,[a[0]||(a[0]=A("",8)),$(ps),a[1]||(a[1]=A("",21))]))}});export{cs as __pageData,ys as default}; +import{u as R}from"./chunks/index.CRUCD9CF.js";import{i as f,r as N}from"./chunks/Loading.CYk0ZDH9.js";import{i as P}from"./chunks/isSymbol.BJY0fdHu.js";import{B as V}from"./chunks/Button.B5dXaugh.js";import{d as W,o as m,c as x,a5 as M,k as B,b as X,w as G,a as L,j as O,t as H,p as U,a3 as A,E as $}from"./chunks/framework.BNdm2jZV.js";var j=/\s/;function K(s){for(var i=s.length;i--&&j.test(s.charAt(i)););return i}var J=/^\s+/;function z(s){return s&&s.slice(0,K(s)+1).replace(J,"")}var _=NaN,Q=/^[-+]0x[0-9a-f]+$/i,Y=/^0b[01]+$/i,Z=/^0o[0-7]+$/i,ss=parseInt;function q(s){if(typeof s=="number")return s;if(P(s))return _;if(f(s)){var i=typeof s.valueOf=="function"?s.valueOf():s;s=f(i)?i+"":i}if(typeof s!="string")return s===0?s:+s;s=z(s);var a=Y.test(s);return a||Z.test(s)?ss(s.slice(2),a?2:8):Q.test(s)?_:+s}var F=function(){return N.Date.now()},is="Expected a function",as=Math.max,ts=Math.min;function ns(s,i,a){var e,p,l,k,n,h,d=0,v=!1,E=!1,g=!0;if(typeof s!="function")throw new TypeError(is);i=q(i)||0,f(a)&&(v=!!a.leading,E="maxWait"in a,l=E?as(q(a.maxWait)||0,i):l,g="trailing"in a?!!a.trailing:g);function y(t){var r=e,c=p;return e=p=void 0,d=t,k=s.apply(c,r),k}function T(t){return d=t,n=setTimeout(o,i),v?y(t):k}function w(t){var r=t-h,c=t-d,D=i-r;return E?ts(D,l-c):D}function b(t){var r=t-h,c=t-d;return h===void 0||r>=i||r<0||E&&c>=l}function o(){var t=F();if(b(t))return C(t);n=setTimeout(o,w(t))}function C(t){return n=void 0,g&&e?y(t):(e=p=void 0,k)}function S(){n!==void 0&&clearTimeout(n),d=0,e=h=p=n=void 0}function I(){return n===void 0?k:C(F())}function u(){var t=F(),r=b(t);if(e=arguments,p=this,h=t,r){if(n===void 0)return T(h);if(E)return clearTimeout(n),n=setTimeout(o,i),y(h)}return n===void 0&&(n=setTimeout(o,i)),k}return u.cancel=S,u.flush=I,u}const es=()=>{const s=new WeakMap;return{beforeMount:(i,{value:a})=>{const{func:e,trigger:p="click",wait:l=500,options:k}=a;if(typeof e!="function")throw new TypeError("debounce directive value must be a function");const n=ns(e,l,k),h=R(i,p,n);s.set(i,()=>{n.cancel(),h()})},beforeUnmount(i){var a;(a=s.get(i))==null||a(),s.delete(i)}}},ls={class:"ray-demo"},hs={class:"ray-demo-result"},ps=W({__name:"DebounceDemo",setup(s){const i=es(),a=U(0),e=()=>{a.value+=1};return(p,l)=>(m(),x("div",ls,[M((m(),X(B(V),null,{default:G(()=>[...l[0]||(l[0]=[L(" 连续点击 / Click repeatedly ",-1)])]),_:1})),[[B(i),{wait:500,func:e}]]),O("output",hs,"执行次数 / Calls: "+H(a.value),1)]))}}),gs=JSON.parse('{"title":"指令","description":"","frontmatter":{},"headers":[],"relativePath":"reference/directives.md","filePath":"reference/directives.md"}'),ks={name:"reference/directives.md"},ys=Object.assign(ks,{setup(s){return(i,a)=>(m(),x("div",null,[a[0]||(a[0]=A("",8)),$(ps),a[1]||(a[1]=A("",21))]))}});export{gs as __pageData,ys as default}; diff --git a/docs/assets/reference_hooks.md.fkz_ntnz.js b/docs/assets/reference_hooks.md.B4xmkbad.js similarity index 84% rename from docs/assets/reference_hooks.md.fkz_ntnz.js rename to docs/assets/reference_hooks.md.B4xmkbad.js index 92a966b9..6cb41089 100644 --- a/docs/assets/reference_hooks.md.fkz_ntnz.js +++ b/docs/assets/reference_hooks.md.B4xmkbad.js @@ -1 +1 @@ -import{_ as o,o as t,c as a,a3 as d}from"./chunks/framework.BNdm2jZV.js";const u=JSON.parse('{"title":"Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),r={name:"reference/hooks.md"};function s(c,e,h,n,l,i){return t(),a("div",null,[...e[0]||(e[0]=[d('

Hooks ​

模板的公开 Hooks 从 @/hooks 导入。与具体组件一起使用的 useForm、useModal、useChart、useFlow 从 @/components 导入,请看对应组件页。useRequest 从 @/axios 导入。

需求API
跳转页面,切换首页,操作标签和菜单标记导航与菜单
内容最大化、重载或滚动布局与滚动
主题、语言、水印主题与国际化
分页与右键菜单组件交互
窗口尺寸、元素全屏和日期窗口与日期
DOM 截图、打印截图与打印

需要订阅、事件或清理的 Hook 在 setup() 或有效的 Vue effect scope 中创建。在 DOM 挂载后或用户操作时执行截图、打印和全屏。BasicTarget 接受元素、ref 或 getter,解析规则和可用元素类型见Vue 与 DOM 目标。

项目保留 @/hooks/web/useI18n、@/hooks/web/useVueRouter、@/hooks/web/usePagination 作为兼容导入。新代码统一从 @/hooks 导入。实现和测试入口见源码 Hooks 索引。

',5)])])}const f=o(r,[["render",s]]);export{u as __pageData,f as default}; +import{_ as o,o as t,c as a,a3 as d}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),r={name:"reference/hooks.md"};function s(c,e,h,n,f,l){return t(),a("div",null,[...e[0]||(e[0]=[d('

Hooks ​

模板的公开 Hooks 从 @/hooks 导入。与具体组件一起使用的 useForm、useModal、useChart、useFlow 从 @/components 导入,请看对应组件页。useRequest 从 @/axios 导入。

需求API
跳转页面,切换首页,操作标签和菜单标记导航与菜单
内容最大化、重载或滚动布局与滚动
主题、语言、水印主题与国际化
分页与右键菜单组件交互
窗口尺寸、元素全屏和日期窗口与日期
DOM 截图、打印截图与打印

需要订阅、事件或清理的 Hook 在 setup() 或有效的 Vue effect scope 中创建。在 DOM 挂载后或用户操作时执行截图、打印和全屏。BasicTarget 接受元素、ref 或 getter,解析规则和可用元素类型见Vue 与 DOM 目标。

项目保留 @/hooks/web/useI18n、@/hooks/web/useVueRouter、@/hooks/web/usePagination 作为兼容导入。新代码统一从 @/hooks 导入。实现和测试入口见源码 Hooks 索引。

',5)])])}const u=o(r,[["render",s]]);export{k as __pageData,u as default}; diff --git a/docs/assets/reference_hooks.md.B4xmkbad.lean.js b/docs/assets/reference_hooks.md.B4xmkbad.lean.js new file mode 100644 index 00000000..9d767abe --- /dev/null +++ b/docs/assets/reference_hooks.md.B4xmkbad.lean.js @@ -0,0 +1 @@ +import{_ as o,o as t,c as a,a3 as d}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),r={name:"reference/hooks.md"};function s(c,e,h,n,f,l){return t(),a("div",null,[...e[0]||(e[0]=[d("",5)])])}const u=o(r,[["render",s]]);export{k as __pageData,u as default}; diff --git a/docs/assets/reference_hooks.md.fkz_ntnz.lean.js b/docs/assets/reference_hooks.md.fkz_ntnz.lean.js deleted file mode 100644 index 39949bef..00000000 --- a/docs/assets/reference_hooks.md.fkz_ntnz.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as o,o as t,c as a,a3 as d}from"./chunks/framework.BNdm2jZV.js";const u=JSON.parse('{"title":"Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks.md","filePath":"reference/hooks.md"}'),r={name:"reference/hooks.md"};function s(c,e,h,n,l,i){return t(),a("div",null,[...e[0]||(e[0]=[d("",5)])])}const f=o(r,[["render",s]]);export{u as __pageData,f as default}; diff --git a/docs/assets/reference_hooks_appearance.md.JMrRj834.js b/docs/assets/reference_hooks_appearance.md.DMkYAmsP.js similarity index 94% rename from docs/assets/reference_hooks_appearance.md.JMrRj834.js rename to docs/assets/reference_hooks_appearance.md.DMkYAmsP.js index 880bc086..123404c9 100644 --- a/docs/assets/reference_hooks_appearance.md.JMrRj834.js +++ b/docs/assets/reference_hooks_appearance.md.DMkYAmsP.js @@ -1,4 +1,4 @@ -import{_ as a,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"主题、语言和水印 Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/appearance.md","filePath":"reference/hooks/appearance.md"}'),n={name:"reference/hooks/appearance.md"};function h(k,s,p,l,r,d){return i(),e("div",null,[...s[0]||(s[0]=[t(`

主题、语言和水印 Hooks ​

useTheme ​

useTheme() 返回下列方法。颜色覆盖由设置 Store 和全局 Provider 一起管理。

方法行为
lightTheme() / darkTheme()切换为手动浅色或深色,更新 Naive UI 的主题覆盖。
toggleTheme()根据当前实际明暗状态切换到相反的手动主题。
syncSystemTheme()读取浏览器偏好并切换到 auto,之后由设置 Store 跟随系统变化。
getAppTheme()返回 { theme, themeLabel, themeI18nLabel };theme 为 true 表示深色,themeLabel 是固定的 Dark / Light。

getAppTheme() 返回一次读取的对象。界面要跟随语言或主题变化时,在 computed 或渲染中调用。自定义主色请使用 Setting Store 的 changePrimaryColor。

useI18n ​

useI18n(namespace?) 返回 t(key, ...args)、locale(lang) 和初始化时可用的 Vue I18n 全局能力。useI18n('menu').t('Dashboard') 与 useI18n('menu').t('menu.Dashboard') 指向同一翻译键。未指定命名空间时,裸字符串原样返回。初始化前,t 返回解析后的键;初始化后同一个翻译函数会读取最新实例。

@/hooks 还导出独立的 t(key),它只返回原始键,可供路由元数据和翻译工具静态识别。切换整个应用语言用 useSettingActions().updateLocale(lang),以同步 Day.js、组件库和持久化语言;直接调用 useI18n().locale 只操作 Vue I18n 和 HTML 语言属性。

ts
import { useI18n, useTheme } from '@/hooks'
+import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"主题、语言和水印 Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/appearance.md","filePath":"reference/hooks/appearance.md"}'),n={name:"reference/hooks/appearance.md"};function h(k,s,p,l,r,d){return a(),e("div",null,[...s[0]||(s[0]=[t(`

主题、语言和水印 Hooks ​

useTheme ​

useTheme() 返回下列方法。颜色覆盖由设置 Store 和全局 Provider 一起管理。

方法行为
lightTheme() / darkTheme()切换为手动浅色或深色,更新 Naive UI 的主题覆盖。
toggleTheme()根据当前实际明暗状态切换到相反的手动主题。
syncSystemTheme()读取浏览器偏好并切换到 auto,之后由设置 Store 跟随系统变化。
getAppTheme()返回 { theme, themeLabel, themeI18nLabel };theme 为 true 表示深色,themeLabel 是固定的 Dark / Light。

getAppTheme() 返回一次读取的对象。界面要跟随语言或主题变化时,在 computed 或渲染中调用。自定义主色请使用 Setting Store 的 changePrimaryColor。

useI18n ​

useI18n(namespace?) 返回 t(key, ...args)、locale(lang) 和初始化时可用的 Vue I18n 全局能力。useI18n('menu').t('Dashboard') 与 useI18n('menu').t('menu.Dashboard') 指向同一翻译键。未指定命名空间时,裸字符串原样返回。初始化前,t 返回解析后的键;初始化后同一个翻译函数会读取最新实例。

@/hooks 还导出独立的 t(key),它只返回原始键,可供路由元数据和翻译工具静态识别。切换整个应用语言用 useSettingActions().updateLocale(lang),以同步 Day.js、组件库和持久化语言;直接调用 useI18n().locale 只操作 Vue I18n 和 HTML 语言属性。

ts
import { useI18n, useTheme } from '@/hooks'
 import { useSettingActions } from '@/store'
 import { computed } from 'vue'
 
@@ -23,4 +23,4 @@ import{_ as a,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E
     },
     disable: hiddenWatermark,
   }
-}

源码:useTheme · useI18n · useWatermark

`,13)])])}const c=a(n,[["render",h]]);export{E as __pageData,c as default}; +}

源码:useTheme · useI18n · useWatermark

`,13)])])}const E=i(n,[["render",h]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_hooks_appearance.md.DMkYAmsP.lean.js b/docs/assets/reference_hooks_appearance.md.DMkYAmsP.lean.js new file mode 100644 index 00000000..b0f5169e --- /dev/null +++ b/docs/assets/reference_hooks_appearance.md.DMkYAmsP.lean.js @@ -0,0 +1 @@ +import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"主题、语言和水印 Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/appearance.md","filePath":"reference/hooks/appearance.md"}'),n={name:"reference/hooks/appearance.md"};function h(k,s,p,l,r,d){return a(),e("div",null,[...s[0]||(s[0]=[t("",13)])])}const E=i(n,[["render",h]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_hooks_appearance.md.JMrRj834.lean.js b/docs/assets/reference_hooks_appearance.md.JMrRj834.lean.js deleted file mode 100644 index 18566668..00000000 --- a/docs/assets/reference_hooks_appearance.md.JMrRj834.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as a,o as i,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const E=JSON.parse('{"title":"主题、语言和水印 Hooks","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/appearance.md","filePath":"reference/hooks/appearance.md"}'),n={name:"reference/hooks/appearance.md"};function h(k,s,p,l,r,d){return i(),e("div",null,[...s[0]||(s[0]=[t("",13)])])}const c=a(n,[["render",h]]);export{E as __pageData,c as default}; diff --git a/docs/assets/reference_hooks_browser.md.D5n_xtb0.js b/docs/assets/reference_hooks_browser.md.Mj7VwVYF.js similarity index 98% rename from docs/assets/reference_hooks_browser.md.D5n_xtb0.js rename to docs/assets/reference_hooks_browser.md.Mj7VwVYF.js index f729a517..2c8e067f 100644 --- a/docs/assets/reference_hooks_browser.md.D5n_xtb0.js +++ b/docs/assets/reference_hooks_browser.md.Mj7VwVYF.js @@ -42,4 +42,4 @@ import{a8 as P,a9 as j,S as O,p as I,d as R,aa as N,o as C,c as D,E as b,k as c, const day = useDayjs() export const exportDate = day.format('2026-11-03', { format: 'YYYY-MM-DD' }) -export const dayRange = day.getStartAndEndOfDay()

源码:useDevice · useElementFullscreen · useDayjs

`,10))]))}});export{as as __pageData,es as default}; +export const dayRange = day.getStartAndEndOfDay()

源码:useDevice · useElementFullscreen · useDayjs

`,10))]))}});export{as as __pageData,es as default}; diff --git a/docs/assets/reference_hooks_browser.md.D5n_xtb0.lean.js b/docs/assets/reference_hooks_browser.md.Mj7VwVYF.lean.js similarity index 100% rename from docs/assets/reference_hooks_browser.md.D5n_xtb0.lean.js rename to docs/assets/reference_hooks_browser.md.Mj7VwVYF.lean.js diff --git a/docs/assets/reference_hooks_interaction.md.Big820ZZ.js b/docs/assets/reference_hooks_interaction.md.C4zawhnF.js similarity index 98% rename from docs/assets/reference_hooks_interaction.md.Big820ZZ.js rename to docs/assets/reference_hooks_interaction.md.C4zawhnF.js index 2d972b31..2ecb6a0c 100644 --- a/docs/assets/reference_hooks_interaction.md.Big820ZZ.js +++ b/docs/assets/reference_hooks_interaction.md.C4zawhnF.js @@ -31,4 +31,4 @@ import{_ as i,o as a,c as n,a3 as t}from"./chunks/framework.BNdm2jZV.js";const o </div> ) }, -})

源码:usePagination · useContextmenuCoordinate

`,11)])])}const g=i(e,[["render",h]]);export{o as __pageData,g as default}; +})

源码:usePagination · useContextmenuCoordinate

`,11)])])}const g=i(e,[["render",h]]);export{o as __pageData,g as default}; diff --git a/docs/assets/reference_hooks_interaction.md.Big820ZZ.lean.js b/docs/assets/reference_hooks_interaction.md.C4zawhnF.lean.js similarity index 100% rename from docs/assets/reference_hooks_interaction.md.Big820ZZ.lean.js rename to docs/assets/reference_hooks_interaction.md.C4zawhnF.lean.js diff --git a/docs/assets/reference_hooks_layout.md.BcnUJtrr.js b/docs/assets/reference_hooks_layout.md.DusPdzbc.js similarity index 97% rename from docs/assets/reference_hooks_layout.md.BcnUJtrr.js rename to docs/assets/reference_hooks_layout.md.DusPdzbc.js index 4c61be6c..cd9e3cca 100644 --- a/docs/assets/reference_hooks_layout.md.BcnUJtrr.js +++ b/docs/assets/reference_hooks_layout.md.DusPdzbc.js @@ -25,4 +25,4 @@ import{_ as i,o as a,c as n,a3 as e}from"./chunks/framework.BNdm2jZV.js";const E toTop: () => scrollContent(0, 0), toMenuTop: () => scrollSider(0, 0), } -}

源码:useMaximize · useSpinning · useContentScroll · useSiderScroll

`,16)])])}const c=i(t,[["render",l]]);export{E as __pageData,c as default}; +}

源码:useMaximize · useSpinning · useContentScroll · useSiderScroll

`,16)])])}const c=i(t,[["render",l]]);export{E as __pageData,c as default}; diff --git a/docs/assets/reference_hooks_layout.md.BcnUJtrr.lean.js b/docs/assets/reference_hooks_layout.md.DusPdzbc.lean.js similarity index 100% rename from docs/assets/reference_hooks_layout.md.BcnUJtrr.lean.js rename to docs/assets/reference_hooks_layout.md.DusPdzbc.lean.js diff --git a/docs/assets/reference_hooks_navigation.md.CGGlTsKj.js b/docs/assets/reference_hooks_navigation.md.BowABOxT.js similarity index 96% rename from docs/assets/reference_hooks_navigation.md.CGGlTsKj.js rename to docs/assets/reference_hooks_navigation.md.BowABOxT.js index 80f6e95e..9b2e2fd6 100644 --- a/docs/assets/reference_hooks_navigation.md.CGGlTsKj.js +++ b/docs/assets/reference_hooks_navigation.md.BowABOxT.js @@ -1,4 +1,4 @@ -import{_ as i,o as a,c as t,a3 as e}from"./chunks/framework.BNdm2jZV.js";const g=JSON.parse('{"title":"导航与菜单","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/navigation.md","filePath":"reference/hooks/navigation.md"}'),n={name:"reference/hooks/navigation.md"};function h(p,s,l,k,d,r){return a(),t("div",null,[...s[0]||(s[0]=[e(`

导航与菜单 ​

从 @/hooks 导入本页 API。菜单来源、权限和路由记录见路由指南。

useVueRouter ​

useVueRouter() 返回 { router },指向模板的共享 Vue Router 实例。当前路由用 router.currentRoute.value 读取,push、replace、back 等行为由 Vue Router 提供。它可在 setup 外取得实例。初始化后再访问依赖实际路由匹配的状态。

ts
import { useVueRouter } from '@/hooks'
+import{_ as i,o as a,c as t,a3 as e}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"导航与菜单","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/navigation.md","filePath":"reference/hooks/navigation.md"}'),n={name:"reference/hooks/navigation.md"};function h(p,s,l,k,d,r){return a(),t("div",null,[...s[0]||(s[0]=[e(`

导航与菜单 ​

从 @/hooks 导入本页 API。菜单来源、权限和路由记录见路由指南。

useVueRouter ​

useVueRouter() 返回 { router },指向模板的共享 Vue Router 实例。当前路由用 router.currentRoute.value 读取,push、replace、back 等行为由 Vue Router 提供。它可在 setup 外取得实例。初始化后再访问依赖实际路由匹配的状态。

ts
import { useVueRouter } from '@/hooks'
 
 export const readQuery = () => useVueRouter().router.currentRoute.value.query

useAppNavigation ​

useAppNavigation().navigationTo(target, options?) 支持三类目标:

target行为
完整路径字符串先用 Router 解析,保留动态路径、query 和 hash。未匹配或只匹配兜底路由时返回 undefined。
AppMenuOption按 fullPath 导航。
从 0 开始的整数从当前菜单取项,遇到父菜单沿第一个子项查到叶子。菜单需要先初始化。

NavigationToOptions.isPush 默认 true;设为 false 使用 router.replace。query 可覆盖字符串路径中的同名查询参数。成功发起时返回 Router Promise。负数、小数、非有限数和越界索引不会导航;实际结果仍受路由守卫影响。

ts
import { useAppNavigation } from '@/hooks'
 
@@ -30,4 +30,4 @@ import{_ as i,o as a,c as t,a3 as e}from"./chunks/framework.BNdm2jZV.js";const g
   const path = '/tables/remote'
   return (count: number) =>
     count > 0 ? show(path, { label: count, type: 'info' }) : hidden(path)
-}

源码:useAppNavigation · useAppRoot · useSiderBar · useBadge · useVueRouter

`,23)])])}const E=i(n,[["render",h]]);export{g as __pageData,E as default}; +}

源码:useAppNavigation · useAppRoot · useSiderBar · useBadge · useVueRouter

`,23)])])}const g=i(n,[["render",h]]);export{c as __pageData,g as default}; diff --git a/docs/assets/reference_hooks_navigation.md.CGGlTsKj.lean.js b/docs/assets/reference_hooks_navigation.md.BowABOxT.lean.js similarity index 71% rename from docs/assets/reference_hooks_navigation.md.CGGlTsKj.lean.js rename to docs/assets/reference_hooks_navigation.md.BowABOxT.lean.js index 84eeec5b..7891523a 100644 --- a/docs/assets/reference_hooks_navigation.md.CGGlTsKj.lean.js +++ b/docs/assets/reference_hooks_navigation.md.BowABOxT.lean.js @@ -1 +1 @@ -import{_ as i,o as a,c as t,a3 as e}from"./chunks/framework.BNdm2jZV.js";const g=JSON.parse('{"title":"导航与菜单","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/navigation.md","filePath":"reference/hooks/navigation.md"}'),n={name:"reference/hooks/navigation.md"};function h(p,s,l,k,d,r){return a(),t("div",null,[...s[0]||(s[0]=[e("",23)])])}const E=i(n,[["render",h]]);export{g as __pageData,E as default}; +import{_ as i,o as a,c as t,a3 as e}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"导航与菜单","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/navigation.md","filePath":"reference/hooks/navigation.md"}'),n={name:"reference/hooks/navigation.md"};function h(p,s,l,k,d,r){return a(),t("div",null,[...s[0]||(s[0]=[e("",23)])])}const g=i(n,[["render",h]]);export{c as __pageData,g as default}; diff --git a/docs/assets/reference_hooks_output.md.B8QXZTOo.js b/docs/assets/reference_hooks_output.md.D12chI92.js similarity index 97% rename from docs/assets/reference_hooks_output.md.B8QXZTOo.js rename to docs/assets/reference_hooks_output.md.D12chI92.js index 9f099210..302edd16 100644 --- a/docs/assets/reference_hooks_output.md.B8QXZTOo.js +++ b/docs/assets/reference_hooks_output.md.D12chI92.js @@ -19,4 +19,4 @@ import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c documentTitle: '库存报表', }) return { report, print } -}

TablePro 内置打印按当前页和可见列生成报表。要保留自定义业务排版,参考 TablePro 打印。

源码:useDomToImage · usePrint

`,12)])])}const E=i(n,[["render",p]]);export{c as __pageData,E as default}; +}

TablePro 内置打印按当前页和可见列生成报表。要保留自定义业务排版,参考 TablePro 打印。

源码:useDomToImage · usePrint

`,12)])])}const E=i(n,[["render",p]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_hooks_output.md.B8QXZTOo.lean.js b/docs/assets/reference_hooks_output.md.D12chI92.lean.js similarity index 100% rename from docs/assets/reference_hooks_output.md.B8QXZTOo.lean.js rename to docs/assets/reference_hooks_output.md.D12chI92.lean.js diff --git a/docs/assets/reference_icons.md.lwCUuJHp.js b/docs/assets/reference_icons.md.CbIxhVM1.js similarity index 95% rename from docs/assets/reference_icons.md.lwCUuJHp.js rename to docs/assets/reference_icons.md.CbIxhVM1.js index 2e1eadbf..cc39d3e0 100644 --- a/docs/assets/reference_icons.md.lwCUuJHp.js +++ b/docs/assets/reference_icons.md.CbIxhVM1.js @@ -1,6 +1,6 @@ -import{_ as e,o as a,c as t,a3 as i}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"SVG 图标","description":"","frontmatter":{},"headers":[],"relativePath":"reference/icons.md","filePath":"reference/icons.md"}'),d={name:"reference/icons.md"};function o(n,s,c,r,h,p){return a(),t("div",null,[...s[0]||(s[0]=[i(`

SVG 图标 ​

tsx
import type { IconName } from '@ray-template/icons'
+import{_ as e,o as t,c as a,a3 as i}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"SVG 图标","description":"","frontmatter":{},"headers":[],"relativePath":"reference/icons.md","filePath":"reference/icons.md"}'),d={name:"reference/icons.md"};function o(c,s,n,r,h,p){return t(),a("div",null,[...s[0]||(s[0]=[i(`

SVG 图标 ​

tsx
import type { IconName } from '@ray-template/icons'
 import { RIcon } from '@ray-template/ui/icon'
 
 const name: IconName = 'directional/resize_h'
 
-const renderIcon = () => <RIcon name={name} size={24} />

RIcon.name 和路由 meta.icon 使用同一套完整分包名。将 SVG 加入 packages/icons/src/<分包>,例如 packages/icons/src/business/orders/approved.svg 对应 business/orders/approved。可在演示的 SVG 图标页面查找并复制用法。

添加和生成 ​

  1. 选择现有分包(如 action、navigation、system),或按业务新建分包。路径段使用小写字母、数字、下划线或连字符,且以字母开头。
  2. 单色图标用 currentColor,留白用 none。品牌和插画保留原色。
  3. 开发服务或 pnpm icons:generate 更新 packages/icons/src/manifest.ts;检查 pnpm icons:check,与 SVG 一起提交。不要手改联合类型。

生产时每个顶层分包生成独立、带 hash 的雪碧图,资源随部署 base 加载。迁移时直接改旧代码的裸名称;旧缓存仅当文件名唯一时自动转换。

图标流程与分包表

RIcon API ​

RIcon、IconProps、iconProps、IconName 和 IconPackage 从 @/components 导出。也可从 @/icons 导入图标类型。

属性默认说明
name必填完整的分包路径,首段用于选择雪碧图。
size14基础宽高,数字按像素,也可传 CSS 尺寸。
width / height0 / 0分别覆盖基础尺寸,0 回退到 size。
color'currentColor'SVG 填充色;带原色的品牌和插画不会全部被覆盖。
prefix'icon'symbol 前缀,须与生成配置一致。
customClassName无根元素的额外类名。
depth1图标透明层级。
cursor'default'指针样式。
onClick(event)无支持函数或回调数组。

图标内部 SVG 对读屏隐藏。如果用图标触发操作,把它放进具有可访问名称的按钮内,保留键盘操作和焦点。

RIcon Props · 雪碧图引用实现

`,12)])])}const g=e(d,[["render",o]]);export{k as __pageData,g as default}; +const renderIcon = () => <RIcon name={name} size={24} />

RIcon.name 和路由 meta.icon 使用同一套完整分包名。将 SVG 加入 packages/icons/src/<分包>,例如 packages/icons/src/business/orders/approved.svg 对应 business/orders/approved。可在演示的 SVG 图标页面查找并复制用法。

添加和生成 ​

  1. 选择现有分包(如 action、navigation、system),或按业务新建分包。路径段使用小写字母、数字、下划线或连字符,且以字母开头。
  2. 单色图标用 currentColor,留白用 none。品牌和插画保留原色。
  3. 开发服务或 pnpm icons:generate 更新 packages/icons/src/manifest.ts;检查 pnpm icons:check,与 SVG 一起提交。不要手改联合类型。

生产时每个顶层分包生成独立、带 hash 的雪碧图,资源随部署 base 加载。迁移时直接改旧代码的裸名称;旧缓存仅当文件名唯一时自动转换。

图标流程与分包表

RIcon API ​

RIcon、IconProps、iconProps、IconName 和 IconPackage 从 @/components 导出。也可从 @/icons 导入图标类型。

属性默认说明
name必填完整的分包路径,首段用于选择雪碧图。
size14基础宽高,数字按像素,也可传 CSS 尺寸。
width / height0 / 0分别覆盖基础尺寸,0 回退到 size。
color'currentColor'SVG 填充色;带原色的品牌和插画不会全部被覆盖。
prefix'icon'symbol 前缀,须与生成配置一致。
customClassName无根元素的额外类名。
depth1图标透明层级。
cursor'default'指针样式。
onClick(event)无支持函数或回调数组。

图标内部 SVG 对读屏隐藏。如果用图标触发操作,把它放进具有可访问名称的按钮内,保留键盘操作和焦点。

RIcon Props · 雪碧图引用实现

`,12)])])}const g=e(d,[["render",o]]);export{k as __pageData,g as default}; diff --git a/docs/assets/reference_icons.md.lwCUuJHp.lean.js b/docs/assets/reference_icons.md.CbIxhVM1.lean.js similarity index 68% rename from docs/assets/reference_icons.md.lwCUuJHp.lean.js rename to docs/assets/reference_icons.md.CbIxhVM1.lean.js index 461df0bd..143d827c 100644 --- a/docs/assets/reference_icons.md.lwCUuJHp.lean.js +++ b/docs/assets/reference_icons.md.CbIxhVM1.lean.js @@ -1 +1 @@ -import{_ as e,o as a,c as t,a3 as i}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"SVG 图标","description":"","frontmatter":{},"headers":[],"relativePath":"reference/icons.md","filePath":"reference/icons.md"}'),d={name:"reference/icons.md"};function o(n,s,c,r,h,p){return a(),t("div",null,[...s[0]||(s[0]=[i("",12)])])}const g=e(d,[["render",o]]);export{k as __pageData,g as default}; +import{_ as e,o as t,c as a,a3 as i}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"SVG 图标","description":"","frontmatter":{},"headers":[],"relativePath":"reference/icons.md","filePath":"reference/icons.md"}'),d={name:"reference/icons.md"};function o(c,s,n,r,h,p){return t(),a("div",null,[...s[0]||(s[0]=[i("",12)])])}const g=e(d,[["render",o]]);export{k as __pageData,g as default}; diff --git a/docs/assets/reference_source.md.M6GWIIfO.js b/docs/assets/reference_source.md.Ces0B5lP.js similarity index 88% rename from docs/assets/reference_source.md.M6GWIIfO.js rename to docs/assets/reference_source.md.Ces0B5lP.js index 3eca4233..9f4b77d9 100644 --- a/docs/assets/reference_source.md.M6GWIIfO.js +++ b/docs/assets/reference_source.md.Ces0B5lP.js @@ -1 +1 @@ -import{_ as t,o as a,c as r,a3 as o}from"./chunks/framework.BNdm2jZV.js";const p=JSON.parse('{"title":"文档与源码版本","description":"","frontmatter":{},"headers":[],"relativePath":"reference/source.md","filePath":"reference/source.md"}'),n={name:"reference/source.md"};function d(i,e,s,l,c,h){return a(),r("div",null,[...e[0]||(e[0]=[o('

文档与源码版本 ​

本站面向 Ray Template 6.0.0。Ray Admin、文档示例和共享包位于同一仓库。页内示例使用构建时同一工作区的包,发布构建的源码链接指向对应提交。

版本源码与说明
v6Ray Template 当前源码 · Monorepo 架构 · 版本分界与接入说明
v5legacy/v5 停在 6f095b7,已有 v5.2.4 标签保留。
旧文档历史旧文档仓库 · 旧版正文快照

源码版本号、Git 标签和网站部署各有进度。需要重现行为时,请记录具体标签或提交。报告问题时请注明使用的是 v5 还是 v6,并附上页面或模块入口。问题反馈

',4)])])}const m=t(n,[["render",d]]);export{p as __pageData,m as default}; +import{_ as t,o as a,c as r,a3 as o}from"./chunks/framework.BNdm2jZV.js";const p=JSON.parse('{"title":"文档与源码版本","description":"","frontmatter":{},"headers":[],"relativePath":"reference/source.md","filePath":"reference/source.md"}'),n={name:"reference/source.md"};function c(d,e,i,s,l,h){return a(),r("div",null,[...e[0]||(e[0]=[o('

文档与源码版本 ​

本站面向 Ray Template 6.0.0。Ray Admin、文档示例和共享包位于同一仓库。页内示例使用构建时同一工作区的包,发布构建的源码链接指向对应提交。

版本源码与说明
v6Ray Template 当前源码 · Monorepo 架构 · 版本分界与接入说明
v5legacy/v5 停在 6f095b7,已有 v5.2.4 标签保留。
旧文档历史旧文档仓库 · 旧版正文快照

源码版本号、Git 标签和网站部署各有进度。需要重现行为时,请记录具体标签或提交。报告问题时请注明使用的是 v5 还是 v6,并附上页面或模块入口。问题反馈

',4)])])}const m=t(n,[["render",c]]);export{p as __pageData,m as default}; diff --git a/docs/assets/reference_source.md.M6GWIIfO.lean.js b/docs/assets/reference_source.md.Ces0B5lP.lean.js similarity index 69% rename from docs/assets/reference_source.md.M6GWIIfO.lean.js rename to docs/assets/reference_source.md.Ces0B5lP.lean.js index 0edbb146..356a1aa1 100644 --- a/docs/assets/reference_source.md.M6GWIIfO.lean.js +++ b/docs/assets/reference_source.md.Ces0B5lP.lean.js @@ -1 +1 @@ -import{_ as t,o as a,c as r,a3 as o}from"./chunks/framework.BNdm2jZV.js";const p=JSON.parse('{"title":"文档与源码版本","description":"","frontmatter":{},"headers":[],"relativePath":"reference/source.md","filePath":"reference/source.md"}'),n={name:"reference/source.md"};function d(i,e,s,l,c,h){return a(),r("div",null,[...e[0]||(e[0]=[o("",4)])])}const m=t(n,[["render",d]]);export{p as __pageData,m as default}; +import{_ as t,o as a,c as r,a3 as o}from"./chunks/framework.BNdm2jZV.js";const p=JSON.parse('{"title":"文档与源码版本","description":"","frontmatter":{},"headers":[],"relativePath":"reference/source.md","filePath":"reference/source.md"}'),n={name:"reference/source.md"};function c(d,e,i,s,l,h){return a(),r("div",null,[...e[0]||(e[0]=[o("",4)])])}const m=t(n,[["render",c]]);export{p as __pageData,m as default}; diff --git a/docs/assets/reference_store.md.BykMC8BP.js b/docs/assets/reference_store.md.D4ZVWtNT.js similarity index 92% rename from docs/assets/reference_store.md.BykMC8BP.js rename to docs/assets/reference_store.md.D4ZVWtNT.js index e25d0e80..6bb5ac2c 100644 --- a/docs/assets/reference_store.md.BykMC8BP.js +++ b/docs/assets/reference_store.md.D4ZVWtNT.js @@ -1 +1 @@ -import{_ as t,o,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const h=JSON.parse('{"title":"Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store.md","filePath":"reference/store.md"}'),a={name:"reference/store.md"};function s(c,e,n,i,p,l){return o(),r("div",null,[...e[0]||(e[0]=[d('

Store ​

模板使用 Pinia 管理跨页面状态。业务代码从 @/store 导入相应的 Getters / Actions,读取引用用 .value,修改走动作。只属于一个组件或页面的状态可以继续用本地 ref。

Store访问入口持久化
SettinguseSettingGetters / useSettingActionsLocal Storage piniaSettingStore,排除锁屏设置弹窗显隐;当前语言另外保存。
MenuuseMenuGetters / useMenuActionsLocal Storage 保存当前菜单和折叠状态;标签列表另存 Session Storage。
KeepAliveuseKeepAliveGetters / useKeepAliveActionsSession Storage 保存可缓存组件名。
RuntimeuseRuntimeGetters / useRuntimeActions无;随当前 Pinia 实例释放。
Lock ScreenuseLockScreenGetters / useLockScreenActionsLocal Storage 的历史布尔值,支持跨标签同步。
SigninguseSigningGetters / useSigningActionsLocal Storage 持久化账号显示信息,路由守卫另读 token。

初始化与扩展 ​

setupStore(app) 安装 Pinia 与持久化插件,应用卸载时释放 Pinia 实例及作用域。模板入口已调用,业务代码无需再次注册。Menu 与 Signing 依赖 Router 注入,请在应用组件的有效 setup 中访问。

新增 Store 在 apps/admin/src/store/modules 按领域建目录并指定唯一 ID。需要持久化时使用 pick 或 omit,选定存储范围和稳定的 key,只保存可序列化的值。调用接口放到 apps/admin/src/store/hooks,再由 apps/admin/src/store/index.ts 导出。原始 pinia…Store 同样公开给模板内部,但页面使用 hooks 可以减少对实现字段的直接依赖。

缓存键和 JSON 结构是已有数据契约。换 key、拆字段或改变序列化格式时,要考虑旧数据的读取、迁移和回退。浏览器缓存不应保存服务端密钥。

初始化与公开导出 · Store 源码约定

',8)])])}const m=t(a,[["render",s]]);export{h as __pageData,m as default}; +import{_ as t,o,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const h=JSON.parse('{"title":"Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store.md","filePath":"reference/store.md"}'),a={name:"reference/store.md"};function c(s,e,n,i,p,l){return o(),r("div",null,[...e[0]||(e[0]=[d('

Store ​

模板使用 Pinia 管理跨页面状态。业务代码从 @/store 导入相应的 Getters / Actions,读取引用用 .value,修改走动作。只属于一个组件或页面的状态可以继续用本地 ref。

Store访问入口持久化
SettinguseSettingGetters / useSettingActionsLocal Storage piniaSettingStore,排除锁屏设置弹窗显隐;当前语言另外保存。
MenuuseMenuGetters / useMenuActionsLocal Storage 保存当前菜单和折叠状态;标签列表另存 Session Storage。
KeepAliveuseKeepAliveGetters / useKeepAliveActionsSession Storage 保存可缓存组件名。
RuntimeuseRuntimeGetters / useRuntimeActions无;随当前 Pinia 实例释放。
Lock ScreenuseLockScreenGetters / useLockScreenActionsLocal Storage 的历史布尔值,支持跨标签同步。
SigninguseSigningGetters / useSigningActionsLocal Storage 持久化账号显示信息,路由守卫另读 token。

初始化与扩展 ​

setupStore(app) 安装 Pinia 与持久化插件,应用卸载时释放 Pinia 实例及作用域。模板入口已调用,业务代码无需再次注册。Menu 与 Signing 依赖 Router 注入,请在应用组件的有效 setup 中访问。

新增 Store 在 apps/admin/src/store/modules 按领域建目录并指定唯一 ID。需要持久化时使用 pick 或 omit,选定存储范围和稳定的 key,只保存可序列化的值。调用接口放到 apps/admin/src/store/hooks,再由 apps/admin/src/store/index.ts 导出。原始 pinia…Store 同样公开给模板内部,但页面使用 hooks 可以减少对实现字段的直接依赖。

缓存键和 JSON 结构是已有数据契约。换 key、拆字段或改变序列化格式时,要考虑旧数据的读取、迁移和回退。浏览器缓存不应保存服务端密钥。

初始化与公开导出 · Store 源码约定

',8)])])}const f=t(a,[["render",c]]);export{h as __pageData,f as default}; diff --git a/docs/assets/reference_store.md.BykMC8BP.lean.js b/docs/assets/reference_store.md.D4ZVWtNT.lean.js similarity index 67% rename from docs/assets/reference_store.md.BykMC8BP.lean.js rename to docs/assets/reference_store.md.D4ZVWtNT.lean.js index c7e6eca7..eae76cae 100644 --- a/docs/assets/reference_store.md.BykMC8BP.lean.js +++ b/docs/assets/reference_store.md.D4ZVWtNT.lean.js @@ -1 +1 @@ -import{_ as t,o,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const h=JSON.parse('{"title":"Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store.md","filePath":"reference/store.md"}'),a={name:"reference/store.md"};function s(c,e,n,i,p,l){return o(),r("div",null,[...e[0]||(e[0]=[d("",8)])])}const m=t(a,[["render",s]]);export{h as __pageData,m as default}; +import{_ as t,o,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const h=JSON.parse('{"title":"Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store.md","filePath":"reference/store.md"}'),a={name:"reference/store.md"};function c(s,e,n,i,p,l){return o(),r("div",null,[...e[0]||(e[0]=[d("",8)])])}const f=t(a,[["render",c]]);export{h as __pageData,f as default}; diff --git a/docs/assets/reference_store_navigation.md.BBSrn9C3.js b/docs/assets/reference_store_navigation.md.W6y0Xj28.js similarity index 95% rename from docs/assets/reference_store_navigation.md.BBSrn9C3.js rename to docs/assets/reference_store_navigation.md.W6y0Xj28.js index 613311ef..ed554d06 100644 --- a/docs/assets/reference_store_navigation.md.BBSrn9C3.js +++ b/docs/assets/reference_store_navigation.md.W6y0Xj28.js @@ -4,4 +4,4 @@ import{_ as t,o as a,c as s,a3 as i}from"./chunks/framework.BNdm2jZV.js";const k const { getMenuKey, getMenuTagOptions } = useMenuGetters() const { getKeepAliveInclude } = useKeepAliveGetters() return { getMenuKey, getMenuTagOptions, getKeepAliveInclude } -}

Menu 实现 · Menu Hooks · KeepAlive 实现

`,12)])])}const u=t(n,[["render",d]]);export{k as __pageData,u as default}; +}

Menu 实现 · Menu Hooks · KeepAlive 实现

`,12)])])}const u=t(n,[["render",d]]);export{k as __pageData,u as default}; diff --git a/docs/assets/reference_store_navigation.md.BBSrn9C3.lean.js b/docs/assets/reference_store_navigation.md.W6y0Xj28.lean.js similarity index 100% rename from docs/assets/reference_store_navigation.md.BBSrn9C3.lean.js rename to docs/assets/reference_store_navigation.md.W6y0Xj28.lean.js diff --git a/docs/assets/reference_store_runtime.md.DN1nqjBy.js b/docs/assets/reference_store_runtime.md.BH0FRgPU.js similarity index 94% rename from docs/assets/reference_store_runtime.md.DN1nqjBy.js rename to docs/assets/reference_store_runtime.md.BH0FRgPU.js index 17f89419..d836074a 100644 --- a/docs/assets/reference_store_runtime.md.DN1nqjBy.js +++ b/docs/assets/reference_store_runtime.md.BH0FRgPU.js @@ -1,4 +1,4 @@ -import{_ as i,o as e,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"Runtime 与 Lock Screen Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/runtime.md","filePath":"reference/store/runtime.md"}'),n={name:"reference/store/runtime.md"};function l(d,s,r,h,p,k){return e(),t("div",null,[...s[0]||(s[0]=[a(`

Runtime 与 Lock Screen Store ​

Runtime Store ​

useRuntimeGetters() 提供只读 ref;useRuntimeActions() 返回 setRuntimeState(key, value)、reloadContent(wait = 800)。这些 UI 状态不持久化。

字段默认用途
globalSpinningfalse全局 Spin。
globalDrawerValuefalse窄屏菜单抽屉。
globalMainLayoutLoadtrue默认布局是否挂载页面内容。
layoutContentMaximizefalse工作区最大化。
layoutContentMaximizeVersion0最大化状态变动序号,用于过滤过期回调,业务代码不直接更新。
layoutContentSpinningfalse布局内容区 Spin。
layoutContentMaximizeStyle{ zIndex: 999 }最大化的层级、背景、过渡样式。

reloadContent 暂时卸载当前内容并等待恢复;多次调用只保留最后一个计时,Store 卸载时清理计时。useSpinning().reload() 是同一动作。控制最大化时用 useMaximize 来保留回调和退出逻辑。全局 Spin 和内容 Spin 互相独立。

ts
import { useRuntimeActions } from '@/store'
+import{_ as i,o as e,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"Runtime 与 Lock Screen Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/runtime.md","filePath":"reference/store/runtime.md"}'),n={name:"reference/store/runtime.md"};function l(r,s,h,d,p,k){return e(),t("div",null,[...s[0]||(s[0]=[a(`

Runtime 与 Lock Screen Store ​

Runtime Store ​

useRuntimeGetters() 提供只读 ref;useRuntimeActions() 返回 setRuntimeState(key, value)、reloadContent(wait = 800)。这些 UI 状态不持久化。

字段默认用途
globalSpinningfalse全局 Spin。
globalDrawerValuefalse窄屏菜单抽屉。
globalMainLayoutLoadtrue默认布局是否挂载页面内容。
layoutContentMaximizefalse工作区最大化。
layoutContentMaximizeVersion0最大化状态变动序号,用于过滤过期回调,业务代码不直接更新。
layoutContentSpinningfalse布局内容区 Spin。
layoutContentMaximizeStyle{ zIndex: 999 }最大化的层级、背景、过渡样式。

reloadContent 暂时卸载当前内容并等待恢复;多次调用只保留最后一个计时,Store 卸载时清理计时。useSpinning().reload() 是同一动作。控制最大化时用 useMaximize 来保留回调和退出逻辑。全局 Spin 和内容 Spin 互相独立。

ts
import { useRuntimeActions } from '@/store'
 
 export function useGlobalLoading() {
   const { setRuntimeState } = useRuntimeActions()
@@ -10,4 +10,4 @@ import{_ as i,o as e,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const c
       setRuntimeState('globalSpinning', false)
     }
   }
-}

全局状态是布尔值,不对并发任务计数。如果多个独立请求同时使用,先由调用方统一协调开关。

Lock Screen Store ​

useLockScreenGetters().getLocked 是实际锁屏状态。useLockScreenActions().setLocked(value) 写入同一个状态,默认 false,通过 isAppLockScreen 在 Local Storage 保存历史布尔格式并跨标签同步。

实际锁定与 setting.lockScreenSwitch 分开,后者只控制锁屏设置弹窗。默认锁屏组件处理本地口令和解锁逻辑;业务按钮应打开设置弹窗,直接写锁定布尔值不会为用户建立口令。它是本机界面遮挡,与服务端会话和授权独立。

Runtime 实现 · Lock Screen 实现 · 锁屏流程

`,11)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default}; +}

全局状态是布尔值,不对并发任务计数。如果多个独立请求同时使用,先由调用方统一协调开关。

Lock Screen Store ​

useLockScreenGetters().getLocked 是实际锁屏状态。useLockScreenActions().setLocked(value) 写入同一个状态,默认 false,通过 isAppLockScreen 在 Local Storage 保存历史布尔格式并跨标签同步。

实际锁定与 setting.lockScreenSwitch 分开,后者只控制锁屏设置弹窗。默认锁屏组件处理本地口令和解锁逻辑;业务按钮应打开设置弹窗,直接写锁定布尔值不会为用户建立口令。它是本机界面遮挡,与服务端会话和授权独立。

Runtime 实现 · Lock Screen 实现 · 锁屏流程

`,11)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_store_runtime.md.DN1nqjBy.lean.js b/docs/assets/reference_store_runtime.md.BH0FRgPU.lean.js similarity index 71% rename from docs/assets/reference_store_runtime.md.DN1nqjBy.lean.js rename to docs/assets/reference_store_runtime.md.BH0FRgPU.lean.js index cdf98f13..7d90c9cf 100644 --- a/docs/assets/reference_store_runtime.md.DN1nqjBy.lean.js +++ b/docs/assets/reference_store_runtime.md.BH0FRgPU.lean.js @@ -1 +1 @@ -import{_ as i,o as e,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"Runtime 与 Lock Screen Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/runtime.md","filePath":"reference/store/runtime.md"}'),n={name:"reference/store/runtime.md"};function l(d,s,r,h,p,k){return e(),t("div",null,[...s[0]||(s[0]=[a("",11)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default}; +import{_ as i,o as e,c as t,a3 as a}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"Runtime 与 Lock Screen Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/runtime.md","filePath":"reference/store/runtime.md"}'),n={name:"reference/store/runtime.md"};function l(r,s,h,d,p,k){return e(),t("div",null,[...s[0]||(s[0]=[a("",11)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default}; diff --git a/docs/assets/reference_store_setting.md.CB2Icw7k.js b/docs/assets/reference_store_setting.md.CzmU2eha.js similarity index 96% rename from docs/assets/reference_store_setting.md.CB2Icw7k.js rename to docs/assets/reference_store_setting.md.CzmU2eha.js index b554f098..25ad3c4b 100644 --- a/docs/assets/reference_store_setting.md.CB2Icw7k.js +++ b/docs/assets/reference_store_setting.md.CzmU2eha.js @@ -10,4 +10,4 @@ import{_ as t,o as s,c as a,a3 as i}from"./chunks/framework.BNdm2jZV.js";const k contentMaxWidth: 1200, }) return { config: getLayoutConfig, apply } -}

Getters 与 Actions · 状态类型 · 默认配置 · 持久化实现

`,11)])])}const g=t(d,[["render",o]]);export{k as __pageData,g as default}; +}

Getters 与 Actions · 状态类型 · 默认配置 · 持久化实现

`,11)])])}const g=t(d,[["render",o]]);export{k as __pageData,g as default}; diff --git a/docs/assets/reference_store_setting.md.CB2Icw7k.lean.js b/docs/assets/reference_store_setting.md.CzmU2eha.lean.js similarity index 100% rename from docs/assets/reference_store_setting.md.CB2Icw7k.lean.js rename to docs/assets/reference_store_setting.md.CzmU2eha.lean.js diff --git a/docs/assets/reference_store_signing.md.453f7xx-.js b/docs/assets/reference_store_signing.md.wgsmw69Q.js similarity index 91% rename from docs/assets/reference_store_signing.md.453f7xx-.js rename to docs/assets/reference_store_signing.md.wgsmw69Q.js index 00c07432..1894a64c 100644 --- a/docs/assets/reference_store_signing.md.453f7xx-.js +++ b/docs/assets/reference_store_signing.md.wgsmw69Q.js @@ -1,8 +1,8 @@ -import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const g=JSON.parse('{"title":"Signing Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/signing.md","filePath":"reference/store/signing.md"}'),n={name:"reference/store/signing.md"};function l(r,s,d,p,h,o){return a(),e("div",null,[...s[0]||(s[0]=[t(`

Signing Store ​

useSigningGetters().getSigningCallback 返回账号信息引用。登录前可能为空对象,成功后主要字段为 name、role、avatar?。角色用于客户端路由判断,后端仍需对每次请求校验会话和权限。

方法行为
signing(form)接收 { name, pwd }。模板演示对非空表单返回固定的 admin 角色,不校验密码。成功解析为 { code: 0, data, message };空表单拒绝,包含 code: 1 和 data: null。
clearSigningCallback(toSigning)清理当前应用登录和菜单缓存、Session Storage,并尝试关闭标签。true 时还会清路由、回到登录页并安排刷新。
logout()调用 clearSigningCallback(true)。

登录演示页面在 signing 成功后写入演示 token 和签入信息;Store 的 signing 动作自身不签发 token。请求插件从 Local Storage 读取 token,Pinia 另外持久化 signingCallback。对接实际身份系统时,把 token 写入、角色刷新与退出清理视为同一条流程。

ts
import { useSigningActions, useSigningGetters } from '@/store'
+import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const g=JSON.parse('{"title":"Signing Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/signing.md","filePath":"reference/store/signing.md"}'),n={name:"reference/store/signing.md"};function l(r,s,p,h,d,o){return a(),e("div",null,[...s[0]||(s[0]=[t(`

Signing Store ​

useSigningGetters().getSigningCallback 返回账号信息引用。登录前可能为空对象,成功后主要字段为 name、role、avatar?。角色用于客户端路由判断,后端仍需对每次请求校验会话和权限。

方法行为
signing(form)接收 { name, pwd }。模板演示对非空表单返回固定的 admin 角色,不校验密码。成功解析为 { code: 0, data, message };空表单拒绝,包含 code: 1 和 data: null。
clearSigningCallback(toSigning)清理当前应用登录和菜单缓存、Session Storage,并尝试关闭标签。true 时还会清路由、回到登录页并安排刷新。
logout()调用 clearSigningCallback(true)。

登录演示页面在 signing 成功后写入演示 token 和签入信息;Store 的 signing 动作自身不签发 token。请求插件从 Local Storage 读取 token,Pinia 另外持久化 signingCallback。对接实际身份系统时,把 token 写入、角色刷新与退出清理视为同一条流程。

ts
import { useSigningActions, useSigningGetters } from '@/store'
 import { computed } from 'vue'
 
 export function useAccountMenu() {
   const { getSigningCallback } = useSigningGetters()
   const { logout } = useSigningActions()
   return { name: computed(() => getSigningCallback.value?.name ?? ''), logout }
-}

退出会清理当前来源的 Session Storage。多个业务共用同一来源时,接入方应明确其清理范围。动作还依赖已经挂载的消息 Provider 和 Router;从用户操作或已初始化的应用流程触发。

Signing 实现 · 类型 · 演示登录 · 权限守卫

`,7)])])}const c=i(n,[["render",l]]);export{g as __pageData,c as default}; +}

退出会清理当前来源的 Session Storage。多个业务共用同一来源时,接入方应明确其清理范围。动作还依赖已经挂载的消息 Provider 和 Router;从用户操作或已初始化的应用流程触发。

Signing 实现 · 类型 · 演示登录 · 权限守卫

`,7)])])}const c=i(n,[["render",l]]);export{g as __pageData,c as default}; diff --git a/docs/assets/reference_store_signing.md.453f7xx-.lean.js b/docs/assets/reference_store_signing.md.wgsmw69Q.lean.js similarity index 85% rename from docs/assets/reference_store_signing.md.453f7xx-.lean.js rename to docs/assets/reference_store_signing.md.wgsmw69Q.lean.js index d015a300..03eb4081 100644 --- a/docs/assets/reference_store_signing.md.453f7xx-.lean.js +++ b/docs/assets/reference_store_signing.md.wgsmw69Q.lean.js @@ -1 +1 @@ -import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const g=JSON.parse('{"title":"Signing Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/signing.md","filePath":"reference/store/signing.md"}'),n={name:"reference/store/signing.md"};function l(r,s,d,p,h,o){return a(),e("div",null,[...s[0]||(s[0]=[t("",7)])])}const c=i(n,[["render",l]]);export{g as __pageData,c as default}; +import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const g=JSON.parse('{"title":"Signing Store","description":"","frontmatter":{},"headers":[],"relativePath":"reference/store/signing.md","filePath":"reference/store/signing.md"}'),n={name:"reference/store/signing.md"};function l(r,s,p,h,d,o){return a(),e("div",null,[...s[0]||(s[0]=[t("",7)])])}const c=i(n,[["render",l]]);export{g as __pageData,c as default}; diff --git a/docs/assets/reference_table-pro.md.DW6Gztpq.js b/docs/assets/reference_table-pro.md.DdZZh1Tr.js similarity index 99% rename from docs/assets/reference_table-pro.md.DW6Gztpq.js rename to docs/assets/reference_table-pro.md.DdZZh1Tr.js index 2977dd4c..7771f6d3 100644 --- a/docs/assets/reference_table-pro.md.DW6Gztpq.js +++ b/docs/assets/reference_table-pro.md.DdZZh1Tr.js @@ -210,4 +210,4 @@ import{u as t,C as p,o as e,c as E,a3 as i,E as a,w as d,k as n,U as r,V as g}fr const renderTable = () => ( <RTablePro ref={table} columns={[{ title: '姓名', key: 'name' }]} data={[]} /> -)

实例还提供 setPage、setPageSize、downloadCsv、print 和 getTableInstance。扩展表格区域可用 title、toolbar、tableFooter、tableAction;错误区域用 error 插槽。

列设置与缓存 ​

每张表使用稳定且唯一的列 key。列设置可以勾选显示、调整根列顺序、固定或启用列宽调整;分组子列跟随根列。使用 columnStateKey 跨刷新保留隐藏列,按账户或租户隔离时将标识纳入 key。缓存不存数据、列定义、顺序、固定位置或列宽。调用方接管列配置可用 v-model:columns,返回包含隐藏列的完整定义。

打印与 CSV ​

默认取当前页可见数据列。打印按当前筛选和排序输出独立表格,不复刻 Vue 单元格、操作区、展开区或合并布局。报表等专用版式通过 printTableOptions.target 指定元素、ref 或 getter;单次调用可传 title 和专用 style。真实纸张输出由浏览器负责。

CSV 的 keepOriginalData 使用当前传给表格的整批数据,远端模式不会自动抓取全部页。列级 allowExport: false 可排除数据;getCsvCell / getCsvHeader 返回原始文本,由组件做 CSV 转义。

TablePro 完整契约 · 六种可运行示例 · v6 的变更

Props、事件和插槽 ​

Naive UI DataTable 的列定义、选择、展开、加载、空态和虚拟滚动继续使用。下面列出模板层的配置与覆盖行为。

配置默认 / 行为
bare默认关。隐藏标题及工具栏,省略 pagination 时不分页;显式搜索、底部插槽仍可使用。
autoHeight默认关;开启时让内部 DataTable 使用 flexHeight,适合有可用高度的布局。
tool默认开,控制打印、密度、全屏、列设置和外观等内置工具。关掉仍可用自定义 toolbar。
title字符串或 VNode。存在 title 插槽时优先渲染插槽。
pagination普通模式缺省开,false 关闭;对象透传 Naive UI Pagination。容器小于 600px 时默认简洁模式,显式 simple 优先。
pageSize默认 10;pagination.pageSize、pagination.defaultPageSize 依次优先。远端初始页读 pagination.defaultPage。
request / params配置 request 时组件管理远端数据。params 深层变化会从第 1 页重查。
search{ key, label, placeholder?, options? }[]。输入只更新草稿,提交才生效。
rowKey默认 row.id ?? row.key,业务数据缺少两者时必须提供稳定键。
columnStateKey缺省不持久化。传稳定标识可记住隐藏列。
downloadCsvTableOptions内置导出默认配置,模板实现使用 fileName、keepOriginalData。
printTableOptions打印配置,支持 target、title、style、formatHeader、formatCell。
contextMenuOptions / onContextMenuClick行右键菜单选项及选择回调 (key, option);回调不直接收到行。先调用业务 rowProps.onContextmenu,可用 preventDefault() 阻止打开。

常用事件有 onRequestError(error)(或 SFC @request-error)、onUpdatePage、onUpdatePageSize、onUpdate:columns。内部分页先变更,再触发外部事件。行选择、排序等依然沿用 DataTable 事件;需要服务端排序时,将条件写入 params。

插槽参数与位置
filters表格上方;接收 { submit(values) },传入字符串或数字键值,提交后回第一页。优先于内置 search。
title / toolbar标题区左侧 / 操作区右侧;bare 下两者隐藏。
notice正常情况下显示自定义提示。
error请求失败时替换 notice,接收 { reload }。未提供则显示错误和重试按钮。
tableFooter / tableActionDataTable 之后的额外区域。
其余插槽转给 Naive UI DataTable,例如空态和加载。

TableProInst 的 reload(resetPage?)、setPage(page)、setPageSize(size) 返回 Promise<void>。请求错误由事件报告并保留旧数据;该 Promise 的完成不能用作业务成功判据。getTableInstance() 可能为 null;print(options?) 返回 Promise<boolean> 表示是否发起预览;downloadCsv(options?) 发起浏览器下载。

远端请求将 params 与已提交筛选合并,后者覆盖同名项,页码字段最后由表格写入。关闭分页时也会删除传入的 page 和 pageSize。total 需要是非负安全整数,data 必须是数组。若筛选或删除数据后当前页超出范围,会收敛到最后一页,并在有结果时重查。

TablePro Props · 远端与分页实现 · 表格面板实现

`,22))])}}});export{B as __pageData,u as default}; +)

实例还提供 setPage、setPageSize、downloadCsv、print 和 getTableInstance。扩展表格区域可用 title、toolbar、tableFooter、tableAction;错误区域用 error 插槽。

列设置与缓存 ​

每张表使用稳定且唯一的列 key。列设置可以勾选显示、调整根列顺序、固定或启用列宽调整;分组子列跟随根列。使用 columnStateKey 跨刷新保留隐藏列,按账户或租户隔离时将标识纳入 key。缓存不存数据、列定义、顺序、固定位置或列宽。调用方接管列配置可用 v-model:columns,返回包含隐藏列的完整定义。

打印与 CSV ​

默认取当前页可见数据列。打印按当前筛选和排序输出独立表格,不复刻 Vue 单元格、操作区、展开区或合并布局。报表等专用版式通过 printTableOptions.target 指定元素、ref 或 getter;单次调用可传 title 和专用 style。真实纸张输出由浏览器负责。

CSV 的 keepOriginalData 使用当前传给表格的整批数据,远端模式不会自动抓取全部页。列级 allowExport: false 可排除数据;getCsvCell / getCsvHeader 返回原始文本,由组件做 CSV 转义。

TablePro 完整契约 · 六种可运行示例 · v6 的变更

Props、事件和插槽 ​

Naive UI DataTable 的列定义、选择、展开、加载、空态和虚拟滚动继续使用。下面列出模板层的配置与覆盖行为。

配置默认 / 行为
bare默认关。隐藏标题及工具栏,省略 pagination 时不分页;显式搜索、底部插槽仍可使用。
autoHeight默认关;开启时让内部 DataTable 使用 flexHeight,适合有可用高度的布局。
tool默认开,控制打印、密度、全屏、列设置和外观等内置工具。关掉仍可用自定义 toolbar。
title字符串或 VNode。存在 title 插槽时优先渲染插槽。
pagination普通模式缺省开,false 关闭;对象透传 Naive UI Pagination。容器小于 600px 时默认简洁模式,显式 simple 优先。
pageSize默认 10;pagination.pageSize、pagination.defaultPageSize 依次优先。远端初始页读 pagination.defaultPage。
request / params配置 request 时组件管理远端数据。params 深层变化会从第 1 页重查。
search{ key, label, placeholder?, options? }[]。输入只更新草稿,提交才生效。
rowKey默认 row.id ?? row.key,业务数据缺少两者时必须提供稳定键。
columnStateKey缺省不持久化。传稳定标识可记住隐藏列。
downloadCsvTableOptions内置导出默认配置,模板实现使用 fileName、keepOriginalData。
printTableOptions打印配置,支持 target、title、style、formatHeader、formatCell。
contextMenuOptions / onContextMenuClick行右键菜单选项及选择回调 (key, option);回调不直接收到行。先调用业务 rowProps.onContextmenu,可用 preventDefault() 阻止打开。

常用事件有 onRequestError(error)(或 SFC @request-error)、onUpdatePage、onUpdatePageSize、onUpdate:columns。内部分页先变更,再触发外部事件。行选择、排序等依然沿用 DataTable 事件;需要服务端排序时,将条件写入 params。

插槽参数与位置
filters表格上方;接收 { submit(values) },传入字符串或数字键值,提交后回第一页。优先于内置 search。
title / toolbar标题区左侧 / 操作区右侧;bare 下两者隐藏。
notice正常情况下显示自定义提示。
error请求失败时替换 notice,接收 { reload }。未提供则显示错误和重试按钮。
tableFooter / tableActionDataTable 之后的额外区域。
其余插槽转给 Naive UI DataTable,例如空态和加载。

TableProInst 的 reload(resetPage?)、setPage(page)、setPageSize(size) 返回 Promise<void>。请求错误由事件报告并保留旧数据;该 Promise 的完成不能用作业务成功判据。getTableInstance() 可能为 null;print(options?) 返回 Promise<boolean> 表示是否发起预览;downloadCsv(options?) 发起浏览器下载。

远端请求将 params 与已提交筛选合并,后者覆盖同名项,页码字段最后由表格写入。关闭分页时也会删除传入的 page 和 pageSize。total 需要是非负安全整数,data 必须是数组。若筛选或删除数据后当前页超出范围,会收敛到最后一页,并在有结果时重查。

TablePro Props · 远端与分页实现 · 表格面板实现

`,22))])}}});export{B as __pageData,u as default}; diff --git a/docs/assets/reference_table-pro.md.DW6Gztpq.lean.js b/docs/assets/reference_table-pro.md.DdZZh1Tr.lean.js similarity index 100% rename from docs/assets/reference_table-pro.md.DW6Gztpq.lean.js rename to docs/assets/reference_table-pro.md.DdZZh1Tr.lean.js diff --git a/docs/assets/reference_utils.md.CPo2FGYU.js b/docs/assets/reference_utils.md.B6bCkjBM.js similarity index 87% rename from docs/assets/reference_utils.md.CPo2FGYU.js rename to docs/assets/reference_utils.md.B6bCkjBM.js index b1ef5ed8..776fd50b 100644 --- a/docs/assets/reference_utils.md.CPo2FGYU.js +++ b/docs/assets/reference_utils.md.B6bCkjBM.js @@ -1 +1 @@ -import{_ as t,o as a,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const u=JSON.parse('{"title":"工具函数","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils.md","filePath":"reference/utils.md"}'),o={name:"reference/utils.md"};function s(i,e,c,l,n,f){return a(),r("div",null,[...e[0]||(e[0]=[d('

工具函数 ​

@/utils 汇总模板公开工具。应用初始化或底层模块可以按职责从 @/utils/core、@/utils/cache、@/utils/files 等入口导入,避免加载无关依赖。历史 basic.ts 和 c/ 仍作为转发入口。

主题API
基础、日期与数值类型判断、PromiseLike、随机标识、错误处理、对象更新、日期范围、定点运算
缓存与兼容加密Local / Session Storage、前缀、历史 AES JSON
Vue 与浏览器ref / DOM 解包、样式、查询、下载、截图打印、侧栏定位

下载和打印需要在浏览器执行,响应式 DOM 工具应在 Vue 作用域内创建。缓存和文件 API 的泛型不校验外部数据结构;跨信任边界时先验证输入。

公开导出 · 实现与回归索引

',5)])])}const p=t(o,[["render",s]]);export{u as __pageData,p as default}; +import{_ as t,o as a,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const u=JSON.parse('{"title":"工具函数","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils.md","filePath":"reference/utils.md"}'),o={name:"reference/utils.md"};function c(s,e,i,l,f,n){return a(),r("div",null,[...e[0]||(e[0]=[d('

工具函数 ​

@/utils 汇总模板公开工具。应用初始化或底层模块可以按职责从 @/utils/core、@/utils/cache、@/utils/files 等入口导入,避免加载无关依赖。历史 basic.ts 和 c/ 仍作为转发入口。

主题API
基础、日期与数值类型判断、PromiseLike、随机标识、错误处理、对象更新、日期范围、定点运算
缓存与兼容加密Local / Session Storage、前缀、历史 AES JSON
Vue 与浏览器ref / DOM 解包、样式、查询、下载、截图打印、侧栏定位

下载和打印需要在浏览器执行,响应式 DOM 工具应在 Vue 作用域内创建。缓存和文件 API 的泛型不校验外部数据结构;跨信任边界时先验证输入。

公开导出 · 实现与回归索引

',5)])])}const p=t(o,[["render",c]]);export{u as __pageData,p as default}; diff --git a/docs/assets/reference_utils.md.CPo2FGYU.lean.js b/docs/assets/reference_utils.md.B6bCkjBM.lean.js similarity index 68% rename from docs/assets/reference_utils.md.CPo2FGYU.lean.js rename to docs/assets/reference_utils.md.B6bCkjBM.lean.js index 05e5a0a9..7d7e7d69 100644 --- a/docs/assets/reference_utils.md.CPo2FGYU.lean.js +++ b/docs/assets/reference_utils.md.B6bCkjBM.lean.js @@ -1 +1 @@ -import{_ as t,o as a,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const u=JSON.parse('{"title":"工具函数","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils.md","filePath":"reference/utils.md"}'),o={name:"reference/utils.md"};function s(i,e,c,l,n,f){return a(),r("div",null,[...e[0]||(e[0]=[d("",5)])])}const p=t(o,[["render",s]]);export{u as __pageData,p as default}; +import{_ as t,o as a,c as r,a3 as d}from"./chunks/framework.BNdm2jZV.js";const u=JSON.parse('{"title":"工具函数","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils.md","filePath":"reference/utils.md"}'),o={name:"reference/utils.md"};function c(s,e,i,l,f,n){return a(),r("div",null,[...e[0]||(e[0]=[d("",5)])])}const p=t(o,[["render",c]]);export{u as __pageData,p as default}; diff --git a/docs/assets/reference_utils_browser.md.mqqbsAE7.js b/docs/assets/reference_utils_browser.md.JR-xHE7d.js similarity index 96% rename from docs/assets/reference_utils_browser.md.mqqbsAE7.js rename to docs/assets/reference_utils_browser.md.JR-xHE7d.js index f4745d98..26051fe1 100644 --- a/docs/assets/reference_utils_browser.md.mqqbsAE7.js +++ b/docs/assets/reference_utils_browser.md.JR-xHE7d.js @@ -1,4 +1,4 @@ -import{_ as t,o as a,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"Vue 与浏览器工具","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/browser.md","filePath":"reference/utils/browser.md"}'),i={name:"reference/utils/browser.md"};function r(o,e,l,n,h,c){return a(),s("div",null,[...e[0]||(e[0]=[d(`

Vue 与浏览器工具 ​

Vue 目标解析 ​

BasicTarget<T> 可为元素、组件实例、ref、getter 或空值,unrefElement(target, fallback?) 在调用时解包;组件优先返回 $el。多根组件的 $el 未必是可操作的元素。截图、全屏、样式操作请优先绑定明确的原生 DOM ref。

工具行为
call(fnOrFns, ...args)调用一个函数或按顺序调用回调数组,透传参数。
renderNode(value, { defaultElement }?)规范化成渲染函数。仅 null 或 undefined 用回退,0 和空字符串保留。
effectDispose(cleanup)有当前 effect scope 时登记清理并返回 true,否则返回 false,需调用方自行释放。
watchEffectWithTarget(effect, options?)对 Vue watchEffect 的兼容入口,返回停止句柄;在有效作用域创建时会随作用域停止。

DOM、样式和尺寸 ​

API行为
setClass(target, names) / removeClass(target, names)作用于当前和后续替换的目标。支持空白分隔字符串或数组;移除时 removeAllClass 清空 class。
hasClass(target, names)返回响应式布尔值,任一完整类名匹配即为真。只随目标引用更新,外部改 class 属性本身不会触发重算。
setStyle(target, styles)支持样式对象、声明字符串或字符串数组,保留其他行内样式。支持 camelCase、CSS 自定义属性与 !important。
removeStyle(target, names)按 CSS 名称或 camelCase 删除行内样式。
autoPrefixStyle(name)返回原属性和历史前缀名的兼容映射,不执行 DOM 操作。
completeSize(value, unit = 'px')数字、纯数字字符串补单位,保留百分比、CSS 关键字和表达式。
colorToRgba(color, alpha = 1, fallback?)支持逗号形式 RGB/HSL 与常见 Hex。带透明度的 Hex 保留其透明度,未知格式回退到指定值或原字符串。
queryElements(selector, { defaultElement }?)返回 DOM 元素数组。attr:data-id 等同于属性选择器。无匹配返回空数组,空或非法选择器无回退时返回 null。
positionSelectedMenuItem()将已渲染且超出可视区的当前菜单滚入视野。调用前展开父级并等待 DOM 渲染。

类名与样式函数内部监听目标变化,在组件 setup 或 effect scope 内创建。SSR 下访问 document、window 的方法应推迟到挂载后。

文件、下载和打印 ​

API行为
fileToBase64(file)返回带 MIME 的 Data URL Promise,读取错误或中止会拒绝。
arrayBufferToBase64Image(buffer)把 PNG 字节加上 PNG Data URL 前缀,不转换其他图像格式。
downloadBase64File(url, fileName)以临时链接触发下载,清理链接。
downloadAnyFile(data, fileName)接收 Data URL、Blob、File、ArrayBuffer。二进制使用临时对象 URL;Promise 完成表示已发起下载。
printDom(target, { printOptions?, domToImageOptions? })先将 DOM 截成 JPEG,再发起打印预览。返回 Promise<boolean>;失败记录错误并返回 false,若存在全局 Loading Bar 会同步状态。
ts
import { downloadAnyFile, fileToBase64 } from '@/utils'
+import{_ as t,o as a,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"Vue 与浏览器工具","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/browser.md","filePath":"reference/utils/browser.md"}'),i={name:"reference/utils/browser.md"};function r(o,e,l,n,c,h){return a(),s("div",null,[...e[0]||(e[0]=[d(`

Vue 与浏览器工具 ​

Vue 目标解析 ​

BasicTarget<T> 可为元素、组件实例、ref、getter 或空值,unrefElement(target, fallback?) 在调用时解包;组件优先返回 $el。多根组件的 $el 未必是可操作的元素。截图、全屏、样式操作请优先绑定明确的原生 DOM ref。

工具行为
call(fnOrFns, ...args)调用一个函数或按顺序调用回调数组,透传参数。
renderNode(value, { defaultElement }?)规范化成渲染函数。仅 null 或 undefined 用回退,0 和空字符串保留。
effectDispose(cleanup)有当前 effect scope 时登记清理并返回 true,否则返回 false,需调用方自行释放。
watchEffectWithTarget(effect, options?)对 Vue watchEffect 的兼容入口,返回停止句柄;在有效作用域创建时会随作用域停止。

DOM、样式和尺寸 ​

API行为
setClass(target, names) / removeClass(target, names)作用于当前和后续替换的目标。支持空白分隔字符串或数组;移除时 removeAllClass 清空 class。
hasClass(target, names)返回响应式布尔值,任一完整类名匹配即为真。只随目标引用更新,外部改 class 属性本身不会触发重算。
setStyle(target, styles)支持样式对象、声明字符串或字符串数组,保留其他行内样式。支持 camelCase、CSS 自定义属性与 !important。
removeStyle(target, names)按 CSS 名称或 camelCase 删除行内样式。
autoPrefixStyle(name)返回原属性和历史前缀名的兼容映射,不执行 DOM 操作。
completeSize(value, unit = 'px')数字、纯数字字符串补单位,保留百分比、CSS 关键字和表达式。
colorToRgba(color, alpha = 1, fallback?)支持逗号形式 RGB/HSL 与常见 Hex。带透明度的 Hex 保留其透明度,未知格式回退到指定值或原字符串。
queryElements(selector, { defaultElement }?)返回 DOM 元素数组。attr:data-id 等同于属性选择器。无匹配返回空数组,空或非法选择器无回退时返回 null。
positionSelectedMenuItem()将已渲染且超出可视区的当前菜单滚入视野。调用前展开父级并等待 DOM 渲染。

类名与样式函数内部监听目标变化,在组件 setup 或 effect scope 内创建。SSR 下访问 document、window 的方法应推迟到挂载后。

文件、下载和打印 ​

API行为
fileToBase64(file)返回带 MIME 的 Data URL Promise,读取错误或中止会拒绝。
arrayBufferToBase64Image(buffer)把 PNG 字节加上 PNG Data URL 前缀,不转换其他图像格式。
downloadBase64File(url, fileName)以临时链接触发下载,清理链接。
downloadAnyFile(data, fileName)接收 Data URL、Blob、File、ArrayBuffer。二进制使用临时对象 URL;Promise 完成表示已发起下载。
printDom(target, { printOptions?, domToImageOptions? })先将 DOM 截成 JPEG,再发起打印预览。返回 Promise<boolean>;失败记录错误并返回 false,若存在全局 Loading Bar 会同步状态。
ts
import { downloadAnyFile, fileToBase64 } from '@/utils'
 
 export const previewFile = (file: File) => fileToBase64(file)
-export const downloadReport = (pdf: Blob) => downloadAnyFile(pdf, 'report.pdf')

DOM 工具 · 文件工具 · Vue 工具 · 截图与打印 Hooks

`,11)])])}const f=t(i,[["render",r]]);export{k as __pageData,f as default}; +export const downloadReport = (pdf: Blob) => downloadAnyFile(pdf, 'report.pdf')

DOM 工具 · 文件工具 · Vue 工具 · 截图与打印 Hooks

`,11)])])}const f=t(i,[["render",r]]);export{k as __pageData,f as default}; diff --git a/docs/assets/reference_utils_browser.md.mqqbsAE7.lean.js b/docs/assets/reference_utils_browser.md.JR-xHE7d.lean.js similarity index 71% rename from docs/assets/reference_utils_browser.md.mqqbsAE7.lean.js rename to docs/assets/reference_utils_browser.md.JR-xHE7d.lean.js index 38f8e7a5..12805450 100644 --- a/docs/assets/reference_utils_browser.md.mqqbsAE7.lean.js +++ b/docs/assets/reference_utils_browser.md.JR-xHE7d.lean.js @@ -1 +1 @@ -import{_ as t,o as a,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"Vue 与浏览器工具","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/browser.md","filePath":"reference/utils/browser.md"}'),i={name:"reference/utils/browser.md"};function r(o,e,l,n,h,c){return a(),s("div",null,[...e[0]||(e[0]=[d("",11)])])}const f=t(i,[["render",r]]);export{k as __pageData,f as default}; +import{_ as t,o as a,c as s,a3 as d}from"./chunks/framework.BNdm2jZV.js";const k=JSON.parse('{"title":"Vue 与浏览器工具","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/browser.md","filePath":"reference/utils/browser.md"}'),i={name:"reference/utils/browser.md"};function r(o,e,l,n,c,h){return a(),s("div",null,[...e[0]||(e[0]=[d("",11)])])}const f=t(i,[["render",r]]);export{k as __pageData,f as default}; diff --git a/docs/assets/reference_utils_core.md.D6K4f3-H.js b/docs/assets/reference_utils_core.md.CW4tagj9.js similarity index 99% rename from docs/assets/reference_utils_core.md.D6K4f3-H.js rename to docs/assets/reference_utils_core.md.CW4tagj9.js index f8bfe293..61bf5d4d 100644 --- a/docs/assets/reference_utils_core.md.D6K4f3-H.js +++ b/docs/assets/reference_utils_core.md.CW4tagj9.js @@ -94,4 +94,4 @@ import{d as x,a4 as f,o as F,c as u,j as k,k as g,t as o,a5 as m,a6 as v,a as D, precision: 2, type: 'string', }) -export const parts = distribute(10, 3, { precision: 2, type: 'string' })

分摊或货币结算由业务明确小数位和舍入规则。保留字符串或整数分值跨接口传输可避免展示时的二进制浮点误差。

基础函数 · 精度实现 · 日期选择器辅助

`,6))]))}});export{Q as __pageData,Y as default}; +export const parts = distribute(10, 3, { precision: 2, type: 'string' })

分摊或货币结算由业务明确小数位和舍入规则。保留字符串或整数分值跨接口传输可避免展示时的二进制浮点误差。

基础函数 · 精度实现 · 日期选择器辅助

`,6))]))}});export{Q as __pageData,Y as default}; diff --git a/docs/assets/reference_utils_core.md.D6K4f3-H.lean.js b/docs/assets/reference_utils_core.md.CW4tagj9.lean.js similarity index 100% rename from docs/assets/reference_utils_core.md.D6K4f3-H.lean.js rename to docs/assets/reference_utils_core.md.CW4tagj9.lean.js diff --git a/docs/assets/reference_utils_storage.md.aIMEPocl.js b/docs/assets/reference_utils_storage.md.CIn4_Wqq.js similarity index 95% rename from docs/assets/reference_utils_storage.md.aIMEPocl.js rename to docs/assets/reference_utils_storage.md.CIn4_Wqq.js index 22976312..d5f06d3d 100644 --- a/docs/assets/reference_utils_storage.md.aIMEPocl.js +++ b/docs/assets/reference_utils_storage.md.CIn4_Wqq.js @@ -1,4 +1,4 @@ -import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"缓存与兼容加密","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/storage.md","filePath":"reference/utils/storage.md"}'),n={name:"reference/utils/storage.md"};function r(l,s,h,p,d,k){return a(),e("div",null,[...s[0]||(s[0]=[t(`

缓存与兼容加密 ​

Web Storage ​

默认使用 sessionStorage,传 'localStorage' 跨刷新保存。所有读写值按 JSON 序列化。类型参数仅影响 TypeScript,不能确认缓存格式。

API行为
setStorage(key, value, storageType?, options?)写入可序列化值,空键、循环引用或浏览器拒绝写入时记录错误。
getStorage<T>(key, storageType?, options?)缺键、损坏或不可读时返回 options.defaultValue 或 null;显式 JSON null 仍返回 null。
hasStorage(key, storageType?, options?)检查键存在,存储不可访问时返回 false,不验证 JSON 内容。
removeStorage(key, storageType?, options?)删除单键。也可传 __all__、__all_sessionStorage__ 或 __all_localStorage__ 做批量删除。
prefixCacheKey(key, { customPrefix }?)拼接自定义前缀或默认 APP_CATCH_KEY_PREFIX,分隔符需包含在前缀内。

缓存方法只有在 options.prefix: true 时才调用前缀函数,prefixKey 覆盖默认值。启用非空前缀时,批量删除只影响匹配的键;空前缀会清整个对应存储区域。读写和删除使用同一套前缀选项。Pinia 插件使用自己的持久化配置,修改工具前缀不会迁移 Pinia 的历史数据。

ts
import { getStorage, removeStorage, setStorage } from '@/utils'
+import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"缓存与兼容加密","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/storage.md","filePath":"reference/utils/storage.md"}'),n={name:"reference/utils/storage.md"};function r(l,s,h,p,k,d){return a(),e("div",null,[...s[0]||(s[0]=[t(`

缓存与兼容加密 ​

Web Storage ​

默认使用 sessionStorage,传 'localStorage' 跨刷新保存。所有读写值按 JSON 序列化。类型参数仅影响 TypeScript,不能确认缓存格式。

API行为
setStorage(key, value, storageType?, options?)写入可序列化值,空键、循环引用或浏览器拒绝写入时记录错误。
getStorage<T>(key, storageType?, options?)缺键、损坏或不可读时返回 options.defaultValue 或 null;显式 JSON null 仍返回 null。
hasStorage(key, storageType?, options?)检查键存在,存储不可访问时返回 false,不验证 JSON 内容。
removeStorage(key, storageType?, options?)删除单键。也可传 __all__、__all_sessionStorage__ 或 __all_localStorage__ 做批量删除。
prefixCacheKey(key, { customPrefix }?)拼接自定义前缀或默认 APP_CATCH_KEY_PREFIX,分隔符需包含在前缀内。

缓存方法只有在 options.prefix: true 时才调用前缀函数,prefixKey 覆盖默认值。启用非空前缀时,批量删除只影响匹配的键;空前缀会清整个对应存储区域。读写和删除使用同一套前缀选项。Pinia 插件使用自己的持久化配置,修改工具前缀不会迁移 Pinia 的历史数据。

ts
import { getStorage, removeStorage, setStorage } from '@/utils'
 
 const options = { prefix: true, prefixKey: 'inventory:' }
 export function saveOrderFilter(status: string) {
@@ -7,4 +7,4 @@ import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c
 export const readOrderFilter = () =>
   getStorage<{ status: string }>('order-filter', 'sessionStorage', options)
 export const clearOrderFilter = () =>
-  removeStorage('order-filter', 'sessionStorage', options)

兼容 AES JSON ​

encrypt(data, key?) 返回 JSON 密文,decrypt(ciphertext, key?) 解码。可用字符串口令或 CryptoJS WordArray,同一数据须使用同类型和内容的 key。字符串沿用 OpenSSL 兼容格式,原始密钥使用随机 IV,字符串序列化为 IV:密文。错误密文或密钥会记录错误并返回 undefined,无法 JSON 序列化的输入会使加密抛错。

CRYPTO_KEY 是应用公开的历史兼容常量。这个工具用于读取既有本地数据(如演示锁屏),不能保护服务端密钥或替代认证。迁移格式时先保留对历史密文的读取能力。

缓存实现 · 加密 · 解密

`,10)])])}const g=i(n,[["render",r]]);export{c as __pageData,g as default}; + removeStorage('order-filter', 'sessionStorage', options)

兼容 AES JSON ​

encrypt(data, key?) 返回 JSON 密文,decrypt(ciphertext, key?) 解码。可用字符串口令或 CryptoJS WordArray,同一数据须使用同类型和内容的 key。字符串沿用 OpenSSL 兼容格式,原始密钥使用随机 IV,字符串序列化为 IV:密文。错误密文或密钥会记录错误并返回 undefined,无法 JSON 序列化的输入会使加密抛错。

CRYPTO_KEY 是应用公开的历史兼容常量。这个工具用于读取既有本地数据(如演示锁屏),不能保护服务端密钥或替代认证。迁移格式时先保留对历史密文的读取能力。

缓存实现 · 加密 · 解密

`,10)])])}const g=i(n,[["render",r]]);export{c as __pageData,g as default}; diff --git a/docs/assets/reference_utils_storage.md.aIMEPocl.lean.js b/docs/assets/reference_utils_storage.md.CIn4_Wqq.lean.js similarity index 85% rename from docs/assets/reference_utils_storage.md.aIMEPocl.lean.js rename to docs/assets/reference_utils_storage.md.CIn4_Wqq.lean.js index c091bacd..61f97113 100644 --- a/docs/assets/reference_utils_storage.md.aIMEPocl.lean.js +++ b/docs/assets/reference_utils_storage.md.CIn4_Wqq.lean.js @@ -1 +1 @@ -import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"缓存与兼容加密","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/storage.md","filePath":"reference/utils/storage.md"}'),n={name:"reference/utils/storage.md"};function r(l,s,h,p,d,k){return a(),e("div",null,[...s[0]||(s[0]=[t("",10)])])}const g=i(n,[["render",r]]);export{c as __pageData,g as default}; +import{_ as i,o as a,c as e,a3 as t}from"./chunks/framework.BNdm2jZV.js";const c=JSON.parse('{"title":"缓存与兼容加密","description":"","frontmatter":{},"headers":[],"relativePath":"reference/utils/storage.md","filePath":"reference/utils/storage.md"}'),n={name:"reference/utils/storage.md"};function r(l,s,h,p,k,d){return a(),e("div",null,[...s[0]||(s[0]=[t("",10)])])}const g=i(n,[["render",r]]);export{c as __pageData,g as default}; diff --git a/docs/guide/appearance.html b/docs/guide/appearance.html index 2231dcb0..17a3d3d7 100644 --- a/docs/guide/appearance.html +++ b/docs/guide/appearance.html @@ -13,7 +13,7 @@ - + @@ -27,8 +27,8 @@ const orderLabel = computed(() => t('Orders')) const { updateLocale } = useSettingActions() -updateLocale('en-US')

在需要随语言更新的 UI 中,于渲染函数或 computed 内调用 t。通过 updateLocale 切换应用语言,以同步日期和组件库。

语言包约定 · 主题配置

- +updateLocale('en-US')

在需要随语言更新的 UI 中,于渲染函数或 computed 内调用 t。通过 updateLocale 切换应用语言,以同步日期和组件库。

语言包约定 · 主题配置

+ \ No newline at end of file diff --git a/docs/guide/architecture.html b/docs/guide/architecture.html index d0bc049a..85070ec6 100644 --- a/docs/guide/architecture.html +++ b/docs/guide/architecture.html @@ -13,7 +13,7 @@ - + @@ -26,8 +26,8 @@ ├── packages/ # 两个应用共用的八个私有 workspace 包 ├── harness/ # 任务入口与验收命令 └── pnpm-lock.yaml # 工作区共用锁文件

各包负责什么 ​

包公开能力与使用方式
@ray-template/utils精度运算、对象和类型处理、文件工具、接收存储实现的 JSON 工具。精度运算从 /precision 导入。
@ray-template/composables设备宽度、元素全屏、截图、打印和其他独立 Vue Hooks,例如 /useElementFullscreen。
@ray-template/directives复制、防抖、节流、省略、水波纹等指令,可单独导入或统一注册。
@ray-template/iconsSVG 资源、图标名称类型和资源查找。组件和路由配置使用同一套名称。
@ray-template/ui组件、样式、主题与类型。通过 /table-pro、/barcode 或 /chart 等入口按需导入。
@ray-template/httpcreateHttpClient 创建实例与独立的取消器。宿主提供地址、请求头和拦截器。
@ray-template/routing路由 Schema、配置校验、路由展开和菜单处理。宿主提供页面注册表。
@ray-template/admin-shell布局、顶部导航、标签、设置和路由过渡。宿主提供菜单、选中状态、偏好和内容。

共享包通过 package.json 的 exports 暴露入口,只依赖自己声明的包。pnpm packages:check 检查跨包导入和依赖循环。应用的登录、路由守卫、业务 API、Pinia 实例和语言加载由 apps/admin 负责。

Ray Admin 怎么组装 ​

apps/admin/src/main.ts 安装 Pinia、国际化、路由和指令。应用入口为组件提供主题、翻译、图标和列偏好存储,路由层把注册的页面交给后台外壳。登录、角色和会话由应用处理,真实业务的服务端负责接口授权。

以 TablePro 为例,组件负责展示、搜索、分页与请求状态。后台传入业务查询,文档传入可取消的模拟查询。两边从同一个入口导入:

ts
import { RTablePro } from '@ray-template/ui/table-pro'
-import { add } from '@ray-template/utils/precision'

后台应用入口 · 应用组装 · 完整工程地图

文档怎样运行组件 ​

apps/docs/examples 保存实际运行的 Vue 示例。Markdown 引用同一个文件展示源码。TablePro 使用本地数据或可控的模拟请求;布局实验在独立预览框内运行,使用自己的内存路由和主题状态。

精度运算 · RBarcode · TablePro · 布局实验

构建与部署 ​

pnpm dev 启动后台,pnpm docs:dev 启动文档。pnpm build 输出后台,pnpm docs:build 输出文档,pnpm pages:build 组装两者到 dist/pages。官方部署地址分别是 /ray-template/ 和 /ray-template/docs/。构建与部署指南

如果当前项目基于 v5,请先看版本分界,再决定是否接入 v6。

- +import { add } from '@ray-template/utils/precision'

后台应用入口 · 应用组装 · 完整工程地图

文档怎样运行组件 ​

apps/docs/examples 保存实际运行的 Vue 示例。Markdown 引用同一个文件展示源码。TablePro 使用本地数据或可控的模拟请求;布局实验在独立预览框内运行,使用自己的内存路由和主题状态。

精度运算 · RBarcode · TablePro · 布局实验

构建与部署 ​

pnpm dev 启动后台,pnpm docs:dev 启动文档。pnpm build 输出后台,pnpm docs:build 输出文档,pnpm pages:build 组装两者到 dist/pages。官方部署地址分别是 /ray-template/ 和 /ray-template/docs/。构建与部署指南

如果当前项目基于 v5,请先看版本分界,再决定是否接入 v6。

+ \ No newline at end of file diff --git a/docs/guide/first-page.html b/docs/guide/first-page.html index f9a5617c..9a73ad7d 100644 --- a/docs/guide/first-page.html +++ b/docs/guide/first-page.html @@ -13,7 +13,7 @@ - + @@ -52,8 +52,8 @@ }, } -export default orders

在 apps/admin/src/locales/lang/zh-CN/menu.json 和 apps/admin/src/locales/lang/en-US/menu.json 分别加入 Orders 的翻译。重新加载工作台,从菜单打开订单页,再刷新一次,确认路由可恢复。

接入 API ​

在 apps/admin/src/api 写订单请求函数,将 TablePro 的分页、筛选条件映射成后端的字段,并把 data 替换成 request={loadOrders}。接口需返回当前页数据和筛选后的总数。参照远端 TablePro 示例接入排序、取消和错误重试。

下一步:TablePro · 路由与权限 · 接口约定

- +export default orders

在 apps/admin/src/locales/lang/zh-CN/menu.json 和 apps/admin/src/locales/lang/en-US/menu.json 分别加入 Orders 的翻译。重新加载工作台,从菜单打开订单页,再刷新一次,确认路由可恢复。

接入 API ​

在 apps/admin/src/api 写订单请求函数,将 TablePro 的分页、筛选条件映射成后端的字段,并把 data 替换成 request={loadOrders}。接口需返回当前页数据和筛选后的总数。参照远端 TablePro 示例接入排序、取消和错误重试。

下一步:TablePro · 路由与权限 · 接口约定

+ \ No newline at end of file diff --git a/docs/guide/layout.html b/docs/guide/layout.html index cc46c73a..79222f05 100644 --- a/docs/guide/layout.html +++ b/docs/guide/layout.html @@ -13,7 +13,7 @@ - + @@ -217,8 +217,8 @@ contentWidth: 'fixed', contentMaxWidth: 1200, contentPadding: 16, -})

最大宽度范围是 640–2560px,间距为 0–48px。顶栏和页脚可固定或随内容滚动。旧设置补齐默认值,布局恢复默认只重置 layoutConfig。

替换布局区域 ​

RLayout 提供 header、sidebar、tabs、footer 和 default 插槽。模式和显隐开关仍生效,例如顶部导航模式不会渲染侧栏。替换 default 内容时,需要自行接入所需的路由缓存和请求取消。

状态放在哪里 ​

状态入口刷新后的行为
加载、移动抽屉、内容最大化、重载useRuntimeGetters / useRuntimeActions运行态,不持久化
布局、主题、语言等偏好useSettingGetters / useSettingActions沿用设置缓存;旧值补默认配置
锁屏锁屏 Store保留历史布尔值格式和跨标签同步

新增共享状态按职责放到 apps/admin/src/store/modules,对外用 Store hooks。持久化使用 pick / omit 选择字段;检查历史 key 和序列化格式再变更。

布局说明与插槽 · 状态实现与持久化

更细的状态字段与更新动作见 Setting Store、Runtime Store 和 布局 Hooks。

- +})

最大宽度范围是 640–2560px,间距为 0–48px。顶栏和页脚可固定或随内容滚动。旧设置补齐默认值,布局恢复默认只重置 layoutConfig。

替换布局区域 ​

RLayout 提供 header、sidebar、tabs、footer 和 default 插槽。模式和显隐开关仍生效,例如顶部导航模式不会渲染侧栏。替换 default 内容时,需要自行接入所需的路由缓存和请求取消。

状态放在哪里 ​

状态入口刷新后的行为
加载、移动抽屉、内容最大化、重载useRuntimeGetters / useRuntimeActions运行态,不持久化
布局、主题、语言等偏好useSettingGetters / useSettingActions沿用设置缓存;旧值补默认配置
锁屏锁屏 Store保留历史布尔值格式和跨标签同步

新增共享状态按职责放到 apps/admin/src/store/modules,对外用 Store hooks。持久化使用 pick / omit 选择字段;检查历史 key 和序列化格式再变更。

布局说明与插槽 · 状态实现与持久化

更细的状态字段与更新动作见 Setting Store、Runtime Store 和 布局 Hooks。

+ \ No newline at end of file diff --git a/docs/guide/requests.html b/docs/guide/requests.html index bb307d96..1338f2ac 100644 --- a/docs/guide/requests.html +++ b/docs/guide/requests.html @@ -13,7 +13,7 @@ - + @@ -37,15 +37,15 @@ signal, cancelConfig: { cancel: false }, }) -}

默认取消器按 URL、方法、参数和请求体识别重复请求,默认布局在路由更新前取消受管理的请求。示例将信号交给 TablePro 管理,所以关闭模板的默认注入;否则默认取消器会替换调用方传入的 signal。后台任务禁用默认取消后,需要自行管理生命周期。

配置与拦截器 ​

  • apps/admin/src/app-config/request-config.ts:统一修改 baseURL、超时和默认 headers。
  • apps/admin/src/axios/axios-interceptor/{request,response}/provider.ts:登记插件;请求头、鉴权响应等放入对应的 plugins。
  • useRequest 包装同一请求实例,放在有效的 Vue effect 作用域内使用。

从演示切到真实服务 ​

开发时人员列表请求 GET /api/list,Vite Mock 服务在站点根路径处理接口。静态演示改用 apps/admin/src/demo-data/people.ts 的本地数据,能在 GitHub Pages 上独立运行。业务项目应换成自己的 API 和会话,按环境配置开发代理或服务端反代;浏览器端 VITE_* 变量不能放密钥。

请求实例 · 演示接口

useRequest 与手动执行 ​

useRequest<Response>(fetchOptions, options?) 从 @/axios 导入,使用模板 Axios 实例执行同一份配置。options 传给 vue-hooks-plus,例如 manual、成功和失败回调。返回的数据、错误、加载状态与运行方法来自上游 Hook。应用在 setup 或有效 effect scope 内创建它。

ts
import { useRequest } from '@/axios'
+}

默认取消器按 URL、方法、参数和请求体识别重复请求,默认布局在路由更新前取消受管理的请求。示例将信号交给 TablePro 管理,所以关闭模板的默认注入;否则默认取消器会替换调用方传入的 signal。后台任务禁用默认取消后,需要自行管理生命周期。

配置与拦截器 ​

  • apps/admin/src/app-config/request-config.ts:统一修改 baseURL、超时和默认 headers。
  • apps/admin/src/axios/axios-interceptor/{request,response}/provider.ts:登记插件;请求头、鉴权响应等放入对应的 plugins。
  • useRequest 包装同一请求实例,放在有效的 Vue effect 作用域内使用。

从演示切到真实服务 ​

开发时人员列表请求 GET /api/list,Vite Mock 服务在站点根路径处理接口。静态演示改用 apps/admin/src/demo-data/people.ts 的本地数据,能在 GitHub Pages 上独立运行。业务项目应换成自己的 API 和会话,按环境配置开发代理或服务端反代;浏览器端 VITE_* 变量不能放密钥。

请求实例 · 演示接口

useRequest 与手动执行 ​

useRequest<Response>(fetchOptions, options?) 从 @/axios 导入,使用模板 Axios 实例执行同一份配置。options 传给 vue-hooks-plus,例如 manual、成功和失败回调。返回的数据、错误、加载状态与运行方法来自上游 Hook。应用在 setup 或有效 effect scope 内创建它。

ts
import { useRequest } from '@/axios'
 
 export function useOrderSummary() {
   return useRequest<{ total: number }>(
     { url: '/api/orders/summary', method: 'get' },
     { manual: true },
   )
-}

调用 run() 触发手动加载。这个包装的请求函数从 fetchOptions 读取配置,不会把 run(...) 参数自动映射成请求体或 query;需要动态 service 时用同入口导出的 useHookPlusRequest(service, options?),在 service 中调用 request。错误提示由业务配置或响应拦截器负责,当前默认拦截器不消费 responseSuccessMessage / responseErrorMessage 两个类型字段。

默认头注入包含演示 X-TOKEN 与示例头。对接真实接口时在请求插件中校验目标来源,并按后端约定设置认证头。模板 Axios 实例用来请求自己的业务接口;第三方地址使用明确配置的独立客户端。

请求 Hook · 请求配置类型 · 头注入实现

- +}

调用 run() 触发手动加载。这个包装的请求函数从 fetchOptions 读取配置,不会把 run(...) 参数自动映射成请求体或 query;需要动态 service 时用同入口导出的 useHookPlusRequest(service, options?),在 service 中调用 request。错误提示由业务配置或响应拦截器负责,当前默认拦截器不消费 responseSuccessMessage / responseErrorMessage 两个类型字段。

默认头注入包含演示 X-TOKEN 与示例头。对接真实接口时在请求插件中校验目标来源,并按后端约定设置认证头。模板 Axios 实例用来请求自己的业务接口;第三方地址使用明确配置的独立客户端。

请求 Hook · 请求配置类型 · 头注入实现

+ \ No newline at end of file diff --git a/docs/guide/routing.html b/docs/guide/routing.html index 873ff933..a3d8d4a5 100644 --- a/docs/guide/routing.html +++ b/docs/guide/routing.html @@ -14,7 +14,7 @@ - + @@ -104,8 +104,8 @@ font-family: var(--vp-font-family-mono); resize: vertical; } -</style>

常用元数据 ​

字段作用
i18nKey / noLocalTitle使用翻译键,或提供不经翻译的菜单标题
icon使用完整分包图标名,也接受 VNode
role同时影响菜单与守卫;角色值类型要和会话一致
hidden、env控制菜单显隐;不充当接口或路由权限
sameLevel详情页可保留当前菜单与标签,只在面包屑补充层级
keepAlive允许页面加入内容区的缓存
windowOpen菜单点击时打开指定地址。
ignoreAutoResetScroll允许页面保留内容区滚动位置,详见滚动工具实现。
extra菜单标记的文本、图标、类型和显隐,见 useBadge。

嵌套子路由使用相对路径;如果父路由需要承载子内容,参考 多级菜单示例 与 @/router/constant 中的 LAYOUT。

登录和角色 ​

默认登录页为 /。守卫启用时,无会话会返回登录页;有会话时按白名单、角色和应用首页决定导航。菜单隐藏的页面仍可能允许直达。接入真实业务时,在后端校验会话、权限和资源归属。

KeepAlive 排查 ​

  1. 路由设置 meta.keepAlive: true,并为它配置唯一 name。
  2. TSX 的 defineComponent({ name }) 或 SFC 的组件名应与路由名一致。检查懒加载模块是否导出了预期组件。
  3. 从菜单进入,改变页内状态,切到另一个标签再返回;随后检查关闭标签、直达和刷新是否符合预期。KeepAlive 不跨浏览器刷新保留组件实例。
  4. 替换布局的默认内容插槽后,应用接入方需要自行保留需要的路由渲染和缓存逻辑。

路由契约 · 守卫实现

- +</style>

常用元数据 ​

字段作用
i18nKey / noLocalTitle使用翻译键,或提供不经翻译的菜单标题
icon使用完整分包图标名,也接受 VNode
role同时影响菜单与守卫;角色值类型要和会话一致
hidden、env控制菜单显隐;不充当接口或路由权限
sameLevel详情页可保留当前菜单与标签,只在面包屑补充层级
keepAlive允许页面加入内容区的缓存
windowOpen菜单点击时打开指定地址。
ignoreAutoResetScroll允许页面保留内容区滚动位置,详见滚动工具实现。
extra菜单标记的文本、图标、类型和显隐,见 useBadge。

嵌套子路由使用相对路径;如果父路由需要承载子内容,参考 多级菜单示例 与 @/router/constant 中的 LAYOUT。

登录和角色 ​

默认登录页为 /。守卫启用时,无会话会返回登录页;有会话时按白名单、角色和应用首页决定导航。菜单隐藏的页面仍可能允许直达。接入真实业务时,在后端校验会话、权限和资源归属。

KeepAlive 排查 ​

  1. 路由设置 meta.keepAlive: true,并为它配置唯一 name。
  2. TSX 的 defineComponent({ name }) 或 SFC 的组件名应与路由名一致。检查懒加载模块是否导出了预期组件。
  3. 从菜单进入,改变页内状态,切到另一个标签再返回;随后检查关闭标签、直达和刷新是否符合预期。KeepAlive 不跨浏览器刷新保留组件实例。
  4. 替换布局的默认内容插槽后,应用接入方需要自行保留需要的路由渲染和缓存逻辑。

路由契约 · 守卫实现

+ \ No newline at end of file diff --git a/docs/guide/start.html b/docs/guide/start.html index 58df9751..b8bcb716 100644 --- a/docs/guide/start.html +++ b/docs/guide/start.html @@ -13,7 +13,7 @@ - + @@ -26,8 +26,8 @@ npm install --global pnpm@12.16.1 pnpm install --frozen-lockfile pnpm env:check -pnpm dev

打开 http://127.0.0.1:9527/ray-template/,如果端口被占用,以 Vite 输出的地址为准。使用预填表单登录,再打开「表格 → 远端查询与分页」或「布局实验室」。也可直接体验在线演示。

演示与真实业务

预填表单、会话和 Mock 用于展示前端工作流。对外部署真实业务前,接入自己的认证、服务端权限校验和 API。

启动文档 ​

在同一个工作区运行 pnpm docs:dev。按终端地址打开 /ray-template/docs/,可以直接操作 TablePro、条码和布局示例。

相关文档 ​

第一个业务页面 · v5 与 v6 的版本分界 · 工程检查与部署

运行时与依赖清单 · 项目目录与启动链路

- +pnpm dev

打开 http://127.0.0.1:9527/ray-template/,如果端口被占用,以 Vite 输出的地址为准。使用预填表单登录,再打开「表格 → 远端查询与分页」或「布局实验室」。也可直接体验在线演示。

演示与真实业务

预填表单、会话和 Mock 用于展示前端工作流。对外部署真实业务前,接入自己的认证、服务端权限校验和 API。

启动文档 ​

在同一个工作区运行 pnpm docs:dev。按终端地址打开 /ray-template/docs/,可以直接操作 TablePro、条码和布局示例。

相关文档 ​

第一个业务页面 · v5 与 v6 的版本分界 · 工程检查与部署

运行时与依赖清单 · 项目目录与启动链路

+ \ No newline at end of file diff --git a/docs/guide/tooling.html b/docs/guide/tooling.html index df4386c6..456cdeb8 100644 --- a/docs/guide/tooling.html +++ b/docs/guide/tooling.html @@ -13,14 +13,14 @@ - + -
跳转到正文
开发指南版本 6.0.0

工程检查与部署 ​

常用命令 ​

命令用途
pnpm env:check校验 Node、pnpm 与依赖安装
pnpm dev同步图标清单并启动 Vite
pnpm harness context查任务域;追加 routing、ui、api 等可看实现入口和回归
pnpm harness verify ui按域运行定向测试
pnpm harness verify运行全量检查并生成本地报告
pnpm typecheck验证图标清单,检查应用、Node 配置和测试类型
pnpm dev-build / pnpm report构建开发版,或输出静态打包报告
pnpm build / pnpm preview构建并在本机验收产物
pnpm packages:check检查公开入口、依赖声明和循环依赖
pnpm pages:build将后台与文档组装到 dist/pages
pnpm docs:dev启动文档开发站
pnpm docs:check验证文档示例类型、站内链接与生产构建
pnpm docs:preview预览已构建的文档站

全量检查包含环境、Harness、图标同步、类型、ESLint、Prettier、Vitest 和生产构建。Harness 在 .harness-local/runs/ 写结果;Chrome 验收单独记录。改动交互或布局时,额外验收中英文、明暗主题和窄屏。

部署到子路径 ​

pnpm build 输出 dist/production。将产物部署到与 vite.custom.config.ts 中 base 对应的路径。默认应用为 /ray-template/,域名根目录部署改为 /。Vite 默认打包本地依赖;可选 CDN 模式需另外确认目标环境能访问 CDN。

组合部署使用 pnpm pages:build,将 dist/pages 作为同一个站点的产物。官方地址为 /ray-template/,其下 docs/ 目录提供 v6 官网。CI 传入 RAY_TEMPLATE_SOURCE_REF,把文档的当前源码链接固定到发布提交。

公开生产部署可在构建环境设置 RAY_TEMPLATE_SITE_ORIGIN 为实际站点源地址(例如 https://example.com),由 base 补足路径。未配置时应用产物使用 noindex。公开 sitemap 列出入口页,登录后的 hash 路由用于应用交互。

二次开发约定 ​

  • 新页面遵循 Vue 3 Composition API + TSX 或现有 SFC 模式。复用现有组件,声明按职责归档。
  • Vue、Router、Pinia 的自动导入声明由生成器维护;类型使用 import type。应用、测试、Node 配置的 TS 边界不同。
  • 格式由 Prettier 管理,ESLint 使用 flat config。提交约定和注释写法以应用仓库当前规则为准。

工程与部署入口 · AI Harness · 注释规范

- +
跳转到正文
开发指南版本 6.0.0

工程检查与部署 ​

常用命令 ​

命令用途
pnpm env:check校验 Node、pnpm 与依赖安装
pnpm dev同步图标清单并启动 Vite
pnpm harness context查任务域;追加 routing、ui、api 等可看实现入口和回归
pnpm harness verify ui按域运行定向测试
pnpm harness verify运行全量检查并生成本地报告
pnpm typecheck验证图标清单,检查应用、Node 配置和测试类型
pnpm dev-build / pnpm report构建开发版,或输出静态打包报告
pnpm build / pnpm preview构建并在本机验收产物
pnpm packages:check检查公开入口、依赖声明和循环依赖
pnpm pages:build将后台与文档组装到 dist/pages
pnpm docs:dev启动文档开发站
pnpm docs:check验证文档示例类型、站内链接与生产构建
pnpm docs:preview预览已构建的文档站

全量检查包含环境、Harness、图标同步、类型、ESLint、Prettier、Vitest 和生产构建。Harness 在 .harness-local/runs/ 写结果;Chrome 验收单独记录。改动交互或布局时,额外验收中英文、明暗主题和窄屏。

部署到子路径 ​

pnpm build 输出 dist/production。将产物部署到与 vite.custom.config.ts 中 base 对应的路径。默认应用为 /ray-template/,域名根目录部署改为 /。Vite 默认打包本地依赖;可选 CDN 模式需另外确认目标环境能访问 CDN。

组合部署使用 pnpm pages:build,将 dist/pages 作为同一个站点的产物。官方地址为 /ray-template/,其下 docs/ 目录提供 v6 官网。CI 传入 RAY_TEMPLATE_SOURCE_REF,把文档的当前源码链接固定到发布提交。

公开生产部署可在构建环境设置 RAY_TEMPLATE_SITE_ORIGIN 为实际站点源地址(例如 https://example.com),由 base 补足路径。未配置时应用产物使用 noindex。公开 sitemap 列出入口页,登录后的 hash 路由用于应用交互。

二次开发约定 ​

  • 新页面遵循 Vue 3 Composition API + TSX 或现有 SFC 模式。复用现有组件,声明按职责归档。
  • Vue、Router、Pinia 的自动导入声明由生成器维护;类型使用 import type。应用、测试、Node 配置的 TS 边界不同。
  • 格式由 Prettier 管理,ESLint 使用 flat config。提交约定和注释写法以应用仓库当前规则为准。

工程与部署入口 · AI Harness · 注释规范

+ \ No newline at end of file diff --git a/docs/hashmap.json b/docs/hashmap.json index 17fb6329..f2460ef2 100644 --- a/docs/hashmap.json +++ b/docs/hashmap.json @@ -1 +1 @@ -{"guide_appearance.md":"D-523bFh","guide_architecture.md":"C6HIHYR1","guide_first-page.md":"z-hytCrx","guide_layout.md":"B7nfsGPS","guide_requests.md":"DXAGH_Ni","guide_routing.md":"CyhQoTmx","guide_start.md":"B6oCR027","guide_tooling.md":"CkJoP04H","index.md":"nUYT09g4","migration.md":"CIZms3hv","playground_shell.md":"CH48frZN","reference_components.md":"iMZjSjdU","reference_components_app.md":"Q6aQiDRo","reference_components_barcode.md":"BbJVFbEo","reference_components_chart.md":"JthpvMcl","reference_components_collapse-grid.md":"_8SHiB6D","reference_components_draggable-card.md":"4XemeqwB","reference_components_flow.md":"s-rnj-8X","reference_components_form.md":"BrB2cmbN","reference_components_iframe.md":"CZP63QsN","reference_components_modal.md":"bQ_aJsj-","reference_components_more-dropdown.md":"BubiDbuv","reference_components_qr-code.md":"BtXSFJtd","reference_components_route-transition.md":"Dg7dX5PR","reference_components_segment.md":"BrQOf2XY","reference_configuration.md":"BeYwV4AY","reference_directives.md":"DZcDGixq","reference_hooks.md":"fkz_ntnz","reference_hooks_appearance.md":"JMrRj834","reference_hooks_browser.md":"D5n_xtb0","reference_hooks_interaction.md":"Big820ZZ","reference_hooks_layout.md":"BcnUJtrr","reference_hooks_navigation.md":"CGGlTsKj","reference_hooks_output.md":"B8QXZTOo","reference_icons.md":"lwCUuJHp","reference_index.md":"DRoeAVBG","reference_source.md":"M6GWIIfO","reference_store.md":"BykMC8BP","reference_store_navigation.md":"BBSrn9C3","reference_store_runtime.md":"DN1nqjBy","reference_store_setting.md":"CB2Icw7k","reference_store_signing.md":"453f7xx-","reference_table-pro.md":"DW6Gztpq","reference_utils.md":"CPo2FGYU","reference_utils_browser.md":"mqqbsAE7","reference_utils_core.md":"D6K4f3-H","reference_utils_storage.md":"aIMEPocl"} +{"guide_appearance.md":"CJX6CZmO","guide_architecture.md":"DA6wtiPl","guide_first-page.md":"BrDGu5p2","guide_layout.md":"C3sxtphB","guide_requests.md":"bt5MV3ze","guide_routing.md":"saWWeode","guide_start.md":"DGuorSaq","guide_tooling.md":"-PnA0rJL","index.md":"nUYT09g4","migration.md":"CIZms3hv","playground_shell.md":"CH48frZN","reference_components.md":"Vx6LcOjp","reference_components_app.md":"Bqi2MKtD","reference_components_barcode.md":"DepkAiNq","reference_components_chart.md":"Z0MZ0zwB","reference_components_collapse-grid.md":"CV_6fiGv","reference_components_draggable-card.md":"DqkOgOtj","reference_components_flow.md":"bnqgmwU4","reference_components_form.md":"DKqUuydU","reference_components_iframe.md":"Dy1_3Nzn","reference_components_modal.md":"DPqflFk-","reference_components_more-dropdown.md":"P5PZdsXi","reference_components_qr-code.md":"CjRPLYOy","reference_components_route-transition.md":"DhUbCAYx","reference_components_segment.md":"ClmNr5bX","reference_configuration.md":"B-ScBw16","reference_directives.md":"B7ge4Qql","reference_hooks.md":"B4xmkbad","reference_hooks_appearance.md":"DMkYAmsP","reference_hooks_browser.md":"Mj7VwVYF","reference_hooks_interaction.md":"C4zawhnF","reference_hooks_layout.md":"DusPdzbc","reference_hooks_navigation.md":"BowABOxT","reference_hooks_output.md":"D12chI92","reference_icons.md":"CbIxhVM1","reference_index.md":"DRoeAVBG","reference_source.md":"Ces0B5lP","reference_store.md":"D4ZVWtNT","reference_store_navigation.md":"W6y0Xj28","reference_store_runtime.md":"BH0FRgPU","reference_store_setting.md":"CzmU2eha","reference_store_signing.md":"wgsmw69Q","reference_table-pro.md":"DdZZh1Tr","reference_utils.md":"B6bCkjBM","reference_utils_browser.md":"JR-xHE7d","reference_utils_core.md":"CW4tagj9","reference_utils_storage.md":"CIn4_Wqq"} diff --git a/docs/index.html b/docs/index.html index eb52f947..d3b3946c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -20,7 +20,7 @@
跳转到正文

Ray Template

v6.0.0 将 Ray Admin、官网文档和共享包放在同一个工作区。可在文档里直接体验真实组件。

v6 工作区

常用文档

TablePro 自适应高度

表格填满可用高度,数据在表内滚动。

TablePro 自适应高度示例,虚拟滚动已开启,分页位于表格底部
- + \ No newline at end of file diff --git a/docs/migration.html b/docs/migration.html index 8c07f57e..a78277e6 100644 --- a/docs/migration.html +++ b/docs/migration.html @@ -20,7 +20,7 @@
跳转到正文
版本迁移版本 6.0.0

v5 与 v6 的版本分界 ​

Ray Template 6.0.0 是新的主版本,与 v5 分线。 v6 以 Monorepo 重新组织后台、官网文档和共享包,不提供 v5 的原地升级,也不承诺兼容 v5 的内部路径、接口、配置或本地数据。v5 项目可以继续使用原版本。

版本从哪里开始
v6.0.0新项目从 v6 工作区起步。先看快速开始和架构指南。
v5在 legacy/v5 查看截断前的完整源码。该分支固定于 6f095b7,清单版本为 5.2.5。需要已打标签的版本时,使用 v5.2.4。

v6 的变更 ​

领域v6 的入口与约定
应用结构原来根目录的 src/、mock/、public/、应用环境文件和 index.html 归入 apps/admin/。环境变量、容器配置和构建脚本应按 v6 入口重新核对。
组件与工具从各包的公开入口导入共享能力,例如 @ray-template/ui/table-pro、@ray-template/composables/useDevice 和 @ray-template/utils/precision。Ray Admin 内部的 @/ 指向自己的 src/。
组件接入v6 的 TablePro 统一使用 RTablePro,可传 data 或 request(params, signal)。按现行 API 接入搜索、分页、列设置、CSV 和打印。
路由、权限与请求路由校验、请求客户端和布局由共享包提供。Ray Admin 在应用侧提供页面注册表、会话和鉴权、请求头、主题和语言。
文档与演示VitePress 位于 apps/docs/,通过公共包运行示例。官方发布中后台位于 /ray-template/,v6 文档位于 /ray-template/docs/。

现有项目采用 v6 ​

  1. 从新的工作区或分支起步,保留现有 v5 代码与部署的回退入口。重新配置依赖、环境变量、接口地址和 CI。
  2. 按业务逐项迁入页面、接口及菜单配置,以 v6 的页面示例、路由约定和 TablePro API为准。旧的深层导入、路由 JSON 和自定义拦截器需要逐项检查。
  3. 使用独立浏览器配置或部署源验证 v6。localStorage 按站点源隔离,放在同域不同路径不足以隔离 v5 和 v6 的会话与偏好。旧的设置、锁屏、缓存和登录状态没有通用迁移流程。
  4. 验证登录、权限、路由直达、接口、缓存和部署路径,再切换业务入口。运行 pnpm harness verify,需要组合部署时用 pnpm pages:build。工程检查与部署
- + \ No newline at end of file diff --git a/docs/playground/shell.html b/docs/playground/shell.html index dfbbbe15..a8414cdd 100644 --- a/docs/playground/shell.html +++ b/docs/playground/shell.html @@ -21,7 +21,7 @@
跳转到正文
- + \ No newline at end of file diff --git a/docs/reference/components.html b/docs/reference/components.html index 97419040..4d7eccc5 100644 --- a/docs/reference/components.html +++ b/docs/reference/components.html @@ -13,14 +13,14 @@ - + -
跳转到正文

组件 ​

通用组件从 @ray-template/ui 导入,也可用 /table-pro、/barcode 等子路径按需加载。Ray Admin 内可以使用 @/components。路由过渡位于 @ray-template/admin-shell,由应用接入当前路由和缓存状态。许多组件包装 Naive UI:本文列出模板添加、改写或消费的属性、插槽和事件,原始控件的其余能力以锁定依赖的类型为准。

组件Props 类型主要用途
RTableProTableProProps纯表格、远端查询、自适应高度、列设置、打印
RFormFormProps表单加载、校验、重置和键盘提交
RModalModalProps受控弹窗、预设宽度和全屏卡片
RChartChartPropsECharts 初始化、主题和导出
RFlowFlowPropsLogicFlow 流程图与只读切换
RCollapseGridCollapseGridProps可折叠筛选区及操作列
RSegmentSegmentProps分段选项、图标和提示
RMoreDropdownMoreDropdownProps图标菜单、行操作
RIframeIframeProps外部页面与加载状态
RBarcodeBarcodePropsCanvas / SVG 条码
RDraggableCardDefaultPosition(位置类型)可拖动卡片与拖动边界
RTransitionComponentTransitionComponentProps路由过渡与 KeepAlive
RIconIconProps类型化 SVG 雪碧图

应用组件与 Provider 使用模板的状态、主题或路由,按文件导入。二维码 使用 vue3-next-qrcode,不属于 @/components 的导出。

组件实现、样式和类型放在同一个组件目录。组件属性对象也有具名导出,例如 formProps、modalProps、chartProps;业务代码通常直接使用组件和公开 Props 类型。TablePro 统一使用组件 ref 获取实例,RForm、RChart、RFlow 使用各自的 onRegister 契约。

公开导出 · 组件约定 · 示例源码

- +
跳转到正文

组件 ​

通用组件从 @ray-template/ui 导入,也可用 /table-pro、/barcode 等子路径按需加载。Ray Admin 内可以使用 @/components。路由过渡位于 @ray-template/admin-shell,由应用接入当前路由和缓存状态。许多组件包装 Naive UI:本文列出模板添加、改写或消费的属性、插槽和事件,原始控件的其余能力以锁定依赖的类型为准。

组件Props 类型主要用途
RTableProTableProProps纯表格、远端查询、自适应高度、列设置、打印
RFormFormProps表单加载、校验、重置和键盘提交
RModalModalProps受控弹窗、预设宽度和全屏卡片
RChartChartPropsECharts 初始化、主题和导出
RFlowFlowPropsLogicFlow 流程图与只读切换
RCollapseGridCollapseGridProps可折叠筛选区及操作列
RSegmentSegmentProps分段选项、图标和提示
RMoreDropdownMoreDropdownProps图标菜单、行操作
RIframeIframeProps外部页面与加载状态
RBarcodeBarcodePropsCanvas / SVG 条码
RDraggableCardDefaultPosition(位置类型)可拖动卡片与拖动边界
RTransitionComponentTransitionComponentProps路由过渡与 KeepAlive
RIconIconProps类型化 SVG 雪碧图

应用组件与 Provider 使用模板的状态、主题或路由,按文件导入。二维码 使用 vue3-next-qrcode,不属于 @/components 的导出。

组件实现、样式和类型放在同一个组件目录。组件属性对象也有具名导出,例如 formProps、modalProps、chartProps;业务代码通常直接使用组件和公开 Props 类型。TablePro 统一使用组件 ref 获取实例,RForm、RChart、RFlow 使用各自的 onRegister 契约。

公开导出 · 组件约定 · 示例源码

+ \ No newline at end of file diff --git a/docs/reference/components/app.html b/docs/reference/components/app.html index b1147bf2..aa5e1526 100644 --- a/docs/reference/components/app.html +++ b/docs/reference/components/app.html @@ -13,13 +13,13 @@ - + -
跳转到正文

应用组件与 Provider ​

这些组件按文件默认导入,例如 import AppPageHeader from '@/app-components/app/AppPageHeader'。它们依赖应用 Store、路由或 DOM,按默认 App 挂载顺序集成。

页面组件 ​

组件配置和注意事项
AppPageHeadertitle 必填,description 默认空,eyebrow 默认 RAY TEMPLATE。默认插槽是右侧操作区,页面内容放在组件之外。
AppShareLinkvariant: 'compact' | 'cards',默认 compact,从 dashboard 语言包读文案。链接由组件内配置,不接收任意链接列表。
AppAvatar从 Signing Store 读头像与名字。avatarSize、spaceSize 默认 medium,vertical 默认 false;头像使用圆形、cover,空头像用名称首字。src 和 size 会被内部读取的值覆盖。
AppGlobalSpin接收 NSpin 属性与插槽。显隐以 Runtime Store 的 globalSpinning 为准,传入 show 会被覆盖;和布局内容区 Spin 独立。
AppLockScreen由 setting.lockScreenSwitch 控制锁屏设置弹窗,不允许点遮罩或 Esc 关闭。锁定后由布局读取 Lock Screen Store 呈现解锁界面。
tsx
import AppPageHeader from '@/app-components/app/AppPageHeader'
+    
跳转到正文

应用组件与 Provider ​

这些组件按文件默认导入,例如 import AppPageHeader from '@/app-components/app/AppPageHeader'。它们依赖应用 Store、路由或 DOM,按默认 App 挂载顺序集成。

页面组件 ​

组件配置和注意事项
AppPageHeadertitle 必填,description 默认空,eyebrow 默认 RAY TEMPLATE。默认插槽是右侧操作区,页面内容放在组件之外。
AppShareLinkvariant: 'compact' | 'cards',默认 compact,从 dashboard 语言包读文案。链接由组件内配置,不接收任意链接列表。
AppAvatar从 Signing Store 读头像与名字。avatarSize、spaceSize 默认 medium,vertical 默认 false;头像使用圆形、cover,空头像用名称首字。src 和 size 会被内部读取的值覆盖。
AppGlobalSpin接收 NSpin 属性与插槽。显隐以 Runtime Store 的 globalSpinning 为准,传入 show 会被覆盖;和布局内容区 Spin 独立。
AppLockScreen由 setting.lockScreenSwitch 控制锁屏设置弹窗,不允许点遮罩或 Esc 关闭。锁定后由布局读取 Lock Screen Store 呈现解锁界面。
tsx
import AppPageHeader from '@/app-components/app/AppPageHeader'
 import { NButton } from 'naive-ui'
 
 export const renderOrdersHeader = (create: () => void) => (
@@ -28,8 +28,8 @@
       新建订单
     </NButton>
   </AppPageHeader>
-)

Provider ​

Provider职责与调用时机
AppNaiveGlobalProvider包裹默认插槽并同步明暗、主题覆盖、UI locale 和日期 locale。提供 Message、Dialog、Modal、Notification、LoadingBar 等上下文,并建立 window.$message、$dialog、$notification、$loadingBar。离散 API 在 Provider 初始化后可用,卸载时释放;不要在模块顶层提前调用。
AppStyleProvider同步 HTML 明暗类、CSS 主色和窗口尺寸变量,结束首屏加载动画。应用主题应通过设置方法更新。
AppVersionProvider启动时比较构建版本与本地版本。第一次写入缓存,变化时提示,确认会走退出并刷新;取消关闭提示。
AppWatermarkProvider按设置渲染全屏 Naive UI 水印;独立页面如需局部水印可自行在目标区域使用 NWatermark。
AppRequestCancelerProvider默认布局内容的路由更新钩子会取消模板管理的请求。替换内容插槽时,根据实际导航方式保留取消行为。

应用组件说明 · 布局配置 · Store · 请求取消

- +)

Provider ​

Provider职责与调用时机
AppNaiveGlobalProvider包裹默认插槽并同步明暗、主题覆盖、UI locale 和日期 locale。提供 Message、Dialog、Modal、Notification、LoadingBar 等上下文,并建立 window.$message、$dialog、$notification、$loadingBar。离散 API 在 Provider 初始化后可用,卸载时释放;不要在模块顶层提前调用。
AppStyleProvider同步 HTML 明暗类、CSS 主色和窗口尺寸变量,结束首屏加载动画。应用主题应通过设置方法更新。
AppVersionProvider启动时比较构建版本与本地版本。第一次写入缓存,变化时提示,确认会走退出并刷新;取消关闭提示。
AppWatermarkProvider按设置渲染全屏 Naive UI 水印;独立页面如需局部水印可自行在目标区域使用 NWatermark。
AppRequestCancelerProvider默认布局内容的路由更新钩子会取消模板管理的请求。替换内容插槽时,根据实际导航方式保留取消行为。

应用组件说明 · 布局配置 · Store · 请求取消

+ \ No newline at end of file diff --git a/docs/reference/components/barcode.html b/docs/reference/components/barcode.html index f20cee0b..fc99bcfb 100644 --- a/docs/reference/components/barcode.html +++ b/docs/reference/components/barcode.html @@ -14,7 +14,7 @@ - + @@ -123,8 +123,8 @@ options={{ displayValue: true, height: 60 }} onError={(error) => console.error('条码格式无效', error)} /> -)
属性默认说明
text无条码文本。留空或传入不符合格式的值时可能渲染失败。
format'CODE128'条码制式,覆盖 options.format。
barcodeRender'canvas'canvas 或 svg。
options{}JsBarcode options,如 displayValue、lineColor、margin、条宽和条高。
width / height'auto'显示尺寸,数字按像素。与 options 中条码自身的条宽、条高不同。
responsivefalse监听容器尺寸;用 width="responsive" 或 height="responsive" 让对应尺寸随容器调整。
watchTexttrue文本变化时重绘。独立改变 format、options 或渲染介质时不要依赖文本 watcher,可以按配置更换组件 key。
loadingfalse控制 Spin;调用方负责开关。

onSuccess(text, format, options)、onError(error)、onFinally() 支持函数或回调数组。成功回调收到原始 options;组件响应式调整的条宽和条高不写回该对象。绘制异常通过 onError 通知,业务代码可据此提示或清理旧预览。

支持 CODE39、CODE128 及 A/B/C 变体、EAN13/EAN8/EAN5/EAN2、UPC、ITF14/ITF、MSI/MSI10/MSI11/MSI1010/MSI1110、pharmacode、codabar。使用 EAN 或 UPC 前验证输入长度和校验位。打印后是否可扫取决于设备和成品尺寸。

组件实现 · 制式和选项类型

- +)
属性默认说明
text无条码文本。留空或传入不符合格式的值时可能渲染失败。
format'CODE128'条码制式,覆盖 options.format。
barcodeRender'canvas'canvas 或 svg。
options{}JsBarcode options,如 displayValue、lineColor、margin、条宽和条高。
width / height'auto'显示尺寸,数字按像素。与 options 中条码自身的条宽、条高不同。
responsivefalse监听容器尺寸;用 width="responsive" 或 height="responsive" 让对应尺寸随容器调整。
watchTexttrue文本变化时重绘。独立改变 format、options 或渲染介质时不要依赖文本 watcher,可以按配置更换组件 key。
loadingfalse控制 Spin;调用方负责开关。

onSuccess(text, format, options)、onError(error)、onFinally() 支持函数或回调数组。成功回调收到原始 options;组件响应式调整的条宽和条高不写回该对象。绘制异常通过 onError 通知,业务代码可据此提示或清理旧预览。

支持 CODE39、CODE128 及 A/B/C 变体、EAN13/EAN8/EAN5/EAN2、UPC、ITF14/ITF、MSI/MSI10/MSI11/MSI1010/MSI1110、pharmacode、codabar。使用 EAN 或 UPC 前验证输入长度和校验位。打印后是否可扫取决于设备和成品尺寸。

组件实现 · 制式和选项类型

+ \ No newline at end of file diff --git a/docs/reference/components/chart.html b/docs/reference/components/chart.html index 5a27ba02..e8f6f69e 100644 --- a/docs/reference/components/chart.html +++ b/docs/reference/components/chart.html @@ -13,7 +13,7 @@ - + @@ -39,8 +39,8 @@ /> ) }, -})

渲染、主题与更新 ​

属性默认说明
options{}ECharts 配置。showAria 默认 false,模板会写入 aria.enabled 和 aria.decal.show。
width / height'100%'CSS 尺寸,数字按像素。
use[]额外 ECharts 注册项。内置柱、线、饼、K 线、散点、象形柱、Canvas,以及标题、提示、网格、数据集、图例等基础模块。
intersectionObservertrue进入观察范围后挂载图表;隐藏区域的实例可能尚不可用。
intersectionObserverTarget / intersectionOptions容器 / { threshold: 0.1 }自定义观察目标与参数。
autoResize / autoResizeObserverTargettrue / 外层容器容器尺寸变化后节流 resize。
watchOptions / watchDeeptrue / true是否订阅 options,是否深层观察。
watchOptionsThrottleWait500options 更新节流间隔(毫秒)。
nextTicktrue初始化前等待 Vue 更新。
setChartOptions{ notMerge: true, lazyUpdate: true, silent: false, replaceMerge: [] }ECharts setOption 的控制参数。
theme / autoChangeThemenull / true默认用应用的 ECharts 主题及暗色变体。固定主题请传注册后的主题名。
loading / loadingOptionsfalse / 模板加载样式是否显示 ECharts 加载层及参数。

Provider 指定主题时优先。当前实现中 theme="default" 在 autoChangeTheme=true 时会传内建 dark,设为 false 才使用空主题名;需要明确的渲染效果时建议传实际主题名。切换主题可能重建实例,持有实例引用的代码应重新读取或注册。

卡片预设和回调 ​

  • preset="card" 使用 Naive UI Card,支持 title(字符串或渲染函数)、bordered(默认 true)、contentStyle。cardExtra 插槽可替换右上角。
  • 默认菜单含图片下载;downloadOptions 接受 ECharts getDataURL 参数和可选 filename。传入 dropdownOptions 会替换菜单,选择项通过 onDropdownSelect(key, option) 通知。
  • onSuccess(instance)、onError()、onFinally() 对应初始化结果;错误仍可能向调用侧抛出。onRegister(instance, render, dispose) 在可用实例建立后调用。

useChart() 返回 [register, actions]。getChartInstance() 返回 { echartInst, render, dispose },注册前会抛错。isDisposed() 检查底层实例,dispose() 释放图表和监听,render() 调用组件挂载逻辑;已存在实例时不要用它替代更新 options 或 setOption。图表随组件卸载清理。

Props · 组件实现 · useChart

- +})

渲染、主题与更新 ​

属性默认说明
options{}ECharts 配置。showAria 默认 false,模板会写入 aria.enabled 和 aria.decal.show。
width / height'100%'CSS 尺寸,数字按像素。
use[]额外 ECharts 注册项。内置柱、线、饼、K 线、散点、象形柱、Canvas,以及标题、提示、网格、数据集、图例等基础模块。
intersectionObservertrue进入观察范围后挂载图表;隐藏区域的实例可能尚不可用。
intersectionObserverTarget / intersectionOptions容器 / { threshold: 0.1 }自定义观察目标与参数。
autoResize / autoResizeObserverTargettrue / 外层容器容器尺寸变化后节流 resize。
watchOptions / watchDeeptrue / true是否订阅 options,是否深层观察。
watchOptionsThrottleWait500options 更新节流间隔(毫秒)。
nextTicktrue初始化前等待 Vue 更新。
setChartOptions{ notMerge: true, lazyUpdate: true, silent: false, replaceMerge: [] }ECharts setOption 的控制参数。
theme / autoChangeThemenull / true默认用应用的 ECharts 主题及暗色变体。固定主题请传注册后的主题名。
loading / loadingOptionsfalse / 模板加载样式是否显示 ECharts 加载层及参数。

Provider 指定主题时优先。当前实现中 theme="default" 在 autoChangeTheme=true 时会传内建 dark,设为 false 才使用空主题名;需要明确的渲染效果时建议传实际主题名。切换主题可能重建实例,持有实例引用的代码应重新读取或注册。

卡片预设和回调 ​

  • preset="card" 使用 Naive UI Card,支持 title(字符串或渲染函数)、bordered(默认 true)、contentStyle。cardExtra 插槽可替换右上角。
  • 默认菜单含图片下载;downloadOptions 接受 ECharts getDataURL 参数和可选 filename。传入 dropdownOptions 会替换菜单,选择项通过 onDropdownSelect(key, option) 通知。
  • onSuccess(instance)、onError()、onFinally() 对应初始化结果;错误仍可能向调用侧抛出。onRegister(instance, render, dispose) 在可用实例建立后调用。

useChart() 返回 [register, actions]。getChartInstance() 返回 { echartInst, render, dispose },注册前会抛错。isDisposed() 检查底层实例,dispose() 释放图表和监听,render() 调用组件挂载逻辑;已存在实例时不要用它替代更新 options 或 setOption。图表随组件卸载清理。

Props · 组件实现 · useChart

+ \ No newline at end of file diff --git a/docs/reference/components/collapse-grid.html b/docs/reference/components/collapse-grid.html index 4f3c6938..bb89baf9 100644 --- a/docs/reference/components/collapse-grid.html +++ b/docs/reference/components/collapse-grid.html @@ -13,7 +13,7 @@ - + @@ -52,8 +52,8 @@ </RCollapseGrid> ) }, -})

组件实现 · Props

- +})

组件实现 · Props

+ \ No newline at end of file diff --git a/docs/reference/components/draggable-card.html b/docs/reference/components/draggable-card.html index 3021e51a..75ebe9df 100644 --- a/docs/reference/components/draggable-card.html +++ b/docs/reference/components/draggable-card.html @@ -13,7 +13,7 @@ - + @@ -30,8 +30,8 @@ > 拖动标题可移动此卡片 </RDraggableCard> -)

组件源码

- +)

组件源码

+ \ No newline at end of file diff --git a/docs/reference/components/flow.html b/docs/reference/components/flow.html index 61add63f..9a999c8b 100644 --- a/docs/reference/components/flow.html +++ b/docs/reference/components/flow.html @@ -13,7 +13,7 @@ - + @@ -46,8 +46,8 @@ onRegister={(instance) => instance.render(graph)} /> ), -})
属性默认说明
width / height'100%'容器尺寸,需要可计算的高度。
data无后续引用变化时重绘,嵌套原地修改不触发。当前挂载分支先渲染空图,首屏请在 onRegister 里主动渲染。
watchDatatrue是否监听传入数据。关闭后可从实例控制重绘。
readonlyfalse同步 LogicFlow 静默模式和节点、边文本编辑状态。
options网格开、partial: false、键盘开LogicFlow 初始化配置,包括尺寸、背景、键盘、边、交互、历史和插件等。container 由组件管理。
use无LogicFlow 全局插件列表,组件只在首次初始化时注册一次。需要实例级插件时检查 options.plugins。
onRegister(instance)无挂载后取得 LogicFlow,支持回调数组。

FlowOptions 支持的字段按用途分组:

  • 画布与布局:width、height、background、grid、partial、style、overlapMode。
  • 交互:keyboard、adjustEdge、allowRotate、allowResize、isSilentMode、stopScrollGraph、stopZoomGraph、stopMoveGraph、textEdit、textMode、edgeTextMode、nodeTextMode、guards。
  • 边和渲染:edgeType、customTrajectory、animation、history、outline、snapline。
  • 扩展:plugins、pluginsOptions、disabledPlugins、disabledTools、idGenerator、edgeGenerator。

FlowGraphData 用于包装组件的 Props。直接调用底层 instance.render 时,使用 Parameters<LogicFlow['render']>[0] 保留 LogicFlow 所要求的节点类型、坐标和连线字段。

useFlow() 返回 [register, { getFlowInstance }]。若首屏要填图,可在同一 onRegister 回调里先调用 register(instance) 再 instance.render(graph)。注册之前调用 getFlowInstance() 会抛错。程序化编辑、导入和事件监听走 LogicFlow 实例;组件目前没有公开销毁方法或卸载时的显式实例清理,频繁重挂载或绑定自定义监听时,请由接入方处理对应资源释放。

组件实现 · 图和选项类型 · 实例 Hook

- +})
属性默认说明
width / height'100%'容器尺寸,需要可计算的高度。
data无后续引用变化时重绘,嵌套原地修改不触发。当前挂载分支先渲染空图,首屏请在 onRegister 里主动渲染。
watchDatatrue是否监听传入数据。关闭后可从实例控制重绘。
readonlyfalse同步 LogicFlow 静默模式和节点、边文本编辑状态。
options网格开、partial: false、键盘开LogicFlow 初始化配置,包括尺寸、背景、键盘、边、交互、历史和插件等。container 由组件管理。
use无LogicFlow 全局插件列表,组件只在首次初始化时注册一次。需要实例级插件时检查 options.plugins。
onRegister(instance)无挂载后取得 LogicFlow,支持回调数组。

FlowOptions 支持的字段按用途分组:

  • 画布与布局:width、height、background、grid、partial、style、overlapMode。
  • 交互:keyboard、adjustEdge、allowRotate、allowResize、isSilentMode、stopScrollGraph、stopZoomGraph、stopMoveGraph、textEdit、textMode、edgeTextMode、nodeTextMode、guards。
  • 边和渲染:edgeType、customTrajectory、animation、history、outline、snapline。
  • 扩展:plugins、pluginsOptions、disabledPlugins、disabledTools、idGenerator、edgeGenerator。

FlowGraphData 用于包装组件的 Props。直接调用底层 instance.render 时,使用 Parameters<LogicFlow['render']>[0] 保留 LogicFlow 所要求的节点类型、坐标和连线字段。

useFlow() 返回 [register, { getFlowInstance }]。若首屏要填图,可在同一 onRegister 回调里先调用 register(instance) 再 instance.render(graph)。注册之前调用 getFlowInstance() 会抛错。程序化编辑、导入和事件监听走 LogicFlow 实例;组件目前没有公开销毁方法或卸载时的显式实例清理,频繁重挂载或绑定自定义监听时,请由接入方处理对应资源释放。

组件实现 · 图和选项类型 · 实例 Hook

+ \ No newline at end of file diff --git a/docs/reference/components/form.html b/docs/reference/components/form.html index b4fe4f73..9e5c748b 100644 --- a/docs/reference/components/form.html +++ b/docs/reference/components/form.html @@ -13,7 +13,7 @@ - + @@ -60,8 +60,8 @@ </RForm> ) }, -})

属性与事件 ​

除 onSubmit 外,继承 NForm 的公开属性。默认插槽传给 NForm。

属性默认说明
loadingfalse外层 Spin 状态,由调用方开关。
loadingDescription无加载说明。
autocomplete'off'挂载时写到表单 DOM。
submitWhenEnterfalse创建时启用 Enter 捕获,阻止默认行为,校验成功后调用 onFinish。
onFinish无Enter 校验完成回调。自定义提交按钮要自行调用 validate() 并执行提交。
onRegister(inst)无挂载后传出 Naive UI Form 实例。接受单函数或回调数组。

含多行输入、搜索选择器或嵌套表单时,先确认 Enter 是否应被捕获。组件没有把 Form 方法直接暴露为模板 ref。

useForm ​

useForm(model?, rules?) 返回 [register, actions],把 register 绑定给 onRegister。初始化值和规则可用对象或工厂;对象会深拷贝,工厂结果直接使用,建议每次创建新对象。

返回项行为
formConditionRef响应式模型,传给 RForm.model 并用于输入绑定。
formModel() / formRules()重新取得初始模型和规则。
getFormInstance()获取已注册实例,未注册时抛错。
validate(callback?, shouldRuleBeApplied?)透传 Naive UI 校验;失败要处理 Promise 拒绝。
validateTargetField(key)按规则对象的唯一 key 筛选规则,key 不等同于 NFormItem.path。
restoreValidation()清除当前校验状态,保留输入。
updateFormCondition(values)浅合并当前模型,不改初始值。
reset(values?)合并初始值和覆盖值,然后清除校验。动态新增字段不会被自动删除。

实例相关方法要在表单挂载并注册后调用。可空字段应在初始模型中显式声明,并为所用输入选用合适的空值。修改嵌套字段时注意更新是浅合并。

组件源码 · useForm 源码 · 表单示例

- +})

属性与事件 ​

除 onSubmit 外,继承 NForm 的公开属性。默认插槽传给 NForm。

属性默认说明
loadingfalse外层 Spin 状态,由调用方开关。
loadingDescription无加载说明。
autocomplete'off'挂载时写到表单 DOM。
submitWhenEnterfalse创建时启用 Enter 捕获,阻止默认行为,校验成功后调用 onFinish。
onFinish无Enter 校验完成回调。自定义提交按钮要自行调用 validate() 并执行提交。
onRegister(inst)无挂载后传出 Naive UI Form 实例。接受单函数或回调数组。

含多行输入、搜索选择器或嵌套表单时,先确认 Enter 是否应被捕获。组件没有把 Form 方法直接暴露为模板 ref。

useForm ​

useForm(model?, rules?) 返回 [register, actions],把 register 绑定给 onRegister。初始化值和规则可用对象或工厂;对象会深拷贝,工厂结果直接使用,建议每次创建新对象。

返回项行为
formConditionRef响应式模型,传给 RForm.model 并用于输入绑定。
formModel() / formRules()重新取得初始模型和规则。
getFormInstance()获取已注册实例,未注册时抛错。
validate(callback?, shouldRuleBeApplied?)透传 Naive UI 校验;失败要处理 Promise 拒绝。
validateTargetField(key)按规则对象的唯一 key 筛选规则,key 不等同于 NFormItem.path。
restoreValidation()清除当前校验状态,保留输入。
updateFormCondition(values)浅合并当前模型,不改初始值。
reset(values?)合并初始值和覆盖值,然后清除校验。动态新增字段不会被自动删除。

实例相关方法要在表单挂载并注册后调用。可空字段应在初始模型中显式声明,并为所用输入选用合适的空值。修改嵌套字段时注意更新是浅合并。

组件源码 · useForm 源码 · 表单示例

+ \ No newline at end of file diff --git a/docs/reference/components/iframe.html b/docs/reference/components/iframe.html index de53a468..4e0c2f46 100644 --- a/docs/reference/components/iframe.html +++ b/docs/reference/components/iframe.html @@ -13,7 +13,7 @@ - + @@ -23,8 +23,8 @@ export const renderReport = (url: string) => ( <RIframe src={url} title="库存报表" height={460} lazy="eager" /> -)
属性默认说明
src必填iframe 地址。接收用户输入时应由业务限制可嵌入来源。
width / height'100%'CSS 尺寸。百分比高度依赖父级。
frameborder0模板边框样式变量。
iframeWrapperClass / iframeClass无外层容器与原生 iframe 的类名。
title / name / allow无原生 iframe 属性。title 用于辅助技术识别。
lazytrue字符串 'lazy' 或 'eager'。当前实现把布尔 true 和 false 都映射为 'lazy',主动加载请写 'eager'。
customSpinProps{}NSpin 配置,show 由组件内状态覆盖。

onSuccess(iframe, event) 和 onError 支持函数或回调数组。当前错误分支只传 event,与 Props 类型声明的双参数有差异;需要处理错误时不要假定有元素参数。首次 load / error 后关闭 Spin,当前实现不在 src 变更时重置加载状态;每次切换地址都要显示加载时可给组件不同的 key。iframeInst 是组件实际暴露的 DOM 引用。额外插槽交给 Spin,但默认内容始终为 iframe。

组件实现 · Props

- +)
属性默认说明
src必填iframe 地址。接收用户输入时应由业务限制可嵌入来源。
width / height'100%'CSS 尺寸。百分比高度依赖父级。
frameborder0模板边框样式变量。
iframeWrapperClass / iframeClass无外层容器与原生 iframe 的类名。
title / name / allow无原生 iframe 属性。title 用于辅助技术识别。
lazytrue字符串 'lazy' 或 'eager'。当前实现把布尔 true 和 false 都映射为 'lazy',主动加载请写 'eager'。
customSpinProps{}NSpin 配置,show 由组件内状态覆盖。

onSuccess(iframe, event) 和 onError 支持函数或回调数组。当前错误分支只传 event,与 Props 类型声明的双参数有差异;需要处理错误时不要假定有元素参数。首次 load / error 后关闭 Spin,当前实现不在 src 变更时重置加载状态;每次切换地址都要显示加载时可给组件不同的 key。iframeInst 是组件实际暴露的 DOM 引用。额外插槽交给 Spin,但默认内容始终为 iframe。

组件实现 · Props

+ \ No newline at end of file diff --git a/docs/reference/components/modal.html b/docs/reference/components/modal.html index a187be42..0b53f318 100644 --- a/docs/reference/components/modal.html +++ b/docs/reference/components/modal.html @@ -13,7 +13,7 @@ - + @@ -49,8 +49,8 @@ </> ) }, -})
属性默认作用范围
width600未指定预设时的宽度。
cardWidth600preset="card" 的宽度。
dialogWidth446preset="dialog" 的宽度。
fullscreenfalse仅 card 预设生效。

宽度接受数字或 CSS 尺寸。fullscreen 让卡片占满窗口,正文在溢出时滚动;它不调用浏览器全屏。default、header、footer 等插槽依 Naive UI 预设处理,组件原样转发。

命令式弹窗 ​

@/components 的 useModal() 已弃用,兼容代码仍可通过 create(options) 和 destroyAll() 调用。create 返回 Naive UI 弹窗句柄,支持 fullscreen、width、cardWidth、dialogWidth 等兼容配置。新代码从 naive-ui 导入 useModal,在 NModalProvider 的后代调用;需要模板专用全屏样式时用声明式 RModal。提示用户确认危险操作时也可以用全局 Dialog Provider。

组件源码 · 兼容 Hook · 回归用例

- +})
属性默认作用范围
width600未指定预设时的宽度。
cardWidth600preset="card" 的宽度。
dialogWidth446preset="dialog" 的宽度。
fullscreenfalse仅 card 预设生效。

宽度接受数字或 CSS 尺寸。fullscreen 让卡片占满窗口,正文在溢出时滚动;它不调用浏览器全屏。default、header、footer 等插槽依 Naive UI 预设处理,组件原样转发。

命令式弹窗 ​

@/components 的 useModal() 已弃用,兼容代码仍可通过 create(options) 和 destroyAll() 调用。create 返回 Naive UI 弹窗句柄,支持 fullscreen、width、cardWidth、dialogWidth 等兼容配置。新代码从 naive-ui 导入 useModal,在 NModalProvider 的后代调用;需要模板专用全屏样式时用声明式 RModal。提示用户确认危险操作时也可以用全局 Dialog Provider。

组件源码 · 兼容 Hook · 回归用例

+ \ No newline at end of file diff --git a/docs/reference/components/more-dropdown.html b/docs/reference/components/more-dropdown.html index 6dd53b5a..81ebc6ab 100644 --- a/docs/reference/components/more-dropdown.html +++ b/docs/reference/components/more-dropdown.html @@ -13,7 +13,7 @@ - + @@ -39,8 +39,8 @@ <RIcon name="action/more" /> </NButton> </RMoreDropdown> -)

组件实现 · Props

- +)

组件实现 · Props

+ \ No newline at end of file diff --git a/docs/reference/components/qr-code.html b/docs/reference/components/qr-code.html index 29bd17d4..8ec08267 100644 --- a/docs/reference/components/qr-code.html +++ b/docs/reference/components/qr-code.html @@ -13,7 +13,7 @@ - + @@ -33,8 +33,8 @@ </> ) }, -})

text 设置内容,默认可随内容变化重绘。logoImage、backgroundImage、gifBackgroundURL、dotScale、colorDark 可调整样式。带背景的二维码要实际扫码检查清晰度,远程素材还受跨域和浏览器加载限制。

status 可显示 loading、error 等状态,onReload 在重试时通知调用方。downloadQRCode() 等到实例挂载后调用。二维码只表达数据,生成成功与扫码认证成功是两回事;登录需要业务后端签发和验证对应凭据。

二维码示例 · 登录页扫码入口

- +})

text 设置内容,默认可随内容变化重绘。logoImage、backgroundImage、gifBackgroundURL、dotScale、colorDark 可调整样式。带背景的二维码要实际扫码检查清晰度,远程素材还受跨域和浏览器加载限制。

status 可显示 loading、error 等状态,onReload 在重试时通知调用方。downloadQRCode() 等到实例挂载后调用。二维码只表达数据,生成成功与扫码认证成功是两回事;登录需要业务后端签发和验证对应凭据。

二维码示例 · 登录页扫码入口

+ \ No newline at end of file diff --git a/docs/reference/components/route-transition.html b/docs/reference/components/route-transition.html index 7bf87c44..abac8dfd 100644 --- a/docs/reference/components/route-transition.html +++ b/docs/reference/components/route-transition.html @@ -13,7 +13,7 @@ - + @@ -23,8 +23,8 @@ export const renderPageOutlet = () => ( <RTransitionComponent transitionPropName="fade" transitionAppear={false} /> -)

组件源码 · 缓存 Store · 路由缓存排查

- +)

组件源码 · 缓存 Store · 路由缓存排查

+ \ No newline at end of file diff --git a/docs/reference/components/segment.html b/docs/reference/components/segment.html index 5cb03bc6..861b0ac5 100644 --- a/docs/reference/components/segment.html +++ b/docs/reference/components/segment.html @@ -13,7 +13,7 @@ - + @@ -39,8 +39,8 @@ /> ) }, -})

组件实现 · 选项类型 · 不支持的 Tabs 属性

- +})

组件实现 · 选项类型 · 不支持的 Tabs 属性

+ \ No newline at end of file diff --git a/docs/reference/configuration.html b/docs/reference/configuration.html index dbe57cbf..af47e954 100644 --- a/docs/reference/configuration.html +++ b/docs/reference/configuration.html @@ -13,14 +13,14 @@ - + -
跳转到正文

应用配置 ​

应用配置与站外文档配置分属两个仓库。这里说明 Ray Template 应用中的 @/app-config、Vite 配置和运行期设置。运行期保存的用户偏好可能覆盖源码默认值,验证默认设置时使用干净的浏览器存储。

文件配置
apps/admin/src/app-config/app-config.tsGLOBAL_CLASS_NAMES(明暗类与 CSS 变量)、MESSAGE_PROVIDER(上下文消息,默认最多 5 条、不可关闭)、LAYOUT_CONTENT_SPIN_WHEN_ROUTE_CHANGE(默认关)、APP_GLOBAL_LOADING、PRE_LOADING_CONFIG、APP_CATCH_KEY / APP_CATCH_KEY_PREFIX、CONTENT_TRANSITION_OPTIONS。
apps/admin/src/app-config/design-config.tsAPP_THEME 的候选色、默认蓝 #3b63d9、Naive UI 明暗覆盖、ECharts 默认主题。
apps/admin/src/app-config/local-config.tsLOCAL_OPTIONS、SYSTEM_DEFAULT_LOCAL、SYSTEM_FALLBACK_LOCALE、DAYJS_LOCAL_MAP、DEFAULT_DAYJS_LOCAL。默认与回退语言为 zh-CN。
apps/admin/src/app-config/request-config.tsAXIOS_CONFIG。默认同源相对地址、5 秒超时、withCredentials: false、JSON Content-Type。
apps/admin/src/app-config/router-config.tsSETUP_ROUTER_ACTION(加载条与守卫默认开)、WHITE_ROUTES(路由名白名单)、SUPER_ADMIN(默认空)、LAYOUT_CONTENT_REF / LAYOUT_SIDER_REF。
apps/admin/src/app-config/regex-config.tsAPP_REGEX,模板 CSS 尺寸规则。
vite.custom.config.tsbase、server、buildOptions(mode)、alias、cdn、copyright、Sass 注入和首屏加载配置。

选择改动入口 ​

  • 修改默认用户偏好(布局、菜单、标签、缓存)时看 Setting Store 与 apps/admin/src/store/modules/setting/constant.ts。已有用户可在应用设置里恢复默认后检查效果。
  • 修改主题或语言时看主题和国际化。新增语言同时维护翻译资源与 Day.js、Naive UI 对应关系。
  • 修改访问控制时看路由指南。白名单按区分大小写的字符串路由名判断,守卫先处理 token,再按白名单和角色处理导航。
  • 修改 API 地址、认证头和失败策略时看接口与 Mock。应用不会自动把任意 VITE_* 环境变量绑定到 Axios;需在配置中明确读取。
  • 应用默认部署子路径 /ray-template/。部署子路径改变后重新构建并验证图标、代理和直达链接,见工程与部署。

__APP_CFG__ 由 Vite 在构建时注入,用于应用包信息、版权与默认主色。任何注入到客户端的字段都可被浏览器读取。用于页面交互的运行态偏好走 Store,构建参数留在 Vite 配置。

应用配置源码 · Vite 自定义配置

- +
跳转到正文

应用配置 ​

应用配置与站外文档配置分属两个仓库。这里说明 Ray Template 应用中的 @/app-config、Vite 配置和运行期设置。运行期保存的用户偏好可能覆盖源码默认值,验证默认设置时使用干净的浏览器存储。

文件配置
apps/admin/src/app-config/app-config.tsGLOBAL_CLASS_NAMES(明暗类与 CSS 变量)、MESSAGE_PROVIDER(上下文消息,默认最多 5 条、不可关闭)、LAYOUT_CONTENT_SPIN_WHEN_ROUTE_CHANGE(默认关)、APP_GLOBAL_LOADING、PRE_LOADING_CONFIG、APP_CATCH_KEY / APP_CATCH_KEY_PREFIX、CONTENT_TRANSITION_OPTIONS。
apps/admin/src/app-config/design-config.tsAPP_THEME 的候选色、默认蓝 #3b63d9、Naive UI 明暗覆盖、ECharts 默认主题。
apps/admin/src/app-config/local-config.tsLOCAL_OPTIONS、SYSTEM_DEFAULT_LOCAL、SYSTEM_FALLBACK_LOCALE、DAYJS_LOCAL_MAP、DEFAULT_DAYJS_LOCAL。默认与回退语言为 zh-CN。
apps/admin/src/app-config/request-config.tsAXIOS_CONFIG。默认同源相对地址、5 秒超时、withCredentials: false、JSON Content-Type。
apps/admin/src/app-config/router-config.tsSETUP_ROUTER_ACTION(加载条与守卫默认开)、WHITE_ROUTES(路由名白名单)、SUPER_ADMIN(默认空)、LAYOUT_CONTENT_REF / LAYOUT_SIDER_REF。
apps/admin/src/app-config/regex-config.tsAPP_REGEX,模板 CSS 尺寸规则。
vite.custom.config.tsbase、server、buildOptions(mode)、alias、cdn、copyright、Sass 注入和首屏加载配置。

选择改动入口 ​

  • 修改默认用户偏好(布局、菜单、标签、缓存)时看 Setting Store 与 apps/admin/src/store/modules/setting/constant.ts。已有用户可在应用设置里恢复默认后检查效果。
  • 修改主题或语言时看主题和国际化。新增语言同时维护翻译资源与 Day.js、Naive UI 对应关系。
  • 修改访问控制时看路由指南。白名单按区分大小写的字符串路由名判断,守卫先处理 token,再按白名单和角色处理导航。
  • 修改 API 地址、认证头和失败策略时看接口与 Mock。应用不会自动把任意 VITE_* 环境变量绑定到 Axios;需在配置中明确读取。
  • 应用默认部署子路径 /ray-template/。部署子路径改变后重新构建并验证图标、代理和直达链接,见工程与部署。

__APP_CFG__ 由 Vite 在构建时注入,用于应用包信息、版权与默认主色。任何注入到客户端的字段都可被浏览器读取。用于页面交互的运行态偏好走 Store,构建参数留在 Vite 配置。

应用配置源码 · Vite 自定义配置

+ \ No newline at end of file diff --git a/docs/reference/directives.html b/docs/reference/directives.html index 77395559..6682209b 100644 --- a/docs/reference/directives.html +++ b/docs/reference/directives.html @@ -17,7 +17,7 @@ - + @@ -25,7 +25,7 @@
跳转到正文

指令 ​

应用在 main.ts 调用 setupDirectives(app)。注册器查找 packages/directives/src/modules/<name>/index.ts,调用默认导出的工厂,将返回的 Vue Directive 以目录名注册。SFC 中可直接用 v-<name>;从文件名和源码进入可查各指令的绑定类型。

v-copy ​

绑定要复制的字符串;绑定值改变时销毁并重建 ClipboardJS 实例,卸载时销毁。Ray Admin 注册时接入消息提示。独立使用 createCopyDirective 时可提供自己的结果回调。复制应由用户点击触发。数字等值请先显式转为字符串。

vue
<template>
   <button type="button" v-copy="'ORD-001'">复制订单号</button>
-</template>

源码

v-debounce 与 v-throttle ​

连续点击按钮,停止 500ms 后,防抖只执行一次。

执行次数 / Calls: 0
查看示例源码
vue
<template>
+</template>

源码

v-debounce 与 v-throttle ​

连续点击按钮,停止 500ms 后,防抖只执行一次。

执行次数 / Calls: 0
查看示例源码
vue
<template>
   <div class="ray-demo">
     <NButton v-debounce="{ wait: 500, func: increment }">
       连续点击 / Click repeatedly
@@ -68,13 +68,13 @@
   <button type="button" v-throttle="{ func: countClick, wait: 1000 }">
     点击次数 {{ clicks }}
   </button>
-</template>
  • options.leading / trailing 决定在等待周期首尾是否执行;防抖还可设 maxWait。挂载时读取绑定值,更新不会重绑。若回调依赖变动数据,让原函数在执行时读取响应式值。
  • 当前实现将监听器句柄保存在指令工厂闭包,多个绑定实例共用同一清理位置。需要同一指令同时绑多个元素或动态修改间隔时,在组件里单独创建防抖或节流函数并清理。
  • 防抖和节流只约束事件触发,异步请求仍需独立处理取消、并发或幂等。

防抖源码 · 节流源码

v-ellipsis ​

width 必填,数字按像素;字符串可传 CSS 尺寸。type: 'block' 做单行省略,type: 'line' 使用 line 行截断,默认按单行处理。popoverText: true 把当前文本写入原生 title,不创建 Popover。挂载和更新时写入样式;切换模式或关掉悬浮文本不会自动删除上一次写入的样式或 title。经常切换的场景可以改用组件库的省略组件,或切换节点 key。

vue
<template>
+</template>
  • options.leading / trailing 决定在等待周期首尾是否执行;防抖还可设 maxWait。挂载时读取绑定值,更新不会重绑。若回调依赖变动数据,让原函数在执行时读取响应式值。
  • 当前实现将监听器句柄保存在指令工厂闭包,多个绑定实例共用同一清理位置。需要同一指令同时绑多个元素或动态修改间隔时,在组件里单独创建防抖或节流函数并清理。
  • 防抖和节流只约束事件触发,异步请求仍需独立处理取消、并发或幂等。

防抖源码 · 节流源码

v-ellipsis ​

width 必填,数字按像素;字符串可传 CSS 尺寸。type: 'block' 做单行省略,type: 'line' 使用 line 行截断,默认按单行处理。popoverText: true 把当前文本写入原生 title,不创建 Popover。挂载和更新时写入样式;切换模式或关掉悬浮文本不会自动删除上一次写入的样式或 title。经常切换的场景可以改用组件库的省略组件,或切换节点 key。

vue
<template>
   <p v-ellipsis="{ type: 'line', line: 2, width: 240, popoverText: true }">
     这里放较长的说明文字,超出两行后会被省略。
   </p>
-</template>

源码

v-ripple ​

省略绑定值或传 true 启用,false 关闭。绑定对象 { class: '...' } 可指定波纹样式。.center 从中心扩散,.circle 使用圆形计算。通过 pointer 事件渲染,属于视觉反馈,交互语义仍由外层按钮负责。

vue
<template>
+</template>

源码

v-ripple ​

省略绑定值或传 true 启用,false 关闭。绑定对象 { class: '...' } 可指定波纹样式。.center 从中心扩散,.circle 使用圆形计算。通过 pointer 事件渲染,属于视觉反馈,交互语义仍由外层按钮负责。

vue
<template>
   <button type="button" v-ripple.center.circle>查看详情</button>
-</template>

源码 · 绑定与清理

v-disabled ​

接收布尔值并修改原生 disabled 属性和模板禁用样式。当前实现关闭禁用时仍会写入空的 disabled 属性,HTML 原生按钮将继续视为禁用。因此原生控件使用 :disabled="busy",Naive UI 使用对应 disabled prop。对自定义控件,要同时处理指针、键盘与可访问状态;样式不能取代业务权限检查。

源码

新增指令 ​

每个指令放在单独目录,工厂默认导出。可用 CustomDirectiveFC<HTMLElement, T> 标注绑定值。在 mounted 取得元素,在 updated 处理值更新,在 beforeUnmount 释放事件、计时器和第三方实例。多个元素需要独立数据时,把状态放在元素关联的 WeakMap,避免用单个变量保存全部实例的资源。

ts
import type { CustomDirectiveFC } from '@/directives/types'
+</template>

源码 · 绑定与清理

v-disabled ​

接收布尔值并修改原生 disabled 属性和模板禁用样式。当前实现关闭禁用时仍会写入空的 disabled 属性,HTML 原生按钮将继续视为禁用。因此原生控件使用 :disabled="busy",Naive UI 使用对应 disabled prop。对自定义控件,要同时处理指针、键盘与可访问状态;样式不能取代业务权限检查。

源码

新增指令 ​

每个指令放在单独目录,工厂默认导出。可用 CustomDirectiveFC<HTMLElement, T> 标注绑定值。在 mounted 取得元素,在 updated 处理值更新,在 beforeUnmount 释放事件、计时器和第三方实例。多个元素需要独立数据时,把状态放在元素关联的 WeakMap,避免用单个变量保存全部实例的资源。

ts
import type { CustomDirectiveFC } from '@/directives/types'
 
 const focusWhen: CustomDirectiveFC<HTMLElement, boolean> = () => ({
   mounted(el, { value }) {
@@ -85,8 +85,8 @@
   },
 })
 
-export default focusWhen

将示例保存为 packages/directives/src/modules/focus-when/index.ts,在组件中用 v-focus-when。目录名按现有约定用单段小写 kebab-case。注册器要求默认导出函数,缺失会抛错。

注册入口 · 指令类型

- +export default focusWhen

将示例保存为 packages/directives/src/modules/focus-when/index.ts,在组件中用 v-focus-when。目录名按现有约定用单段小写 kebab-case。注册器要求默认导出函数,缺失会抛错。

注册入口 · 指令类型

+ \ No newline at end of file diff --git a/docs/reference/hooks.html b/docs/reference/hooks.html index 03d3f007..6fb0455a 100644 --- a/docs/reference/hooks.html +++ b/docs/reference/hooks.html @@ -13,14 +13,14 @@ - + -
跳转到正文

Hooks ​

模板的公开 Hooks 从 @/hooks 导入。与具体组件一起使用的 useForm、useModal、useChart、useFlow 从 @/components 导入,请看对应组件页。useRequest 从 @/axios 导入。

需求API
跳转页面,切换首页,操作标签和菜单标记导航与菜单
内容最大化、重载或滚动布局与滚动
主题、语言、水印主题与国际化
分页与右键菜单组件交互
窗口尺寸、元素全屏和日期窗口与日期
DOM 截图、打印截图与打印

需要订阅、事件或清理的 Hook 在 setup() 或有效的 Vue effect scope 中创建。在 DOM 挂载后或用户操作时执行截图、打印和全屏。BasicTarget 接受元素、ref 或 getter,解析规则和可用元素类型见Vue 与 DOM 目标。

项目保留 @/hooks/web/useI18n、@/hooks/web/useVueRouter、@/hooks/web/usePagination 作为兼容导入。新代码统一从 @/hooks 导入。实现和测试入口见源码 Hooks 索引。

- +
跳转到正文

Hooks ​

模板的公开 Hooks 从 @/hooks 导入。与具体组件一起使用的 useForm、useModal、useChart、useFlow 从 @/components 导入,请看对应组件页。useRequest 从 @/axios 导入。

需求API
跳转页面,切换首页,操作标签和菜单标记导航与菜单
内容最大化、重载或滚动布局与滚动
主题、语言、水印主题与国际化
分页与右键菜单组件交互
窗口尺寸、元素全屏和日期窗口与日期
DOM 截图、打印截图与打印

需要订阅、事件或清理的 Hook 在 setup() 或有效的 Vue effect scope 中创建。在 DOM 挂载后或用户操作时执行截图、打印和全屏。BasicTarget 接受元素、ref 或 getter,解析规则和可用元素类型见Vue 与 DOM 目标。

项目保留 @/hooks/web/useI18n、@/hooks/web/useVueRouter、@/hooks/web/usePagination 作为兼容导入。新代码统一从 @/hooks 导入。实现和测试入口见源码 Hooks 索引。

+ \ No newline at end of file diff --git a/docs/reference/hooks/appearance.html b/docs/reference/hooks/appearance.html index ce438d1c..e366fed7 100644 --- a/docs/reference/hooks/appearance.html +++ b/docs/reference/hooks/appearance.html @@ -13,7 +13,7 @@ - + @@ -44,8 +44,8 @@ }, disable: hiddenWatermark, } -}

源码:useTheme · useI18n · useWatermark

- +}

源码:useTheme · useI18n · useWatermark

+ \ No newline at end of file diff --git a/docs/reference/hooks/browser.html b/docs/reference/hooks/browser.html index 67c5e46d..85592fd6 100644 --- a/docs/reference/hooks/browser.html +++ b/docs/reference/hooks/browser.html @@ -16,7 +16,7 @@ - + @@ -66,8 +66,8 @@ const day = useDayjs() export const exportDate = day.format('2026-11-03', { format: 'YYYY-MM-DD' }) -export const dayRange = day.getStartAndEndOfDay()

源码:useDevice · useElementFullscreen · useDayjs

- +export const dayRange = day.getStartAndEndOfDay()

源码:useDevice · useElementFullscreen · useDayjs

+ \ No newline at end of file diff --git a/docs/reference/hooks/interaction.html b/docs/reference/hooks/interaction.html index b01fe3de..c9e0cbc7 100644 --- a/docs/reference/hooks/interaction.html +++ b/docs/reference/hooks/interaction.html @@ -13,7 +13,7 @@ - + @@ -52,8 +52,8 @@ </div> ) }, -})

源码:usePagination · useContextmenuCoordinate

- +})

源码:usePagination · useContextmenuCoordinate

+ \ No newline at end of file diff --git a/docs/reference/hooks/layout.html b/docs/reference/hooks/layout.html index 3d11d68f..86604c34 100644 --- a/docs/reference/hooks/layout.html +++ b/docs/reference/hooks/layout.html @@ -13,7 +13,7 @@ - + @@ -46,8 +46,8 @@ toTop: () => scrollContent(0, 0), toMenuTop: () => scrollSider(0, 0), } -}

源码:useMaximize · useSpinning · useContentScroll · useSiderScroll

- +}

源码:useMaximize · useSpinning · useContentScroll · useSiderScroll

+ \ No newline at end of file diff --git a/docs/reference/hooks/navigation.html b/docs/reference/hooks/navigation.html index e426b7d0..7d4b6a85 100644 --- a/docs/reference/hooks/navigation.html +++ b/docs/reference/hooks/navigation.html @@ -13,7 +13,7 @@ - + @@ -51,8 +51,8 @@ const path = '/tables/remote' return (count: number) => count > 0 ? show(path, { label: count, type: 'info' }) : hidden(path) -}

源码:useAppNavigation · useAppRoot · useSiderBar · useBadge · useVueRouter

- +}

源码:useAppNavigation · useAppRoot · useSiderBar · useBadge · useVueRouter

+ \ No newline at end of file diff --git a/docs/reference/hooks/output.html b/docs/reference/hooks/output.html index c3c0aea5..720f77a9 100644 --- a/docs/reference/hooks/output.html +++ b/docs/reference/hooks/output.html @@ -13,7 +13,7 @@ - + @@ -40,8 +40,8 @@ documentTitle: '库存报表', }) return { report, print } -}

TablePro 内置打印按当前页和可见列生成报表。要保留自定义业务排版,参考 TablePro 打印。

源码:useDomToImage · usePrint

- +}

TablePro 内置打印按当前页和可见列生成报表。要保留自定义业务排版,参考 TablePro 打印。

源码:useDomToImage · usePrint

+ \ No newline at end of file diff --git a/docs/reference/icons.html b/docs/reference/icons.html index fa7667d8..a1b7f484 100644 --- a/docs/reference/icons.html +++ b/docs/reference/icons.html @@ -13,7 +13,7 @@ - + @@ -24,8 +24,8 @@ const name: IconName = 'directional/resize_h' -const renderIcon = () => <RIcon name={name} size={24} />

RIcon.name 和路由 meta.icon 使用同一套完整分包名。将 SVG 加入 packages/icons/src/<分包>,例如 packages/icons/src/business/orders/approved.svg 对应 business/orders/approved。可在演示的 SVG 图标页面查找并复制用法。

添加和生成 ​

  1. 选择现有分包(如 action、navigation、system),或按业务新建分包。路径段使用小写字母、数字、下划线或连字符,且以字母开头。
  2. 单色图标用 currentColor,留白用 none。品牌和插画保留原色。
  3. 开发服务或 pnpm icons:generate 更新 packages/icons/src/manifest.ts;检查 pnpm icons:check,与 SVG 一起提交。不要手改联合类型。

生产时每个顶层分包生成独立、带 hash 的雪碧图,资源随部署 base 加载。迁移时直接改旧代码的裸名称;旧缓存仅当文件名唯一时自动转换。

图标流程与分包表

RIcon API ​

RIcon、IconProps、iconProps、IconName 和 IconPackage 从 @/components 导出。也可从 @/icons 导入图标类型。

属性默认说明
name必填完整的分包路径,首段用于选择雪碧图。
size14基础宽高,数字按像素,也可传 CSS 尺寸。
width / height0 / 0分别覆盖基础尺寸,0 回退到 size。
color'currentColor'SVG 填充色;带原色的品牌和插画不会全部被覆盖。
prefix'icon'symbol 前缀,须与生成配置一致。
customClassName无根元素的额外类名。
depth1图标透明层级。
cursor'default'指针样式。
onClick(event)无支持函数或回调数组。

图标内部 SVG 对读屏隐藏。如果用图标触发操作,把它放进具有可访问名称的按钮内,保留键盘操作和焦点。

RIcon Props · 雪碧图引用实现

- +const renderIcon = () => <RIcon name={name} size={24} />

RIcon.name 和路由 meta.icon 使用同一套完整分包名。将 SVG 加入 packages/icons/src/<分包>,例如 packages/icons/src/business/orders/approved.svg 对应 business/orders/approved。可在演示的 SVG 图标页面查找并复制用法。

添加和生成 ​

  1. 选择现有分包(如 action、navigation、system),或按业务新建分包。路径段使用小写字母、数字、下划线或连字符,且以字母开头。
  2. 单色图标用 currentColor,留白用 none。品牌和插画保留原色。
  3. 开发服务或 pnpm icons:generate 更新 packages/icons/src/manifest.ts;检查 pnpm icons:check,与 SVG 一起提交。不要手改联合类型。

生产时每个顶层分包生成独立、带 hash 的雪碧图,资源随部署 base 加载。迁移时直接改旧代码的裸名称;旧缓存仅当文件名唯一时自动转换。

图标流程与分包表

RIcon API ​

RIcon、IconProps、iconProps、IconName 和 IconPackage 从 @/components 导出。也可从 @/icons 导入图标类型。

属性默认说明
name必填完整的分包路径,首段用于选择雪碧图。
size14基础宽高,数字按像素,也可传 CSS 尺寸。
width / height0 / 0分别覆盖基础尺寸,0 回退到 size。
color'currentColor'SVG 填充色;带原色的品牌和插画不会全部被覆盖。
prefix'icon'symbol 前缀,须与生成配置一致。
customClassName无根元素的额外类名。
depth1图标透明层级。
cursor'default'指针样式。
onClick(event)无支持函数或回调数组。

图标内部 SVG 对读屏隐藏。如果用图标触发操作,把它放进具有可访问名称的按钮内,保留键盘操作和焦点。

RIcon Props · 雪碧图引用实现

+ \ No newline at end of file diff --git a/docs/reference/index.html b/docs/reference/index.html index 83acdf59..d86c8d7f 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -20,7 +20,7 @@
跳转到正文

API 参考 ​

这里按调用入口组织。首次开发页面可以从开发指南走一遍,查具体 API 时从下列索引进入。

领域内容
组件通用组件、属性、事件、插槽、实例方法和 Provider
Hooks导航、状态、分页、浏览器能力及副作用边界
指令绑定值、修饰符、更新和卸载规则
Store状态字段、Getter、Action 和持久化契约
工具函数类型、数值、DOM、文件和缓存
SVG 图标图标路径、类型生成和 RIcon
应用配置主题、路由、国际化、请求和构建入口

各页以文档标明的源码版本为准。示例假设已在 Ray Template 项目中使用 @ 别名和默认应用上下文。

- + \ No newline at end of file diff --git a/docs/reference/source.html b/docs/reference/source.html index 4a74ac0e..2259d19b 100644 --- a/docs/reference/source.html +++ b/docs/reference/source.html @@ -13,14 +13,14 @@ - + -
跳转到正文
参考

文档与源码版本 ​

本站面向 Ray Template 6.0.0。Ray Admin、文档示例和共享包位于同一仓库。页内示例使用构建时同一工作区的包,发布构建的源码链接指向对应提交。

版本源码与说明
v6Ray Template 当前源码 · Monorepo 架构 · 版本分界与接入说明
v5legacy/v5 停在 6f095b7,已有 v5.2.4 标签保留。
旧文档历史旧文档仓库 · 旧版正文快照

源码版本号、Git 标签和网站部署各有进度。需要重现行为时,请记录具体标签或提交。报告问题时请注明使用的是 v5 还是 v6,并附上页面或模块入口。问题反馈

- +
跳转到正文
参考

文档与源码版本 ​

本站面向 Ray Template 6.0.0。Ray Admin、文档示例和共享包位于同一仓库。页内示例使用构建时同一工作区的包,发布构建的源码链接指向对应提交。

版本源码与说明
v6Ray Template 当前源码 · Monorepo 架构 · 版本分界与接入说明
v5legacy/v5 停在 6f095b7,已有 v5.2.4 标签保留。
旧文档历史旧文档仓库 · 旧版正文快照

源码版本号、Git 标签和网站部署各有进度。需要重现行为时,请记录具体标签或提交。报告问题时请注明使用的是 v5 还是 v6,并附上页面或模块入口。问题反馈

+ \ No newline at end of file diff --git a/docs/reference/store.html b/docs/reference/store.html index f2ca29d7..bfc66fda 100644 --- a/docs/reference/store.html +++ b/docs/reference/store.html @@ -13,14 +13,14 @@ - + -
跳转到正文

Store ​

模板使用 Pinia 管理跨页面状态。业务代码从 @/store 导入相应的 Getters / Actions,读取引用用 .value,修改走动作。只属于一个组件或页面的状态可以继续用本地 ref。

Store访问入口持久化
SettinguseSettingGetters / useSettingActionsLocal Storage piniaSettingStore,排除锁屏设置弹窗显隐;当前语言另外保存。
MenuuseMenuGetters / useMenuActionsLocal Storage 保存当前菜单和折叠状态;标签列表另存 Session Storage。
KeepAliveuseKeepAliveGetters / useKeepAliveActionsSession Storage 保存可缓存组件名。
RuntimeuseRuntimeGetters / useRuntimeActions无;随当前 Pinia 实例释放。
Lock ScreenuseLockScreenGetters / useLockScreenActionsLocal Storage 的历史布尔值,支持跨标签同步。
SigninguseSigningGetters / useSigningActionsLocal Storage 持久化账号显示信息,路由守卫另读 token。

初始化与扩展 ​

setupStore(app) 安装 Pinia 与持久化插件,应用卸载时释放 Pinia 实例及作用域。模板入口已调用,业务代码无需再次注册。Menu 与 Signing 依赖 Router 注入,请在应用组件的有效 setup 中访问。

新增 Store 在 apps/admin/src/store/modules 按领域建目录并指定唯一 ID。需要持久化时使用 pick 或 omit,选定存储范围和稳定的 key,只保存可序列化的值。调用接口放到 apps/admin/src/store/hooks,再由 apps/admin/src/store/index.ts 导出。原始 pinia…Store 同样公开给模板内部,但页面使用 hooks 可以减少对实现字段的直接依赖。

缓存键和 JSON 结构是已有数据契约。换 key、拆字段或改变序列化格式时,要考虑旧数据的读取、迁移和回退。浏览器缓存不应保存服务端密钥。

初始化与公开导出 · Store 源码约定

- +
跳转到正文

Store ​

模板使用 Pinia 管理跨页面状态。业务代码从 @/store 导入相应的 Getters / Actions,读取引用用 .value,修改走动作。只属于一个组件或页面的状态可以继续用本地 ref。

Store访问入口持久化
SettinguseSettingGetters / useSettingActionsLocal Storage piniaSettingStore,排除锁屏设置弹窗显隐;当前语言另外保存。
MenuuseMenuGetters / useMenuActionsLocal Storage 保存当前菜单和折叠状态;标签列表另存 Session Storage。
KeepAliveuseKeepAliveGetters / useKeepAliveActionsSession Storage 保存可缓存组件名。
RuntimeuseRuntimeGetters / useRuntimeActions无;随当前 Pinia 实例释放。
Lock ScreenuseLockScreenGetters / useLockScreenActionsLocal Storage 的历史布尔值,支持跨标签同步。
SigninguseSigningGetters / useSigningActionsLocal Storage 持久化账号显示信息,路由守卫另读 token。

初始化与扩展 ​

setupStore(app) 安装 Pinia 与持久化插件,应用卸载时释放 Pinia 实例及作用域。模板入口已调用,业务代码无需再次注册。Menu 与 Signing 依赖 Router 注入,请在应用组件的有效 setup 中访问。

新增 Store 在 apps/admin/src/store/modules 按领域建目录并指定唯一 ID。需要持久化时使用 pick 或 omit,选定存储范围和稳定的 key,只保存可序列化的值。调用接口放到 apps/admin/src/store/hooks,再由 apps/admin/src/store/index.ts 导出。原始 pinia…Store 同样公开给模板内部,但页面使用 hooks 可以减少对实现字段的直接依赖。

缓存键和 JSON 结构是已有数据契约。换 key、拆字段或改变序列化格式时,要考虑旧数据的读取、迁移和回退。浏览器缓存不应保存服务端密钥。

初始化与公开导出 · Store 源码约定

+ \ No newline at end of file diff --git a/docs/reference/store/navigation.html b/docs/reference/store/navigation.html index 14a0b4b0..28f26146 100644 --- a/docs/reference/store/navigation.html +++ b/docs/reference/store/navigation.html @@ -13,7 +13,7 @@ - + @@ -25,8 +25,8 @@ const { getMenuKey, getMenuTagOptions } = useMenuGetters() const { getKeepAliveInclude } = useKeepAliveGetters() return { getMenuKey, getMenuTagOptions, getKeepAliveInclude } -}

Menu 实现 · Menu Hooks · KeepAlive 实现

- +}

Menu 实现 · Menu Hooks · KeepAlive 实现

+ \ No newline at end of file diff --git a/docs/reference/store/runtime.html b/docs/reference/store/runtime.html index 51e39be9..e7f3e435 100644 --- a/docs/reference/store/runtime.html +++ b/docs/reference/store/runtime.html @@ -13,7 +13,7 @@ - + @@ -31,8 +31,8 @@ setRuntimeState('globalSpinning', false) } } -}

全局状态是布尔值,不对并发任务计数。如果多个独立请求同时使用,先由调用方统一协调开关。

Lock Screen Store ​

useLockScreenGetters().getLocked 是实际锁屏状态。useLockScreenActions().setLocked(value) 写入同一个状态,默认 false,通过 isAppLockScreen 在 Local Storage 保存历史布尔格式并跨标签同步。

实际锁定与 setting.lockScreenSwitch 分开,后者只控制锁屏设置弹窗。默认锁屏组件处理本地口令和解锁逻辑;业务按钮应打开设置弹窗,直接写锁定布尔值不会为用户建立口令。它是本机界面遮挡,与服务端会话和授权独立。

Runtime 实现 · Lock Screen 实现 · 锁屏流程

- +}

全局状态是布尔值,不对并发任务计数。如果多个独立请求同时使用,先由调用方统一协调开关。

Lock Screen Store ​

useLockScreenGetters().getLocked 是实际锁屏状态。useLockScreenActions().setLocked(value) 写入同一个状态,默认 false,通过 isAppLockScreen 在 Local Storage 保存历史布尔格式并跨标签同步。

实际锁定与 setting.lockScreenSwitch 分开,后者只控制锁屏设置弹窗。默认锁屏组件处理本地口令和解锁逻辑;业务按钮应打开设置弹窗,直接写锁定布尔值不会为用户建立口令。它是本机界面遮挡,与服务端会话和授权独立。

Runtime 实现 · Lock Screen 实现 · 锁屏流程

+ \ No newline at end of file diff --git a/docs/reference/store/setting.html b/docs/reference/store/setting.html index cd15e462..05bf8feb 100644 --- a/docs/reference/store/setting.html +++ b/docs/reference/store/setting.html @@ -13,7 +13,7 @@ - + @@ -31,8 +31,8 @@ contentMaxWidth: 1200, }) return { config: getLayoutConfig, apply } -}

Getters 与 Actions · 状态类型 · 默认配置 · 持久化实现

- +}

Getters 与 Actions · 状态类型 · 默认配置 · 持久化实现

+ \ No newline at end of file diff --git a/docs/reference/store/signing.html b/docs/reference/store/signing.html index 66197009..96975025 100644 --- a/docs/reference/store/signing.html +++ b/docs/reference/store/signing.html @@ -13,7 +13,7 @@ - + @@ -26,8 +26,8 @@ const { getSigningCallback } = useSigningGetters() const { logout } = useSigningActions() return { name: computed(() => getSigningCallback.value?.name ?? ''), logout } -}

退出会清理当前来源的 Session Storage。多个业务共用同一来源时,接入方应明确其清理范围。动作还依赖已经挂载的消息 Provider 和 Router;从用户操作或已初始化的应用流程触发。

Signing 实现 · 类型 · 演示登录 · 权限守卫

- +}

退出会清理当前来源的 Session Storage。多个业务共用同一来源时,接入方应明确其清理范围。动作还依赖已经挂载的消息 Provider 和 Router;从用户操作或已初始化的应用流程触发。

Signing 实现 · 类型 · 演示登录 · 权限守卫

+ \ No newline at end of file diff --git a/docs/reference/table-pro.html b/docs/reference/table-pro.html index 44657768..135336c9 100644 --- a/docs/reference/table-pro.html +++ b/docs/reference/table-pro.html @@ -14,7 +14,7 @@ - + @@ -231,8 +231,8 @@ const renderTable = () => ( <RTablePro ref={table} columns={[{ title: '姓名', key: 'name' }]} data={[]} /> -)

实例还提供 setPage、setPageSize、downloadCsv、print 和 getTableInstance。扩展表格区域可用 title、toolbar、tableFooter、tableAction;错误区域用 error 插槽。

列设置与缓存 ​

每张表使用稳定且唯一的列 key。列设置可以勾选显示、调整根列顺序、固定或启用列宽调整;分组子列跟随根列。使用 columnStateKey 跨刷新保留隐藏列,按账户或租户隔离时将标识纳入 key。缓存不存数据、列定义、顺序、固定位置或列宽。调用方接管列配置可用 v-model:columns,返回包含隐藏列的完整定义。

打印与 CSV ​

默认取当前页可见数据列。打印按当前筛选和排序输出独立表格,不复刻 Vue 单元格、操作区、展开区或合并布局。报表等专用版式通过 printTableOptions.target 指定元素、ref 或 getter;单次调用可传 title 和专用 style。真实纸张输出由浏览器负责。

CSV 的 keepOriginalData 使用当前传给表格的整批数据,远端模式不会自动抓取全部页。列级 allowExport: false 可排除数据;getCsvCell / getCsvHeader 返回原始文本,由组件做 CSV 转义。

TablePro 完整契约 · 六种可运行示例 · v6 的变更

Props、事件和插槽 ​

Naive UI DataTable 的列定义、选择、展开、加载、空态和虚拟滚动继续使用。下面列出模板层的配置与覆盖行为。

配置默认 / 行为
bare默认关。隐藏标题及工具栏,省略 pagination 时不分页;显式搜索、底部插槽仍可使用。
autoHeight默认关;开启时让内部 DataTable 使用 flexHeight,适合有可用高度的布局。
tool默认开,控制打印、密度、全屏、列设置和外观等内置工具。关掉仍可用自定义 toolbar。
title字符串或 VNode。存在 title 插槽时优先渲染插槽。
pagination普通模式缺省开,false 关闭;对象透传 Naive UI Pagination。容器小于 600px 时默认简洁模式,显式 simple 优先。
pageSize默认 10;pagination.pageSize、pagination.defaultPageSize 依次优先。远端初始页读 pagination.defaultPage。
request / params配置 request 时组件管理远端数据。params 深层变化会从第 1 页重查。
search{ key, label, placeholder?, options? }[]。输入只更新草稿,提交才生效。
rowKey默认 row.id ?? row.key,业务数据缺少两者时必须提供稳定键。
columnStateKey缺省不持久化。传稳定标识可记住隐藏列。
downloadCsvTableOptions内置导出默认配置,模板实现使用 fileName、keepOriginalData。
printTableOptions打印配置,支持 target、title、style、formatHeader、formatCell。
contextMenuOptions / onContextMenuClick行右键菜单选项及选择回调 (key, option);回调不直接收到行。先调用业务 rowProps.onContextmenu,可用 preventDefault() 阻止打开。

常用事件有 onRequestError(error)(或 SFC @request-error)、onUpdatePage、onUpdatePageSize、onUpdate:columns。内部分页先变更,再触发外部事件。行选择、排序等依然沿用 DataTable 事件;需要服务端排序时,将条件写入 params。

插槽参数与位置
filters表格上方;接收 { submit(values) },传入字符串或数字键值,提交后回第一页。优先于内置 search。
title / toolbar标题区左侧 / 操作区右侧;bare 下两者隐藏。
notice正常情况下显示自定义提示。
error请求失败时替换 notice,接收 { reload }。未提供则显示错误和重试按钮。
tableFooter / tableActionDataTable 之后的额外区域。
其余插槽转给 Naive UI DataTable,例如空态和加载。

TableProInst 的 reload(resetPage?)、setPage(page)、setPageSize(size) 返回 Promise<void>。请求错误由事件报告并保留旧数据;该 Promise 的完成不能用作业务成功判据。getTableInstance() 可能为 null;print(options?) 返回 Promise<boolean> 表示是否发起预览;downloadCsv(options?) 发起浏览器下载。

远端请求将 params 与已提交筛选合并,后者覆盖同名项,页码字段最后由表格写入。关闭分页时也会删除传入的 page 和 pageSize。total 需要是非负安全整数,data 必须是数组。若筛选或删除数据后当前页超出范围,会收敛到最后一页,并在有结果时重查。

TablePro Props · 远端与分页实现 · 表格面板实现

- +)

实例还提供 setPage、setPageSize、downloadCsv、print 和 getTableInstance。扩展表格区域可用 title、toolbar、tableFooter、tableAction;错误区域用 error 插槽。

列设置与缓存 ​

每张表使用稳定且唯一的列 key。列设置可以勾选显示、调整根列顺序、固定或启用列宽调整;分组子列跟随根列。使用 columnStateKey 跨刷新保留隐藏列,按账户或租户隔离时将标识纳入 key。缓存不存数据、列定义、顺序、固定位置或列宽。调用方接管列配置可用 v-model:columns,返回包含隐藏列的完整定义。

打印与 CSV ​

默认取当前页可见数据列。打印按当前筛选和排序输出独立表格,不复刻 Vue 单元格、操作区、展开区或合并布局。报表等专用版式通过 printTableOptions.target 指定元素、ref 或 getter;单次调用可传 title 和专用 style。真实纸张输出由浏览器负责。

CSV 的 keepOriginalData 使用当前传给表格的整批数据,远端模式不会自动抓取全部页。列级 allowExport: false 可排除数据;getCsvCell / getCsvHeader 返回原始文本,由组件做 CSV 转义。

TablePro 完整契约 · 六种可运行示例 · v6 的变更

Props、事件和插槽 ​

Naive UI DataTable 的列定义、选择、展开、加载、空态和虚拟滚动继续使用。下面列出模板层的配置与覆盖行为。

配置默认 / 行为
bare默认关。隐藏标题及工具栏,省略 pagination 时不分页;显式搜索、底部插槽仍可使用。
autoHeight默认关;开启时让内部 DataTable 使用 flexHeight,适合有可用高度的布局。
tool默认开,控制打印、密度、全屏、列设置和外观等内置工具。关掉仍可用自定义 toolbar。
title字符串或 VNode。存在 title 插槽时优先渲染插槽。
pagination普通模式缺省开,false 关闭;对象透传 Naive UI Pagination。容器小于 600px 时默认简洁模式,显式 simple 优先。
pageSize默认 10;pagination.pageSize、pagination.defaultPageSize 依次优先。远端初始页读 pagination.defaultPage。
request / params配置 request 时组件管理远端数据。params 深层变化会从第 1 页重查。
search{ key, label, placeholder?, options? }[]。输入只更新草稿,提交才生效。
rowKey默认 row.id ?? row.key,业务数据缺少两者时必须提供稳定键。
columnStateKey缺省不持久化。传稳定标识可记住隐藏列。
downloadCsvTableOptions内置导出默认配置,模板实现使用 fileName、keepOriginalData。
printTableOptions打印配置,支持 target、title、style、formatHeader、formatCell。
contextMenuOptions / onContextMenuClick行右键菜单选项及选择回调 (key, option);回调不直接收到行。先调用业务 rowProps.onContextmenu,可用 preventDefault() 阻止打开。

常用事件有 onRequestError(error)(或 SFC @request-error)、onUpdatePage、onUpdatePageSize、onUpdate:columns。内部分页先变更,再触发外部事件。行选择、排序等依然沿用 DataTable 事件;需要服务端排序时,将条件写入 params。

插槽参数与位置
filters表格上方;接收 { submit(values) },传入字符串或数字键值,提交后回第一页。优先于内置 search。
title / toolbar标题区左侧 / 操作区右侧;bare 下两者隐藏。
notice正常情况下显示自定义提示。
error请求失败时替换 notice,接收 { reload }。未提供则显示错误和重试按钮。
tableFooter / tableActionDataTable 之后的额外区域。
其余插槽转给 Naive UI DataTable,例如空态和加载。

TableProInst 的 reload(resetPage?)、setPage(page)、setPageSize(size) 返回 Promise<void>。请求错误由事件报告并保留旧数据;该 Promise 的完成不能用作业务成功判据。getTableInstance() 可能为 null;print(options?) 返回 Promise<boolean> 表示是否发起预览;downloadCsv(options?) 发起浏览器下载。

远端请求将 params 与已提交筛选合并,后者覆盖同名项,页码字段最后由表格写入。关闭分页时也会删除传入的 page 和 pageSize。total 需要是非负安全整数,data 必须是数组。若筛选或删除数据后当前页超出范围,会收敛到最后一页,并在有结果时重查。

TablePro Props · 远端与分页实现 · 表格面板实现

+ \ No newline at end of file diff --git a/docs/reference/utils.html b/docs/reference/utils.html index 4e6baeb7..cf5c8bae 100644 --- a/docs/reference/utils.html +++ b/docs/reference/utils.html @@ -13,14 +13,14 @@ - + -
跳转到正文

工具函数 ​

@/utils 汇总模板公开工具。应用初始化或底层模块可以按职责从 @/utils/core、@/utils/cache、@/utils/files 等入口导入,避免加载无关依赖。历史 basic.ts 和 c/ 仍作为转发入口。

主题API
基础、日期与数值类型判断、PromiseLike、随机标识、错误处理、对象更新、日期范围、定点运算
缓存与兼容加密Local / Session Storage、前缀、历史 AES JSON
Vue 与浏览器ref / DOM 解包、样式、查询、下载、截图打印、侧栏定位

下载和打印需要在浏览器执行,响应式 DOM 工具应在 Vue 作用域内创建。缓存和文件 API 的泛型不校验外部数据结构;跨信任边界时先验证输入。

公开导出 · 实现与回归索引

- +
跳转到正文

工具函数 ​

@/utils 汇总模板公开工具。应用初始化或底层模块可以按职责从 @/utils/core、@/utils/cache、@/utils/files 等入口导入,避免加载无关依赖。历史 basic.ts 和 c/ 仍作为转发入口。

主题API
基础、日期与数值类型判断、PromiseLike、随机标识、错误处理、对象更新、日期范围、定点运算
缓存与兼容加密Local / Session Storage、前缀、历史 AES JSON
Vue 与浏览器ref / DOM 解包、样式、查询、下载、截图打印、侧栏定位

下载和打印需要在浏览器执行,响应式 DOM 工具应在 Vue 作用域内创建。缓存和文件 API 的泛型不校验外部数据结构;跨信任边界时先验证输入。

公开导出 · 实现与回归索引

+ \ No newline at end of file diff --git a/docs/reference/utils/browser.html b/docs/reference/utils/browser.html index 9935b8a9..864cbd25 100644 --- a/docs/reference/utils/browser.html +++ b/docs/reference/utils/browser.html @@ -13,7 +13,7 @@ - + @@ -22,8 +22,8 @@
跳转到正文

Vue 与浏览器工具 ​

Vue 目标解析 ​

BasicTarget<T> 可为元素、组件实例、ref、getter 或空值,unrefElement(target, fallback?) 在调用时解包;组件优先返回 $el。多根组件的 $el 未必是可操作的元素。截图、全屏、样式操作请优先绑定明确的原生 DOM ref。

工具行为
call(fnOrFns, ...args)调用一个函数或按顺序调用回调数组,透传参数。
renderNode(value, { defaultElement }?)规范化成渲染函数。仅 null 或 undefined 用回退,0 和空字符串保留。
effectDispose(cleanup)有当前 effect scope 时登记清理并返回 true,否则返回 false,需调用方自行释放。
watchEffectWithTarget(effect, options?)对 Vue watchEffect 的兼容入口,返回停止句柄;在有效作用域创建时会随作用域停止。

DOM、样式和尺寸 ​

API行为
setClass(target, names) / removeClass(target, names)作用于当前和后续替换的目标。支持空白分隔字符串或数组;移除时 removeAllClass 清空 class。
hasClass(target, names)返回响应式布尔值,任一完整类名匹配即为真。只随目标引用更新,外部改 class 属性本身不会触发重算。
setStyle(target, styles)支持样式对象、声明字符串或字符串数组,保留其他行内样式。支持 camelCase、CSS 自定义属性与 !important。
removeStyle(target, names)按 CSS 名称或 camelCase 删除行内样式。
autoPrefixStyle(name)返回原属性和历史前缀名的兼容映射,不执行 DOM 操作。
completeSize(value, unit = 'px')数字、纯数字字符串补单位,保留百分比、CSS 关键字和表达式。
colorToRgba(color, alpha = 1, fallback?)支持逗号形式 RGB/HSL 与常见 Hex。带透明度的 Hex 保留其透明度,未知格式回退到指定值或原字符串。
queryElements(selector, { defaultElement }?)返回 DOM 元素数组。attr:data-id 等同于属性选择器。无匹配返回空数组,空或非法选择器无回退时返回 null。
positionSelectedMenuItem()将已渲染且超出可视区的当前菜单滚入视野。调用前展开父级并等待 DOM 渲染。

类名与样式函数内部监听目标变化,在组件 setup 或 effect scope 内创建。SSR 下访问 document、window 的方法应推迟到挂载后。

文件、下载和打印 ​

API行为
fileToBase64(file)返回带 MIME 的 Data URL Promise,读取错误或中止会拒绝。
arrayBufferToBase64Image(buffer)把 PNG 字节加上 PNG Data URL 前缀,不转换其他图像格式。
downloadBase64File(url, fileName)以临时链接触发下载,清理链接。
downloadAnyFile(data, fileName)接收 Data URL、Blob、File、ArrayBuffer。二进制使用临时对象 URL;Promise 完成表示已发起下载。
printDom(target, { printOptions?, domToImageOptions? })先将 DOM 截成 JPEG,再发起打印预览。返回 Promise<boolean>;失败记录错误并返回 false,若存在全局 Loading Bar 会同步状态。
ts
import { downloadAnyFile, fileToBase64 } from '@/utils'
 
 export const previewFile = (file: File) => fileToBase64(file)
-export const downloadReport = (pdf: Blob) => downloadAnyFile(pdf, 'report.pdf')

DOM 工具 · 文件工具 · Vue 工具 · 截图与打印 Hooks

- +export const downloadReport = (pdf: Blob) => downloadAnyFile(pdf, 'report.pdf')

DOM 工具 · 文件工具 · Vue 工具 · 截图与打印 Hooks

+ \ No newline at end of file diff --git a/docs/reference/utils/core.html b/docs/reference/utils/core.html index 71fe0f1f..d5ecac95 100644 --- a/docs/reference/utils/core.html +++ b/docs/reference/utils/core.html @@ -13,7 +13,7 @@ - + @@ -109,8 +109,8 @@ precision: 2, type: 'string', }) -export const parts = distribute(10, 3, { precision: 2, type: 'string' })

分摊或货币结算由业务明确小数位和舍入规则。保留字符串或整数分值跨接口传输可避免展示时的二进制浮点误差。

基础函数 · 精度实现 · 日期选择器辅助

- +export const parts = distribute(10, 3, { precision: 2, type: 'string' })

分摊或货币结算由业务明确小数位和舍入规则。保留字符串或整数分值跨接口传输可避免展示时的二进制浮点误差。

基础函数 · 精度实现 · 日期选择器辅助

+ \ No newline at end of file diff --git a/docs/reference/utils/storage.html b/docs/reference/utils/storage.html index 2217a2e8..26ddd183 100644 --- a/docs/reference/utils/storage.html +++ b/docs/reference/utils/storage.html @@ -13,7 +13,7 @@ - + @@ -28,8 +28,8 @@ export const readOrderFilter = () => getStorage<{ status: string }>('order-filter', 'sessionStorage', options) export const clearOrderFilter = () => - removeStorage('order-filter', 'sessionStorage', options)

兼容 AES JSON ​

encrypt(data, key?) 返回 JSON 密文,decrypt(ciphertext, key?) 解码。可用字符串口令或 CryptoJS WordArray,同一数据须使用同类型和内容的 key。字符串沿用 OpenSSL 兼容格式,原始密钥使用随机 IV,字符串序列化为 IV:密文。错误密文或密钥会记录错误并返回 undefined,无法 JSON 序列化的输入会使加密抛错。

CRYPTO_KEY 是应用公开的历史兼容常量。这个工具用于读取既有本地数据(如演示锁屏),不能保护服务端密钥或替代认证。迁移格式时先保留对历史密文的读取能力。

缓存实现 · 加密 · 解密

- + removeStorage('order-filter', 'sessionStorage', options)

兼容 AES JSON ​

encrypt(data, key?) 返回 JSON 密文,decrypt(ciphertext, key?) 解码。可用字符串口令或 CryptoJS WordArray,同一数据须使用同类型和内容的 key。字符串沿用 OpenSSL 兼容格式,原始密钥使用随机 IV,字符串序列化为 IV:密文。错误密文或密钥会记录错误并返回 undefined,无法 JSON 序列化的输入会使加密抛错。

CRYPTO_KEY 是应用公开的历史兼容常量。这个工具用于读取既有本地数据(如演示锁屏),不能保护服务端密钥或替代认证。迁移格式时先保留对历史密文的读取能力。

缓存实现 · 加密 · 解密

+ \ No newline at end of file diff --git a/mockServer/mock-data.js b/mockServer/mock-data.js index dd38a760..7add8b3e 100644 --- a/mockServer/mock-data.js +++ b/mockServer/mock-data.js @@ -57,7 +57,7 @@ var person_mock_default = defineMock({ sortAge: query.sortAge === "ascend" || query.sortAge === "descend" ? query.sortAge : void 0 }) }); -// mock-data-1793772367335.js +// mock-data-1793772796074.js const mockList = [[person_mock_exports, "mock/demo/person.mock.ts"]].map(([mod, filepath]) => processRawData(mod.default || mod, filepath)); -var mock_data_1793772367335_default = processMockData(mockList); -export { mock_data_1793772367335_default as default }; +var mock_data_1793772796074_default = processMockData(mockList); +export { mock_data_1793772796074_default as default }; diff --git a/mockServer/mock-data.js.gz b/mockServer/mock-data.js.gz index 9cb98e28908a409c3e63e3568c174cf18ab51f01..e6628c79225aa494b4c62169c9588dc095d74a5e 100644 GIT binary patch delta 1142 zcmV-+1d02c37iR#6@S*jARUU7+%|3~FiwyJMS#R{(W!v zQ{SMEQ1sL%YS70hW|!2DYa_WxMf9&xNb;_<#t$%Z$*w?{(9ovUk$czb$ zKg}l3PPVghobn2(l&@NLhN8C1#xeXnR8ojsURSYdD#J^R-fM5p6ig;LPEVDrA%!=W z?=drxTZe3@%wpVz;YTXtsSuEY&x8n}k`uisFQw1{q>o|g^#mF)OciJ#h2?7O^`=sR zPXHAw5qJemh<{+SsPCdf>kbK`SD;BK>YPj$q1WqS)s(2%rN9J?YS8Pgg0a`*Q}Fk; zYxqCvnRP`*o*Bif;vFkOSi+o%1{3JNmU$zv4;D?KX;jr#KlWC(ZCYhG=!cB{SI!HKZ*AqA3>!mG8S&xYOC&s^aDb+Adk+E^NfBOf)%af0Gdeu)j~-UKh53 zAlrQi>-Zq(=A&g=U?F={ zg9R#|;%qx?!ebbYchG3KS~UCkm53C(Mzx9C$l5SP0=B7le}8MaW3U)7fKdPk8;Hb0 zv^wJYonr!r!y%Eo)I|dQfB*dZ^IyMw{`L2Ne*2?OW)ha<{*~7Kw{*9Eg@tW>4`8#C zqzfcSBMlR4OXTFk>#aIbqkF=tTHJDq45Vr#)6O&@Q>*yI^!NatOeUv4y?rs6z(Kry z8~FBKVvR6KD^1%Ft;m@_Q~w(71wlT=jV4&C4~Nc?CM`!L?x?5egC|ac?eT3ux4g< z;V857QRSC1k2-eT+`vvk&@#zUh#5B7sdbB0w?5tcuJ~Z=xpHCoMHHrCP2sWkA5uV^ IOBMHRxj$vrFnHwUJyTa(=#@o&Dxp^0Jo7z!GXDGt~N(%x<1B!@|z+mVKai zSi@Aw68dv)a8Qe;;MJg%+07uw`9PzZql(>Mf9&xNb;@o~ZGUnf+t zpJtP%uXnR@obn2(ly6#ghN8C1#xeXnR8ojseyC#AREC!rU2AX76ig;LPS2FAA%!N?-y;HR$!$!Px8ZDfstx zYxqCvxphTGo*Tuh;vFkOSi+o%1{3JNl6fPr4;D?KX;jr#KlawPZCYhzGEwxMJl|faZiLBKH&?Y*6jY`WZ znl?hbW+k?Z7aM=olvfVMR@^IjmB8q`&_1(|2|OHnz24fUWeS+wOGSTFy{cT1Nz`+4=dsEmJ zf^2soY~q8Un~#=hft@T@f6f(VbmWk3h?u4+^qJ1E%KLB%BS>H{8hdm^cC!%$`o6%a z2|@8wV(Bw*Wm4-R&gI|YjY0~iHxxP?e8 zM5`mN-#I35G#nDSOI;+;|M$Lm*$Uv$_GVM$gGPR0NOpg!Y@nmxL)7$5h2^_|| zw}Ef(CDsU&w9>Q-(Yma}ehJ_C(w&QqM50k5fqu+t9+Rq4n@Th@nJ3Wy;rTmy&rz^N z0!I(1wO2ABZD)t%Z(lH-GK<08wfu=PpF