mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
128 lines
79 KiB
HTML
128 lines
79 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en-US" dir="ltr">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
<title>@fesjs/plugin-layout | Fes.js</title>
|
||
<meta name="description" content="一个好用的前端应用解决方案">
|
||
<link rel="preload stylesheet" href="/fes.js/assets/style.989bd2a0.css" as="style">
|
||
<script type="module" src="/fes.js/assets/app.488e4ae9.js"></script>
|
||
<link rel="preload" href="/fes.js/assets/inter-roman-latin.2ed14f66.woff2" as="font" type="font/woff2" crossorigin="">
|
||
<link rel="modulepreload" href="/fes.js/assets/chunks/framework.b31a4d00.js">
|
||
<link rel="modulepreload" href="/fes.js/assets/chunks/theme.9bcfc3f8.js">
|
||
<link rel="modulepreload" href="/fes.js/assets/reference_plugin_plugins_layout.md.6aabd804.lean.js">
|
||
<link rel="icon" href="/logo.png">
|
||
<script id="check-dark-light">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
||
</head>
|
||
<body>
|
||
<div id="app"><div class="Layout" data-v-600cd4bc><!--[--><!--]--><!--[--><span tabindex="-1" data-v-2d2e5156></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-2d2e5156> Skip to content </a><!--]--><!----><header class="VPNav" data-v-600cd4bc data-v-10c2e836><div class="VPNavBar has-sidebar" data-v-10c2e836 data-v-c6988a15><div class="container" data-v-c6988a15><div class="title" data-v-c6988a15><div class="VPNavBarTitle has-sidebar" data-v-c6988a15 data-v-e846412e><a class="title" href="/fes.js/" data-v-e846412e><!--[--><!--]--><!--[--><img class="VPImage logo" src="/fes.js/logo.png" alt data-v-21926a76><!--]--><!--[-->Fes.js<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-c6988a15><div class="curtain" data-v-c6988a15></div><div class="content-body" data-v-c6988a15><!--[--><!--]--><div class="VPNavBarSearch search" style="--vp-meta-key:'Meta';" data-v-c6988a15><!--[--><!----><div id="local-search"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg class="DocSearch-Search-Icon" width="20" height="20" viewBox="0 0 20 20" aria-label="search icon"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-c6988a15 data-v-6d4a3966><span id="main-nav-aria-label" class="visually-hidden" data-v-6d4a3966>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/fes.js/guide/" tabindex="0" data-v-6d4a3966 data-v-a55142e6 data-v-15014769><!--[-->指南<!--]--><!----></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/fes.js/reference/config/" tabindex="0" data-v-6d4a3966 data-v-a55142e6 data-v-15014769><!--[-->编译时配置<!--]--><!----></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/fes.js/reference/api/" tabindex="0" data-v-6d4a3966 data-v-a55142e6 data-v-15014769><!--[-->API<!--]--><!----></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/fes.js/reference/plugin/" tabindex="0" data-v-6d4a3966 data-v-a55142e6 data-v-15014769><!--[-->插件<!--]--><!----></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/fes.js/reference/cli/index.html" tabindex="0" data-v-6d4a3966 data-v-a55142e6 data-v-15014769><!--[-->CLI<!--]--><!----></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-6d4a3966 data-v-405aaae9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-405aaae9><span class="text" data-v-405aaae9><!----> v3.2.1 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-405aaae9><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-405aaae9><div class="VPMenu" data-v-405aaae9 data-v-14225c89><div class="items" data-v-14225c89><!--[--><!--[--><div class="VPMenuLink" data-v-14225c89 data-v-d28afc9d><a class="VPLink link" href="https://fesjs.mumblefe.cn/2.0/" target="_blank" rel="noreferrer" data-v-d28afc9d data-v-15014769><!--[-->v2.0<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-15014769><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-14225c89 data-v-d28afc9d><a class="VPLink link" href="https://fesjs.mumblefe.cn/1.0/" target="_blank" rel="noreferrer" data-v-d28afc9d data-v-15014769><!--[-->v1.0<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-15014769><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-6d4a3966 data-v-405aaae9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-405aaae9><span class="text" data-v-405aaae9><!----> 了解更多 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-405aaae9><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-405aaae9><div class="VPMenu" data-v-405aaae9 data-v-14225c89><div class="items" data-v-14225c89><!--[--><!--[--><div class="VPMenuLink" data-v-14225c89 data-v-d28afc9d><a class="VPLink link" href="https://github.com/WeBankFinTech/fes.js/blob/master/CHANGELOG.md" target="_blank" rel="noreferrer" data-v-d28afc9d data-v-15014769><!--[-->更新日志<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-15014769><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-14225c89 data-v-d28afc9d><a class="VPLink link" href="http://fes-design.mumblefe.cn/" target="_blank" rel="noreferrer" data-v-d28afc9d data-v-15014769><!--[-->fes-design<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-15014769><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-c6988a15 data-v-5db6483e><label title="toggle dark mode" data-v-5db6483e data-v-cd2add99><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" aria-checked="false" data-v-cd2add99 data-v-48d1a158><span class="check" data-v-48d1a158><span class="icon" data-v-48d1a158><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-cd2add99><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-cd2add99><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></label></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-c6988a15 data-v-f70744fe data-v-d7bdad6c><!--[--><a class="VPSocialLink" href="https://github.com/WeBankFinTech/fes.js" aria-label="github" target="_blank" rel="noopener" data-v-d7bdad6c data-v-c4402a71><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-c6988a15 data-v-3ce128b5 data-v-405aaae9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-405aaae9><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-405aaae9><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-405aaae9><div class="VPMenu" data-v-405aaae9 data-v-14225c89><!----><!--[--><!--[--><!----><div class="group" data-v-3ce128b5><div class="item appearance" data-v-3ce128b5><p class="label" data-v-3ce128b5>Appearance</p><div class="appearance-action" data-v-3ce128b5><label title="toggle dark mode" data-v-3ce128b5 data-v-cd2add99><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" aria-checked="false" data-v-cd2add99 data-v-48d1a158><span class="check" data-v-48d1a158><span class="icon" data-v-48d1a158><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-cd2add99><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-cd2add99><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></label></div></div></div><div class="group" data-v-3ce128b5><div class="item social-links" data-v-3ce128b5><div class="VPSocialLinks social-links-list" data-v-3ce128b5 data-v-d7bdad6c><!--[--><a class="VPSocialLink" href="https://github.com/WeBankFinTech/fes.js" aria-label="github" target="_blank" rel="noopener" data-v-d7bdad6c data-v-c4402a71><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-c6988a15 data-v-1cde4ba9><span class="container" data-v-1cde4ba9><span class="top" data-v-1cde4ba9></span><span class="middle" data-v-1cde4ba9></span><span class="bottom" data-v-1cde4ba9></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav" data-v-600cd4bc data-v-772b017f><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-772b017f><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-772b017f><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-772b017f>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-772b017f data-v-596c6466><button data-v-596c6466>Return to top</button><!----></div></div><aside class="VPSidebar" data-v-600cd4bc data-v-b7ba390f><div class="curtain" data-v-b7ba390f></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-b7ba390f><span class="visually-hidden" id="sidebar-aria-label" data-v-b7ba390f> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-b7ba390f><section class="VPSidebarItem level-0" data-v-b7ba390f data-v-f8e6bbce><!----><div class="items" data-v-f8e6bbce><!--[--><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/index.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>介绍</p><!--]--><!----></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-b7ba390f><section class="VPSidebarItem level-0 has-active" data-v-b7ba390f data-v-f8e6bbce><div class="item" role="button" tabindex="0" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><h2 class="text" data-v-f8e6bbce>Plugins</h2><!----></div><div class="items" data-v-f8e6bbce><!--[--><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/access.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-access</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/enums.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-enums</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/icon.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-icon</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/jest.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-jest</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link is-active has-active" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/layout.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-layout</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/locale.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-locale</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/model.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-model</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/request.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-request</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/vuex.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-vuex</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/qiankun.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-qiankun</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/windicss.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-windicss</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/sass.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-sass</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/editor.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-editor</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/pinia.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-pinia</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/watermark.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-watermark</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/login.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-login</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/plugins/swc.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>@fesjs/plugin-swc</p><!--]--><!----></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-b7ba390f><section class="VPSidebarItem level-0" data-v-b7ba390f data-v-f8e6bbce><div class="item" role="button" tabindex="0" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><h2 class="text" data-v-f8e6bbce>插件开发</h2><!----></div><div class="items" data-v-f8e6bbce><!--[--><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/dev/index.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>插件介绍</p><!--]--><!----></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-f8e6bbce data-v-f8e6bbce><div class="item" data-v-f8e6bbce><div class="indicator" data-v-f8e6bbce></div><a class="VPLink link link" href="/fes.js/reference/plugin/dev/api.html" data-v-f8e6bbce data-v-15014769><!--[--><p class="text" data-v-f8e6bbce>插件API</p><!--]--><!----></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-600cd4bc data-v-13c861a7><div class="VPDoc has-sidebar has-aside" data-v-13c861a7 data-v-9ca33bd6><!--[--><!--]--><div class="container" data-v-9ca33bd6><div class="aside" data-v-9ca33bd6><div class="aside-curtain" data-v-9ca33bd6></div><div class="aside-container" data-v-9ca33bd6><div class="aside-content" data-v-9ca33bd6><div class="VPDocAside" data-v-9ca33bd6 data-v-c111cd2e><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" data-v-c111cd2e data-v-a28777cb><div class="content" data-v-a28777cb><div class="outline-marker" data-v-a28777cb></div><div class="outline-title" data-v-a28777cb>本页目录</div><nav aria-labelledby="doc-outline-aria-label" data-v-a28777cb><span class="visually-hidden" id="doc-outline-aria-label" data-v-a28777cb> Table of Contents for current page </span><ul class="root" data-v-a28777cb data-v-36b4bfdb><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-c111cd2e></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-9ca33bd6><div class="content-container" data-v-9ca33bd6><!--[--><!--]--><!----><main class="main" data-v-9ca33bd6><div style="position:relative;" class="vp-doc _fes_js_reference_plugin_plugins_layout" data-v-9ca33bd6><div><h1 id="fesjs-plugin-layout" tabindex="-1">@fesjs/plugin-layout <a class="header-anchor" href="#fesjs-plugin-layout" aria-label="Permalink to "@fesjs/plugin-layout""></a></h1><h2 id="介绍" tabindex="-1">介绍 <a class="header-anchor" href="#介绍" aria-label="Permalink to "介绍""></a></h2><p>为了进一步降低研发成本,我们将布局利用 <code>fes.js</code> 插件的方式内置,只需通过简单的配置即可拥有布局,包括导航以及侧边栏。从而做到用户无需关心布局。</p><ul><li>侧边栏菜单数据根据路由中的配置自动生成。</li><li>布局,提供 <code>side</code>、 <code>top</code>、<code>mixin</code>、<code>left-right</code>、<code>top-left-right</code> 五种布局。</li><li>主题,提供 <code>light</code>、<code>dark</code> 两种主题。</li><li>默认实现对路由的 404、403 处理。</li><li>搭配 <a href="./access.html">@fesjs/plugin-access</a> 插件使用,可以完成对路由的权限控制。</li><li>搭配 <a href="./locale.html">@fesjs/plugin-locale</a> 插件使用,提供切换语言的能力。</li><li>支持自定义头部或者侧边栏区域。</li><li>菜单支持配置 icon。</li><li>菜单标题支持国际化。</li><li>可配置页面是否需要 layout。</li></ul><h2 id="启用方式" tabindex="-1">启用方式 <a class="header-anchor" href="#启用方式" aria-label="Permalink to "启用方式""></a></h2><p>在 <code>package.json</code> 中引入依赖:</p><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C792EA;">dependencies</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">"</span><span style="color:#FFCB6B;">@fesjs/fes</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">^3.0.0</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">"</span><span style="color:#FFCB6B;">@fesjs/plugin-layout</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">^5.0.0</span><span style="color:#89DDFF;">"</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">}</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">}</span></span></code></pre></div><h2 id="布局类型" tabindex="-1">布局类型 <a class="header-anchor" href="#布局类型" aria-label="Permalink to "布局类型""></a></h2><p>配置参数是 <code>navigation</code>, 布局有五种类型 <code>side</code>、<code>mixin</code> 、<code>top</code> 、<code>left-right</code>、<code>top-left-right</code>, 默认是 <code>side</code>。</p><h3 id="side" tabindex="-1">side <a class="header-anchor" href="#side" aria-label="Permalink to "side""></a></h3><img src="/fes.js/side.png" alt="side"><h3 id="top" tabindex="-1">top <a class="header-anchor" href="#top" aria-label="Permalink to "top""></a></h3><img src="/fes.js/top.png" alt="top"><h3 id="mixin" tabindex="-1">mixin <a class="header-anchor" href="#mixin" aria-label="Permalink to "mixin""></a></h3><img src="/fes.js/mixin.png" alt="mixin"><h3 id="left-right" tabindex="-1">left-right <a class="header-anchor" href="#left-right" aria-label="Permalink to "left-right""></a></h3><img src="/fes.js/left-right.png" alt="left-right"><img src="/fes.js/top-left-right.png" alt="top-left-right"><h3 id="页面个性化" tabindex="-1">页面个性化 <a class="header-anchor" href="#页面个性化" aria-label="Permalink to "页面个性化""></a></h3><p>可以为页面单独设置布局类型:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">import</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">defineRouteMeta</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;font-style:italic;">from</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">@fesjs/fes</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="color:#82AAFF;">defineRouteMeta</span><span style="color:#BABED8;">(</span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">layout</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">navigation</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">null,</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">}</span><span style="color:#BABED8;">)</span><span style="color:#89DDFF;">;</span></span></code></pre></div><p>当设置为 <code>null</code> 时,页面不使用布局。</p><h2 id="页面缓存" tabindex="-1">页面缓存 <a class="header-anchor" href="#页面缓存" aria-label="Permalink to "页面缓存""></a></h2><p>支持配置页面缓存,通过<a href="./../../../guide/route.html#扩展路由元信息">定义路由元信息</a>开启缓存:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">import</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">defineRouteMeta</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;font-style:italic;">from</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">@fesjs/fes</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="color:#82AAFF;">defineRouteMeta</span><span style="color:#BABED8;">(</span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">keep-alive</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#FF9CAC;">true</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">}</span><span style="color:#BABED8;">)</span><span style="color:#89DDFF;">;</span></span></code></pre></div><h3 id="处理嵌套路由" tabindex="-1">处理嵌套路由 <a class="header-anchor" href="#处理嵌套路由" aria-label="Permalink to "处理嵌套路由""></a></h3><p>Fes.js 里约定目录下有 <code>layout.vue</code> 时会生成嵌套路由,以 <code>layout.vue</code> 为该目录的公共父组件,layout.vue 中必须实现 <code><RouterView/></code>。如果嵌套路由下的页面设置了 <code>keep-alive</code>,则需要用 <code><Page/></code> 替换 <code><RouterView/></code>,<code><Page/></code>实现了页面缓存。</p><div class="language-vue"><button title="Copy Code" class="copy"></button><span class="lang">vue</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;"><</span><span style="color:#F07178;">template</span><span style="color:#89DDFF;">></span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;"><</span><span style="color:#F07178;">Page</span><span style="color:#89DDFF;"> /></span></span>
|
||
<span class="line"><span style="color:#89DDFF;"></</span><span style="color:#F07178;">template</span><span style="color:#89DDFF;">></span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="color:#89DDFF;"><</span><span style="color:#F07178;">script</span><span style="color:#89DDFF;">></span></span>
|
||
<span class="line"><span style="color:#89DDFF;font-style:italic;">import</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">Page</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;font-style:italic;">from</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">@fesjs/fes</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;font-style:italic;">default</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">components</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> Page</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">};</span></span>
|
||
<span class="line"><span style="color:#89DDFF;"></</span><span style="color:#F07178;">script</span><span style="color:#89DDFF;">></span></span></code></pre></div><h2 id="配置" tabindex="-1">配置 <a class="header-anchor" href="#配置" aria-label="Permalink to "配置""></a></h2><h4 id="编译时配置方式" tabindex="-1">编译时配置方式 <a class="header-anchor" href="#编译时配置方式" aria-label="Permalink to "编译时配置方式""></a></h4><p>在 <code>.fes.js</code> 中配置:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;font-style:italic;">default</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">layout</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#89DDFF;"> </span><span style="color:#676E95;font-style:italic;">// 标题</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">title</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">Fes.js</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#89DDFF;"> </span><span style="color:#676E95;font-style:italic;">// 底部文字</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">footer</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">Created by MumbleFE</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#89DDFF;"> </span><span style="color:#676E95;font-style:italic;">// 主题light</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">theme</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">dark</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">menus</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> [</span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">index</span><span style="color:#89DDFF;">'</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">onepiece</span><span style="color:#89DDFF;">'</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">store</span><span style="color:#89DDFF;">'</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">simpleList</span><span style="color:#89DDFF;">'</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">}</span><span style="color:#BABED8;">]</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">};</span></span></code></pre></div><h4 id="运行时配置方式" tabindex="-1">运行时配置方式 <a class="header-anchor" href="#运行时配置方式" aria-label="Permalink to "运行时配置方式""></a></h4><p>在 <code>app.js</code> 中配置:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">import</span><span style="color:#BABED8;"> UserCenter </span><span style="color:#89DDFF;font-style:italic;">from</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">@/components/UserCenter</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">const</span><span style="color:#BABED8;"> layout </span><span style="color:#89DDFF;">=</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#82AAFF;">renderCustom</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">()</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">=></span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;"><</span><span style="color:#FFCB6B;">UserCenter</span><span style="color:#89DDFF;"> />,</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">menus</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> [</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">index</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> ]</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">};</span></span></code></pre></div><p>在<code>fes.js</code>中,运行时配置有定义对象和函数两种方式,当使用函数配置<code>layout</code>时,<code>layoutConfig</code>是编译时配置结果,<code>initialState</code>是 <code>beforeRender.action</code>执行后创建的应用初始状态数据。 。</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">function</span><span style="color:#BABED8;"> </span><span style="color:#82AAFF;">layout</span><span style="color:#89DDFF;">(</span><span style="color:#BABED8;font-style:italic;">layoutConfig</span><span style="color:#89DDFF;">,</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span><span style="color:#BABED8;"> </span><span style="color:#BABED8;font-style:italic;">initialState</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">})</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;font-style:italic;">return</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#82AAFF;">renderCustom</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">()</span><span style="color:#F07178;"> </span><span style="color:#C792EA;">=></span><span style="color:#F07178;"> </span><span style="color:#89DDFF;"><</span><span style="color:#FFCB6B;">UserCenter</span><span style="color:#89DDFF;"> />,</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#82AAFF;">menus</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">()</span><span style="color:#F07178;"> </span><span style="color:#C792EA;">=></span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#C792EA;">const</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">menusRef</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">=</span><span style="color:#F07178;"> </span><span style="color:#82AAFF;">ref</span><span style="color:#F07178;">(</span><span style="color:#BABED8;">layoutConfig</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">menus</span><span style="color:#F07178;">)</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#82AAFF;">watch</span><span style="color:#F07178;">(</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">()</span><span style="color:#F07178;"> </span><span style="color:#C792EA;">=></span><span style="color:#F07178;"> </span><span style="color:#BABED8;">initialState</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">userName</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">()</span><span style="color:#F07178;"> </span><span style="color:#C792EA;">=></span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#BABED8;">menusRef</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">value</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">=</span><span style="color:#F07178;"> [</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> name</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">store</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#F07178;"> ]</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#F07178;"> )</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;font-style:italic;">return</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">menusRef</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">};</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">}</span></span></code></pre></div><p>最终配置结果是运行时配置跟编译时配置合并的结果,运行时配置优先于编译时配置。</p><p>实际上运行配置能做的事情更多,推荐用运行时配置方式。</p><h3 id="footer" tabindex="-1">footer <a class="header-anchor" href="#footer" aria-label="Permalink to "footer""></a></h3><ul><li><p><strong>类型</strong>:<code>String</code></p></li><li><p><strong>默认值</strong>:<code>null</code></p></li><li><p><strong>详情</strong>:页面底部的文字。</p></li></ul><h3 id="theme" tabindex="-1">theme <a class="header-anchor" href="#theme" aria-label="Permalink to "theme""></a></h3><ul><li><p><strong>类型</strong>:<code>String</code></p></li><li><p><strong>默认值</strong>:<code>dark</code></p></li><li><p><strong>详情</strong>:主题,可选有 <code>dark</code>、<code>light</code></p></li></ul><h3 id="navigation" tabindex="-1">navigation <a class="header-anchor" href="#navigation" aria-label="Permalink to "navigation""></a></h3><ul><li><p><strong>类型</strong>:<code>String</code></p></li><li><p><strong>默认值</strong>:<code>side</code></p></li><li><p><strong>详情</strong>:页面布局类型,可选有 <code>side</code>、 <code>top</code>、 <code>mixin</code></p></li></ul><h3 id="navigationonerror" tabindex="-1">navigationOnError <a class="header-anchor" href="#navigationonerror" aria-label="Permalink to "navigationOnError""></a></h3><ul><li><p><strong>类型</strong>:<code>String</code>、<code>Function</code></p></li><li><p><strong>详情</strong>:指定 <code>403</code>、<code>404</code> 时,页面的布局类型。值同 <code>navigation</code>。也支持函数返回。</p></li></ul><h3 id="isfixedheader" tabindex="-1">isFixedHeader <a class="header-anchor" href="#isfixedheader" aria-label="Permalink to "isFixedHeader""></a></h3><ul><li><p><strong>类型</strong>:<code>Boolean</code></p></li><li><p><strong>默认值</strong>:<code>false</code></p></li><li><p><strong>详情</strong>:是否固定头部,不跟随页面滚动。</p></li></ul><h3 id="isfixedsidebar" tabindex="-1">isFixedSidebar <a class="header-anchor" href="#isfixedsidebar" aria-label="Permalink to "isFixedSidebar""></a></h3><ul><li><p><strong>类型</strong>:<code>Boolean</code></p></li><li><p><strong>默认值</strong>:<code>true</code></p></li><li><p><strong>详情</strong>:是否固定 sidebar,不跟随页面滚动。</p></li></ul><h3 id="title" tabindex="-1">title <a class="header-anchor" href="#title" aria-label="Permalink to "title""></a></h3><ul><li><p><strong>类型</strong>:<code>String</code></p></li><li><p><strong>默认值</strong>:默认为 <a href="./../../../reference/config/#title">编译时配置 title</a></p></li><li><p><strong>详情</strong>:产品名。</p></li></ul><h3 id="logo" tabindex="-1">logo <a class="header-anchor" href="#logo" aria-label="Permalink to "logo""></a></h3><ul><li><p><strong>类型</strong>:<code>String</code></p></li><li><p><strong>默认值</strong>:默认提供 <code>fes.js</code> 的 Logo</p></li><li><p><strong>详情</strong>:Logo 的链接,例如在 public/logo.png 放了一个 logo,可以这么配置(<a href="./../../../guide/env.html#process-env">BASE_URL 来自这里</a>)</p></li></ul><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">const</span><span style="color:#BABED8;"> layout </span><span style="color:#89DDFF;">=</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">logo</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">`${</span><span style="color:#BABED8;">process</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">env</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">BASE_URL</span><span style="color:#89DDFF;">}</span><span style="color:#C3E88D;">logo.png</span><span style="color:#89DDFF;">`</span><span style="color:#89DDFF;">,</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">};</span></span></code></pre></div><h3 id="multitabs" tabindex="-1">multiTabs <a class="header-anchor" href="#multitabs" aria-label="Permalink to "multiTabs""></a></h3><ul><li><p><strong>类型</strong>:<code>boolean</code></p></li><li><p><strong>默认值</strong>:<code>false</code></p></li><li><p><strong>详情</strong>:是否开启多页。</p></li></ul><h3 id="menus" tabindex="-1">menus <a class="header-anchor" href="#menus" aria-label="Permalink to "menus""></a></h3><ul><li><p><strong>类型</strong>:<code>[] | () => Ref<[]> | () => []</code></p></li><li><p><strong>默认值</strong>:<code>[]</code></p></li><li><p><strong>详情</strong>:菜单配置</p><p>子项具体配置如下:</p><ul><li><p><strong>name</strong>:菜单的名称。通过匹配 <code>name</code> 和路由元信息 <a href="./../../../guide/route.html#扩展路由元信息">meta</a> 中的 <code>name</code>,把菜单和路由关联起来, 然后使用路由元信息补充菜单配置,比如 <code>title</code>、<code>path</code> 等。</p></li><li><p><strong>path</strong>:菜单的路径,可配置第三方地址。</p></li><li><p><strong>query</strong>:同 vue-router 的 query 参数。</p></li><li><p><strong>params</strong>:同 vue-router 的 params 参数。</p></li><li><p><strong>match (v4.0.0+)</strong>:额外匹配的路径,当前路由命中匹配规则时,此菜单高亮。</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#babed8;">{</span></span>
|
||
<span class="line"><span style="color:#babed8;"> path: '/product',</span></span>
|
||
<span class="line"><span style="color:#babed8;"> match: ['/product/*', '/product/create']</span></span>
|
||
<span class="line"><span style="color:#babed8;">}</span></span></code></pre></div></li><li><p><strong>title</strong>:菜单的标题。</p><ul><li><p>如果同时使用<a href="./locale.html">国际化插件</a>,而且<code>title</code>的值以<code>$</code>开头,则使用<code>$</code>后面的内容去匹配语言设置。</p></li><li><p>title 支持配置函数,对应 Fes Design 中 Menu 组件的<code>label</code>插槽。仅在运行时配置中支持。</p></li></ul></li><li><p><strong>icon</strong>: 菜单的图标,只一级标题展示图标。</p><ul><li><p>图标使用<a href="https://fes-design-4gvn317r3b6bfe17-1254145788.ap-shanghai.app.tcloudbase.com/zh/components/icon.html" target="_blank" rel="noreferrer">fes-design icon</a>,编译时配置使用组件名称,我们会自动引入组件。</p></li><li><p>图标使用本地或者远程 svg 图片。</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#FFCB6B;">icon</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/wine-outline.svg</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">}</span></span></code></pre></div></li></ul></li><li><p><strong>children</strong>:子菜单配置。</p></li></ul></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>函数类型仅在运行时可用,可以实现动态变更菜单。</p></div><h3 id="menuprops" tabindex="-1">menuProps <a class="header-anchor" href="#menuprops" aria-label="Permalink to "menuProps""></a></h3><ul><li><p><strong>类型</strong>:<code>Object</code></p></li><li><p><strong>默认值</strong>:<code>{}</code></p></li><li><p><strong>详情</strong>:菜单的配置:</p><ul><li><p><strong>defaultExpandAll</strong>:是否默认展开全部菜单。</p></li><li><p><strong>expandedKeys</strong>:配置默认展开的菜单,需要传子项是菜单路径的数组。</p></li><li><p><strong>accordion</strong>:是否只保持一个子菜单的展开。</p></li></ul></li></ul><h3 id="sidewidth" tabindex="-1">sideWidth <a class="header-anchor" href="#sidewidth" aria-label="Permalink to "sideWidth""></a></h3><ul><li><p><strong>类型</strong>:<code>Number</code></p></li><li><p><strong>默认值</strong>:<code>200</code></p></li><li><p><strong>详情</strong>:sidebar 的宽度</p></li></ul><h3 id="rendercustom" tabindex="-1">renderCustom <a class="header-anchor" href="#rendercustom" aria-label="Permalink to "renderCustom""></a></h3><ul><li><p><strong>类型</strong>: <code>()=> VNodes</code></p></li><li><p><strong>默认值</strong>:<code>null</code></p></li><li><p><strong>详情</strong>: 自定义区域内容,仅运行时。</p></li></ul><h3 id="unaccesshandler" tabindex="-1">unAccessHandler <a class="header-anchor" href="#unaccesshandler" aria-label="Permalink to "unAccessHandler""></a></h3><ul><li><p><strong>类型</strong>:<code>({ to, from, next})=> void</code></p></li><li><p><strong>默认值</strong>:<code>null</code></p></li><li><p><strong>详情</strong>:仅运行时,当进入某个路由时,如果路由对应的页面不属于可见资源列表,则会暂停进入,调用 <code>unAccessHandler</code> 函数。</p></li><li><p><strong>参数</strong></p><ul><li>router:createRouter 创建的路由实例</li><li>to: 准备进入的路由</li><li>from:离开的路由</li><li>next: <a href="https://next.router.vuejs.org/zh/guide/advanced/navigation-guards.html#%E5%8F%AF%E9%80%89%E7%9A%84%E7%AC%AC%E4%B8%89%E4%B8%AA%E5%8F%82%E6%95%B0-next" target="_blank" rel="noreferrer">next 函数</a></li></ul></li></ul><p>比如:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">const</span><span style="color:#BABED8;"> layout </span><span style="color:#89DDFF;">=</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">unAccessHandler</span><span style="color:#89DDFF;">({</span><span style="color:#BABED8;"> </span><span style="color:#BABED8;font-style:italic;">to</span><span style="color:#89DDFF;">,</span><span style="color:#BABED8;"> </span><span style="color:#BABED8;font-style:italic;">next</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">})</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#C792EA;">const</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">accesssIds</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">=</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">accessApi</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">getAccess</span><span style="color:#F07178;">()</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;font-style:italic;">if</span><span style="color:#F07178;"> (</span><span style="color:#BABED8;">to</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">path</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">===</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/404</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">) </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#BABED8;">accessApi</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">setAccess</span><span style="color:#F07178;">(</span><span style="color:#BABED8;">accesssIds</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">concat</span><span style="color:#F07178;">([</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/404</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">]))</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;font-style:italic;">return</span><span style="color:#F07178;"> </span><span style="color:#82AAFF;">next</span><span style="color:#F07178;">(</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/404</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">)</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;font-style:italic;">if</span><span style="color:#F07178;"> (</span><span style="color:#89DDFF;">!</span><span style="color:#BABED8;">accesssIds</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">includes</span><span style="color:#F07178;">(</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/403</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">)) </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#BABED8;">accessApi</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">setAccess</span><span style="color:#F07178;">(</span><span style="color:#BABED8;">accesssIds</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">concat</span><span style="color:#F07178;">([</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/403</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">]))</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#82AAFF;">next</span><span style="color:#F07178;">(</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/403</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">)</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">};</span></span></code></pre></div><h3 id="nofoundhandler" tabindex="-1">noFoundHandler <a class="header-anchor" href="#nofoundhandler" aria-label="Permalink to "noFoundHandler""></a></h3><ul><li><p><strong>类型</strong>:<code>({ to, from, next})=> void</code></p></li><li><p><strong>默认值</strong>:<code>null</code></p></li><li><p><strong>详情</strong>:仅运行时,当进入某个路由时,如果路由对应的页面不存在,则会调用 <code>noFoundHandler</code> 函数。</p></li><li><p><strong>参数</strong></p><ul><li>router:createRouter 创建的路由实例</li><li>to: 准备进入的路由</li><li>from:离开的路由</li><li>next: <a href="https://next.router.vuejs.org/zh/guide/advanced/navigation-guards.html#%E5%8F%AF%E9%80%89%E7%9A%84%E7%AC%AC%E4%B8%89%E4%B8%AA%E5%8F%82%E6%95%B0-next" target="_blank" rel="noreferrer">next 函数</a></li></ul></li></ul><p>比如:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;font-style:italic;">export</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">const</span><span style="color:#BABED8;"> layout </span><span style="color:#89DDFF;">=</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#BABED8;"> </span><span style="color:#F07178;">noFoundHandler</span><span style="color:#89DDFF;">({</span><span style="color:#BABED8;"> </span><span style="color:#BABED8;font-style:italic;">next</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">})</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#C792EA;">const</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">accesssIds</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">=</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">accessApi</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">getAccess</span><span style="color:#F07178;">()</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;font-style:italic;">if</span><span style="color:#F07178;"> (</span><span style="color:#89DDFF;">!</span><span style="color:#BABED8;">accesssIds</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">includes</span><span style="color:#F07178;">(</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/404</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">)) </span><span style="color:#89DDFF;">{</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#BABED8;">accessApi</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">setAccess</span><span style="color:#F07178;">(</span><span style="color:#BABED8;">accesssIds</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">concat</span><span style="color:#F07178;">([</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/404</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">]))</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#82AAFF;">next</span><span style="color:#F07178;">(</span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">/404</span><span style="color:#89DDFF;">'</span><span style="color:#F07178;">)</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#F07178;"> </span><span style="color:#89DDFF;">},</span></span>
|
||
<span class="line"><span style="color:#89DDFF;">};</span></span></code></pre></div><h2 id="api" tabindex="-1">API <a class="header-anchor" href="#api" aria-label="Permalink to "API""></a></h2><h3 id="usetabtitle" tabindex="-1">useTabTitle <a class="header-anchor" href="#usetabtitle" aria-label="Permalink to "useTabTitle""></a></h3><p>类型定义如下:</p><div class="language-ts"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#C792EA;">function</span><span style="color:#BABED8;"> </span><span style="color:#82AAFF;">useTabTitle</span><span style="color:#89DDFF;">(</span><span style="color:#BABED8;font-style:italic;">title</span><span style="color:#89DDFF;">:</span><span style="color:#BABED8;"> </span><span style="color:#FFCB6B;">string</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">|</span><span style="color:#BABED8;"> </span><span style="color:#FFCB6B;">Ref</span><span style="color:#89DDFF;"><</span><span style="color:#FFCB6B;">string</span><span style="color:#89DDFF;">>):</span><span style="color:#BABED8;"> </span><span style="color:#FFCB6B;">void</span><span style="color:#89DDFF;">;</span></span></code></pre></div><p>当使用多页签模式时,在页面中使用 <code>useTabTitle</code> 可以自定义页面标签:</p><div class="language-vue"><button title="Copy Code" class="copy"></button><span class="lang">vue</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;"><</span><span style="color:#F07178;">script</span><span style="color:#BABED8;"> </span><span style="color:#C792EA;">setup</span><span style="color:#89DDFF;">></span></span>
|
||
<span class="line"><span style="color:#89DDFF;font-style:italic;">import</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">{</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">useRoute</span><span style="color:#89DDFF;">,</span><span style="color:#F07178;"> </span><span style="color:#BABED8;">useTabTitle</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">}</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;font-style:italic;">from</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">@fesjs/fes</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="color:#C792EA;">const</span><span style="color:#BABED8;"> titleRef </span><span style="color:#89DDFF;">=</span><span style="color:#BABED8;"> </span><span style="color:#82AAFF;">useTabTitle</span><span style="color:#BABED8;">(</span><span style="color:#89DDFF;">`</span><span style="color:#C3E88D;">详情-</span><span style="color:#89DDFF;">${</span><span style="color:#BABED8;">route</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">params</span><span style="color:#89DDFF;">?.</span><span style="color:#BABED8;">id</span><span style="color:#89DDFF;">}`</span><span style="color:#BABED8;">)</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="color:#676E95;font-style:italic;">// 如果要更新</span></span>
|
||
<span class="line"><span style="color:#BABED8;">titleRef</span><span style="color:#89DDFF;">.</span><span style="color:#BABED8;">value </span><span style="color:#89DDFF;">=</span><span style="color:#BABED8;"> </span><span style="color:#89DDFF;">'</span><span style="color:#C3E88D;">changed</span><span style="color:#89DDFF;">'</span><span style="color:#89DDFF;">;</span></span>
|
||
<span class="line"><span style="color:#89DDFF;"></</span><span style="color:#F07178;">script</span><span style="color:#89DDFF;">></span></span></code></pre></div><h2 id="_4-x-升级到-5-x" tabindex="-1">4.x 升级到 5.x <a class="header-anchor" href="#_4-x-升级到-5-x" aria-label="Permalink to "4.x 升级到 5.x""></a></h2><ol><li>个性化 layout 配置改为使用传入 navigation</li><li>customHeader 改为 renderCustom</li><li>fixedHeader 改为 isFixedHeader</li><li>menusConfig 改为 menuProps</li><li>fixedSideBar 改为 isFixedSidebar</li><li>去掉运行时 logo、header、sidebar 三个区域显示配置,请改为使用 navigation: left-right</li></ol></div></div></main><footer class="VPDocFooter" data-v-9ca33bd6 data-v-89b3d043><!--[--><!--]--><!----><div class="prev-next" data-v-89b3d043><div class="pager" data-v-89b3d043><a class="pager-link prev" href="/fes.js/reference/plugin/plugins/jest.html" data-v-89b3d043><span class="desc" data-v-89b3d043>Previous page</span><span class="title" data-v-89b3d043>@fesjs/plugin-jest</span></a></div><div class="has-prev pager" data-v-89b3d043><a class="pager-link next" href="/fes.js/reference/plugin/plugins/locale.html" data-v-89b3d043><span class="desc" data-v-89b3d043>Next page</span><span class="title" data-v-89b3d043>@fesjs/plugin-locale</span></a></div></div></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-600cd4bc data-v-0c8ff5c9><div class="container" data-v-0c8ff5c9><p class="message" data-v-0c8ff5c9>Released under the MIT License.</p><p class="copyright" data-v-0c8ff5c9>Copyright © 2020-present Webank</p></div></footer><!--[--><!--]--></div></div>
|
||
<script>__VP_HASH_MAP__ = JSON.parse("{\"guide_css.md\":\"db5fc79d\",\"guide_env.md\":\"ae9094ef\",\"guide_builder.md\":\"7aef2181\",\"guide_directory-structure.md\":\"f0919b75\",\"guide_config.md\":\"62eccd9f\",\"guide_contributing.md\":\"8666fd37\",\"guide_faq.md\":\"79254e2b\",\"guide_index.md\":\"d93ea205\",\"guide_getting-started.md\":\"91708ebd\",\"guide_public.md\":\"84526512\",\"guide_plugin.md\":\"7d7f4c03\",\"guide_image.md\":\"2e74f65f\",\"guide_mock.md\":\"8a0d04da\",\"reference_api.md\":\"5e62d83f\",\"reference_plugin_plugins_request.md\":\"a62289a7\",\"reference_plugin_plugins_jest.md\":\"d574f7ac\",\"guide_upgrade3.md\":\"1e41a4e9\",\"reference_plugin_plugins_access.md\":\"ba03251a\",\"reference_api_index.md\":\"72b9ecff\",\"reference_plugin_dev_index.md\":\"1a7b2210\",\"reference_plugin_plugins_pinia.md\":\"c7ff2416\",\"reference_plugin_plugins_editor.md\":\"59115d8d\",\"guide_route.md\":\"11dd4240\",\"guide_template.md\":\"0f61d40d\",\"reference_cli_index.md\":\"2702e581\",\"reference_plugin_plugins_sass.md\":\"aea91d6e\",\"reference_config_index.md\":\"94262ec5\",\"reference_plugin_index.md\":\"ee42a061\",\"reference_plugin_plugins_qiankun.md\":\"ec18784c\",\"reference_plugin_plugins_locale.md\":\"c271ad1f\",\"reference_plugin_plugins_model.md\":\"ef7fdf24\",\"reference_plugin_plugins_vuex.md\":\"3806c06f\",\"guide_runtime-config.md\":\"8d7d4f16\",\"reference_plugin_plugins_login.md\":\"c4b18ed3\",\"reference_plugin_plugins_watermark.md\":\"95337b01\",\"reference_plugin_plugins_windicss.md\":\"8deb5ce9\",\"reference_plugin_plugins_icon.md\":\"f2cb3f94\",\"reference_plugin_plugins_swc.md\":\"f887c1f1\",\"reference_plugin_plugins_layout.md\":\"6aabd804\",\"index.md\":\"729d6058\",\"reference_plugin_dev_api.md\":\"2d7e42be\",\"reference_plugin_plugins_request-4.md\":\"58780b87\",\"reference_plugin_plugins_enums.md\":\"9c0c3064\"}")
|
||
__VP_SITE_DATA__ = JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Fes.js\",\"description\":\"一个好用的前端应用解决方案\",\"base\":\"/fes.js/\",\"head\":[],\"appearance\":true,\"themeConfig\":{\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/WeBankFinTech/fes.js\"}],\"logo\":\"/logo.png\",\"nav\":[{\"text\":\"指南\",\"link\":\"/guide/\",\"activeMatch\":\"/guide/\"},{\"text\":\"编译时配置\",\"link\":\"/reference/config/\"},{\"text\":\"API\",\"link\":\"/reference/api/\"},{\"text\":\"插件\",\"link\":\"/reference/plugin/\",\"activeMatch\":\"/plugin/\"},{\"text\":\"CLI\",\"link\":\"/reference/cli/index.md\"},{\"text\":\"v3.2.1\",\"items\":[{\"text\":\"v2.0\",\"link\":\"https://fesjs.mumblefe.cn/2.0/\"},{\"text\":\"v1.0\",\"link\":\"https://fesjs.mumblefe.cn/1.0/\"}]},{\"text\":\"了解更多\",\"items\":[{\"text\":\"更新日志\",\"link\":\"https://github.com/WeBankFinTech/fes.js/blob/master/CHANGELOG.md\"},{\"text\":\"fes-design\",\"link\":\"http://fes-design.mumblefe.cn/\"}]}],\"sidebar\":{\"/guide/\":[{\"text\":\"开始\",\"items\":[{\"text\":\"介绍\",\"link\":\"/guide/index.md\"},{\"text\":\"快速上手\",\"link\":\"/guide/getting-started.md\"}]},{\"text\":\"基础\",\"items\":[{\"text\":\"目录结构\",\"link\":\"/guide/directory-structure.md\"},{\"text\":\"Vite 和 Webpack 双构建\",\"link\":\"/guide/builder.md\"},{\"text\":\"编译时配置\",\"link\":\"/guide/config.md\"},{\"text\":\"运行时配置\",\"link\":\"/guide/runtime-config.md\"},{\"text\":\"环境变量\",\"link\":\"/guide/env.md\"},{\"text\":\"路由\",\"link\":\"/guide/route.md\"},{\"text\":\"插件\",\"link\":\"/guide/plugin.md\"},{\"text\":\"HTML 模板\",\"link\":\"/guide/template.md\"},{\"text\":\"Mock 数据\",\"link\":\"/guide/mock.md\"},{\"text\":\"从 2.0.x 迁移到 3.0.x\",\"link\":\"/guide/upgrade3.md\"}]},{\"text\":\"样式和资源文件\",\"items\":[{\"text\":\"使用图片\",\"link\":\"/guide/image.md\"},{\"text\":\"使用 css\",\"link\":\"/guide/css.md\"},{\"text\":\"静态资源\",\"link\":\"/guide/public.md\"}]},{\"text\":\"贡献指南\",\"link\":\"/guide/contributing.md\"},{\"text\":\"常见问题\",\"link\":\"/guide/faq.md\"}],\"/reference/plugin/\":[{\"text\":\"介绍\",\"link\":\"/reference/plugin/index.md\"},{\"text\":\"Plugins\",\"items\":[{\"text\":\"@fesjs/plugin-access\",\"link\":\"/reference/plugin/plugins/access.md\"},{\"text\":\"@fesjs/plugin-enums\",\"link\":\"/reference/plugin/plugins/enums.md\"},{\"text\":\"@fesjs/plugin-icon\",\"link\":\"/reference/plugin/plugins/icon.md\"},{\"text\":\"@fesjs/plugin-jest\",\"link\":\"/reference/plugin/plugins/jest.md\"},{\"text\":\"@fesjs/plugin-layout\",\"link\":\"/reference/plugin/plugins/layout.md\"},{\"text\":\"@fesjs/plugin-locale\",\"link\":\"/reference/plugin/plugins/locale.md\"},{\"text\":\"@fesjs/plugin-model\",\"link\":\"/reference/plugin/plugins/model.md\"},{\"text\":\"@fesjs/plugin-request\",\"link\":\"/reference/plugin/plugins/request.md\"},{\"text\":\"@fesjs/plugin-vuex\",\"link\":\"/reference/plugin/plugins/vuex.md\"},{\"text\":\"@fesjs/plugin-qiankun\",\"link\":\"/reference/plugin/plugins/qiankun.md\"},{\"text\":\"@fesjs/plugin-windicss\",\"link\":\"/reference/plugin/plugins/windicss.md\"},{\"text\":\"@fesjs/plugin-sass\",\"link\":\"/reference/plugin/plugins/sass.md\"},{\"text\":\"@fesjs/plugin-editor\",\"link\":\"/reference/plugin/plugins/editor.md\"},{\"text\":\"@fesjs/plugin-pinia\",\"link\":\"/reference/plugin/plugins/pinia.md\"},{\"text\":\"@fesjs/plugin-watermark\",\"link\":\"/reference/plugin/plugins/watermark.md\"},{\"text\":\"@fesjs/plugin-login\",\"link\":\"/reference/plugin/plugins/login.md\"},{\"text\":\"@fesjs/plugin-swc\",\"link\":\"/reference/plugin/plugins/swc.md\"}]},{\"text\":\"插件开发\",\"items\":[{\"text\":\"插件介绍\",\"link\":\"/reference/plugin/dev/index.md\"},{\"text\":\"插件API\",\"link\":\"/reference/plugin/dev/api.md\"}]}]},\"outline\":{\"label\":\"本页目录\"},\"search\":{\"provider\":\"local\"},\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2020-present Webank\"}},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":false}")</script>
|
||
|
||
</body>
|
||
</html> |