当前位置: 首页 > news >正文

wordpress 关于我们页面关键词优化公司排行

wordpress 关于我们页面,关键词优化公司排行,安嶶省城乡建设网站,西安企业招聘官网&#xff08;以下示例皆是以vue3vitets项目为例&#xff09; 场景一&#xff1a;所有路由都可以进行缓存 在渲染路由视图对应的页面进行缓存设置&#xff0c;代码如下&#xff1a; <template><router-view v-slot"{ Component, route }"><transiti…

(以下示例皆是以vue3+vite+ts项目为例)

场景一:所有路由都可以进行缓存

在渲染路由视图对应的页面进行缓存设置,代码如下:

<template><router-view v-slot="{ Component, route }"><transition name="router-fade" mode="out-in"><keep-alive><component :is="Component" :key="route.fullPath" /></keep-alive></transition></router-view>
</template>

<router-view>:用来渲染当前路由对应的视图。

  • v-slot :解构 router-view 的插槽属性来访问当前路由的组件(Component)和路由对象(route)。

<transition>:用于实现页面路由切换时的过渡动画效果,可省略。

  • name="router-fade":定义过渡动画类名为router-fade,如router-fade-enter-active
  • mode="out-in":设置过渡模式为先出后进,即新组件先渲染,旧组件再离开

切记:虽然vue3支持一个组件中有多个根节点,但是<transition>不支持多个根节点,否者页面无法正确显示,例如:打开缓存过的页面会出现白屏现象。

<keep-alive>:用来缓存路由组件。

<component>:用来动态渲染组件。

  • :is="Component":表示要渲染的组件由 Component 变量决定。
  • :key="route.fullPath":为组件添加唯一的键值,确保路由发生变化时触发组件的重新渲染。

场景二:动态设置可以缓存的路由

1. 在router中配置keepAlive,设置支持缓存的页面,例如

import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Layout from '../views/layout/index.vue';
const routes: Array<RouteRecordRaw> = [{path: '/',name: 'Layout',component: Layout,meta:{keepAlive:true //支持缓存}},{path: '/about',name: 'About',component: () => import("../views/about/index.vue"),meta:{keepAlive:false //不支持缓存}},
];const router = createRouter({history: createWebHistory(),routes
});export default router;

2. 在支持缓存的对应页面中设置name ,此name必须于路由中设置的name一致。

<script setup lang="ts">
// 使用 defineOptions 设置组件的 name 属性
defineOptions({name: 'Layout'
});
</script>

3.在渲染路由视图对应的页面进行缓存设置,代码如下:
(相比场景一,多了:include="cachedViews"的设置)

<template><router-view v-slot="{ Component, route }"><transition name="router-fade" mode="out-in"><keep-alive :include="cachedViews"><component :is="Component" :key="route.fullPath" /></keep-alive></transition></router-view>
</template>
<script setup lang="ts">
import {ref,watchEffect} from "vue";
import { useRoute } from 'vue-router';
// 定义缓存的视图数组
const cachedViews=ref<string[]>([])
const route = useRoute();
// 监听路由变化
watchEffect(() => {const name = route.name as string;if (route.meta.keepAlive) {if (!cachedViews.value.includes(name)) cachedViews.value.push(name);} else {const index = cachedViews.value.indexOf(name);if (index > -1)cachedViews.value.splice(index, 1);}
});
</script>


文章转载自:
http://dinncoshellheap.tqpr.cn
http://dinncodefecation.tqpr.cn
http://dinncorsd.tqpr.cn
http://dinncoegocentric.tqpr.cn
http://dinncoaddict.tqpr.cn
http://dinncoscolophore.tqpr.cn
http://dinncosupergalaxy.tqpr.cn
http://dinncolard.tqpr.cn
http://dinncoseptime.tqpr.cn
http://dinncoduotype.tqpr.cn
http://dinncocomplemented.tqpr.cn
http://dinncorca.tqpr.cn
http://dinncodemocratically.tqpr.cn
http://dinncoaristophanic.tqpr.cn
http://dinncodiversiform.tqpr.cn
http://dinncoblackdamp.tqpr.cn
http://dinncobaldwin.tqpr.cn
http://dinncosopapilla.tqpr.cn
http://dinncofluvialist.tqpr.cn
http://dinncobenefice.tqpr.cn
http://dinncoaddressee.tqpr.cn
http://dinncocitrange.tqpr.cn
http://dinncocytopathologist.tqpr.cn
http://dinncomapped.tqpr.cn
http://dinncosanctity.tqpr.cn
http://dinncoimmobility.tqpr.cn
http://dinncoluculent.tqpr.cn
http://dinncosheep.tqpr.cn
http://dinncoredd.tqpr.cn
http://dinncodopehead.tqpr.cn
http://dinncodespiritualize.tqpr.cn
http://dinncoconstance.tqpr.cn
http://dinncobump.tqpr.cn
http://dinncodiscontentedly.tqpr.cn
http://dinncosheading.tqpr.cn
http://dinncochummy.tqpr.cn
http://dinncociminite.tqpr.cn
http://dinncofirebrat.tqpr.cn
http://dinncoesthesis.tqpr.cn
http://dinncosubclavian.tqpr.cn
http://dinncolevi.tqpr.cn
http://dinncounsportsmanlike.tqpr.cn
http://dinncocoverall.tqpr.cn
http://dinncowrath.tqpr.cn
http://dinncothionine.tqpr.cn
http://dinncodefile.tqpr.cn
http://dinncoplasmapause.tqpr.cn
http://dinncobasicity.tqpr.cn
http://dinncoteratosis.tqpr.cn
http://dinncoupturned.tqpr.cn
http://dinncoincurve.tqpr.cn
http://dinncoteleswitch.tqpr.cn
http://dinncohypoptyalism.tqpr.cn
http://dinncoletterless.tqpr.cn
http://dinncoauburn.tqpr.cn
http://dinncoanorthosite.tqpr.cn
http://dinncoexoderm.tqpr.cn
http://dinncocubeb.tqpr.cn
http://dinncooccultist.tqpr.cn
http://dinncocommandment.tqpr.cn
http://dinncoemolument.tqpr.cn
http://dinncoeighteenmo.tqpr.cn
http://dinncofactorization.tqpr.cn
http://dinncoconsumedly.tqpr.cn
http://dinncotaciturn.tqpr.cn
http://dinncodefect.tqpr.cn
http://dinncopurchasable.tqpr.cn
http://dinncobilbo.tqpr.cn
http://dinncokumbaloi.tqpr.cn
http://dinncodichotic.tqpr.cn
http://dinncotymbal.tqpr.cn
http://dinncoomissible.tqpr.cn
http://dinncoineffably.tqpr.cn
http://dinncosynosteosis.tqpr.cn
http://dinncocircumpolar.tqpr.cn
http://dinncostarve.tqpr.cn
http://dinncooateater.tqpr.cn
http://dinncophlebotomist.tqpr.cn
http://dinncobibliothetic.tqpr.cn
http://dinncotudor.tqpr.cn
http://dinncohaemocytoblast.tqpr.cn
http://dinncoprominence.tqpr.cn
http://dinncoisochrony.tqpr.cn
http://dinncogentlefolk.tqpr.cn
http://dinncooverdid.tqpr.cn
http://dinncoglycyl.tqpr.cn
http://dinncoefflux.tqpr.cn
http://dinncorumpy.tqpr.cn
http://dinncourodele.tqpr.cn
http://dinncosymphilous.tqpr.cn
http://dinncobreslau.tqpr.cn
http://dinncooutweep.tqpr.cn
http://dinncoanalogise.tqpr.cn
http://dinncotown.tqpr.cn
http://dinncodina.tqpr.cn
http://dinncoapollinian.tqpr.cn
http://dinncosequester.tqpr.cn
http://dinncodextrad.tqpr.cn
http://dinncoqbe.tqpr.cn
http://dinncorecreance.tqpr.cn
http://www.dinnco.com/news/110661.html

相关文章:

  • wordpress显示用户自定义郑州seo博客
  • 提供经营性网站备案seo优化工具大全
  • 网站开发毕业答辩ppt国内最新的新闻
  • 有哪些做互联网项目的导航网站友情链接发布网
  • 网站建设的经济效益排名优化软件
  • 邢台市建设局网站互动网站建设
  • 游戏开发 网站开发 难度交换链接的例子
  • 动态网站设计和管理怎么让关键词快速排名首页
  • 上海信息公司做网站沧州网络推广外包公司
  • pc网站平台百度热搜电视剧
  • 帮人做网站收费合法吗seo是如何优化
  • 营销咨询顾问seo培训机构哪家好
  • 中搜网站提交百度免费发布信息平台
  • 网站建设是专业学做网站培训班要多少钱
  • 昆明网站建设服务公司在线培训平台有哪些
  • wordpress标志优化防控举措
  • 河南省建设厅网站建设领域涉黑如何将网站的关键词排名优化
  • 网站项目策划书实例百度小说排行
  • 庆阳做网站网站seo方案
  • 西安商城网站怎样推广自己的产品
  • 建个大型网站要多少钱百度指数有三个功能模块
  • wordpress七牛加速武汉seo推广优化
  • 衡阳哪有做网站推广的上海网站推广服务
  • 泰国云服务器大金seo
  • 西宁个人网站建设百度优化软件
  • 做it的在哪个网站找工作外贸建站与推广
  • 龙岗网站建设哪家好外链工具xg下载
  • 成都网络营销公司哪家好郑州网站seo技术
  • 网站建设费按多少年摊销网络公司取什么名字好
  • sqlite做网站推广app下载