ray-template/docs/assets/reference_components_route-transition.md.DiLEQcKJ.js

18 lines
8.0 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as a}from"./chunks/AdminExample.vue_vue_type_script_setup_true_lang.wPcM-fsm.js";import{o as t,c as n,a3 as i,E as e}from"./chunks/framework.D8G7yXPy.js";const o=JSON.parse('{"title":"RTransitionComponent","description":"","frontmatter":{},"headers":[],"relativePath":"reference/components/route-transition.md","filePath":"reference/components/route-transition.md"}'),h={name:"reference/components/route-transition.md"},d=Object.assign(h,{setup(l){return(p,s)=>(t(),n("div",null,[s[0]||(s[0]=i('<h1 id="rtransitioncomponent" tabindex="-1">RTransitionComponent <a class="header-anchor" href="#rtransitioncomponent" aria-label="Permalink to &quot;RTransitionComponent&quot;">​</a></h1><p><code>RTransitionComponent</code> 是模板的路由出口,组合 <code>RouterView</code>、<code>Transition</code>、<code>Suspense</code> 与 <code>KeepAlive</code>。它直接渲染匹配的路由组件,按 <code>route.fullPath</code> 标识实例;query 或 hash 的变化也可能换用不同实例。</p><table tabindex="0"><thead><tr><th>属性</th><th>默认</th><th>说明</th></tr></thead><tbody><tr><td><code>transitionPropName</code></td><td><code>&#39;fade&#39;</code></td><td>Vue Transition 类名前缀,应与应用已有样式匹配。</td></tr><tr><td><code>transitionMode</code></td><td><code>&#39;out-in&#39;</code></td><td>Vue Transition 模式。</td></tr><tr><td><code>transitionAppear</code></td><td><code>true</code></td><td>首次挂载也应用过渡。</td></tr></tbody></table><p><code>setting.keepAliveConfig</code> 控制全局启用、最大数量和排除名称。<code>KeepAlive.include</code> 来自 KeepAlive Store,加入队列的页面必须有与路由名一致的组件名。缓存队列的名称会保存到当前标签的 Session Storage,浏览器刷新仍会创建新组件实例。自定义布局插槽时,只在期望的路由层级放一个出口,避免重复渲染;过渡页面使用单根节点。</p><h2 id="交互示例" tabindex="-1">交互示例 <a class="header-anchor" href="#交互示例" aria-label="Permalink to &quot;交互示例&quot;">​</a></h2>',5)),e(a,{path:"/multi/multi-menu-one",title:"路由过渡和页面缓存",layout:""}),s[1]||(s[1]=i(`<details class="details custom-block"><summary>查看示例源码</summary><div class="language-tsx vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">tsx</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> CacheRouteExample </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;../../../components/CacheRouteExample&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineComponent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;MultiMenuOne&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> render</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">CacheRouteExample</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> title</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">this</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">$t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;showcase.multiOneTitle&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)}</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> description</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">this</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">$t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;showcase.multiOneDescription&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)}</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> /&gt;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> )</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">})</span></span></code></pre></div></details><div class="language-tsx vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">tsx</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { RTransitionComponent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;@/components&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> renderPageOutlet</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> () </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=&gt;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &lt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">RTransitionComponent</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> transitionPropName</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;fade&quot;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> transitionAppear</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">} /&gt;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div><p><a href="https://github.com/XiaoDaiGua-Ray/ray-template/blob/19ac1805a52f7ebe7387cceb56215da24f4a2e17/packages/admin-shell/src/RouteTransition.vue" target="_blank" rel="noreferrer">组件源码</a> · <a href="./../store/navigation.html#keepalive-store">缓存 Store</a> · <a href="./../../guide/routing.html#keepalive-排查">路由缓存排查</a></p>`,3))]))}});export{o as __pageData,d as default};