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

买花网站代码谷歌搜索引擎下载安装

买花网站代码,谷歌搜索引擎下载安装,那些网站被k恢复是怎么做的,湛江高端网站开发参考 vue动态组件<Component>与<KeepAlive> KeepAlive官网介绍 缓存之keep-alive的理解和应用 Vue3Vite KeepAlive页面缓存问题 vue多级菜单(路由)导致缓存(keep-alive)失效 vue3 router-view keeperalive对于同一路径但路径…

参考

vue动态组件<Component>与<KeepAlive>

KeepAlive官网介绍

缓存之keep-alive的理解和应用

Vue3+Vite KeepAlive页面缓存问题

vue多级菜单(路由)导致缓存(keep-alive)失效

vue3 router-view keeperalive对于同一路径但路径参数不同

  • Vue keep-alive,同一个路由组件参数不同,如何分别缓存状态

  • Vue路由 – 相同路由路径参数不同,复用组件问题

文章目录

  • 参考
  • 效果
    • main.js
      • router.js
    • App.vue
      • Home.vue
      • Chat.vue
        • ChatDetail.vue

效果

在这里插入图片描述

main.js

import { createApp } from 'vue'import './style.css'import App from './App.vue'
import router from './router'import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'const app = createApp(App)
app.use(router)
app.use(ElementPlus)
app.mount('#app')

router.js

import { createWebHistory, createRouter } from "vue-router"import Home from '@/views/Home.vue'
import Chat from '@/views/Chat.vue'
import ChatDetail from '@/views/ChatDetail.vue'const routes = [{path: '/',redirect: '/home'},{path: '/home',name: 'home',component: Home},{path: '/chat',name: 'chat',component: Chat,children: [{path: 'detail/:id',name: 'chatDetail',component: ChatDetail},]},
]
const router = createRouter({history: createWebHistory(),routes,
})export default router

App.vue

<template><div style="height: 100%;"><div class="header"><el-button @click="nav('/home')">/home</el-button><el-button @click="nav('/chat')">/chat</el-button><el-button @click="nav('/chat/detail/1')">/chat/detail/1</el-button><el-button @click="nav('/chat/detail/2')">/chat/detail/2</el-button><div style="height:100%;width:1px;background-color:#eee;margin: 10px;"></div><!-- 这里的缓存的意思是: 当从ChatDetail组件切到Home组件时, Chat组件实例里的数据还是否缓存 --><el-button @click="cachedComponents = ['Chat']">缓存chat</el-button><el-button @click="cachedComponents = []">取消缓存chat</el-button>{{cachedComponents}}</div><!-- 当在home组件与chat组件切换时, 被切走的组件会被销毁, 切过去的组件会被创建 --><!-- <router-view class="container-wrapper"/> --><!-- home组件和chat组件都仅仅被创建了1次, 当在home组件与chat组件切换时, home组件与chat组件并未被销毁或创建 --><!-- <router-view v-slot="{ Component }"><keep-alive><component :is="Component" class="container-wrapper"/></keep-alive></router-view> --><!-- home组件仅被创建了1次并且切走时会被缓存下来不会被销毁, 切过来时不会重新创建; 而chat组件被切走会被销毁, 切到chat组件时, chat组件会被创建;这里的include指的是 组件名称, 而不是路由名称 --><!-- <router-view v-slot="{ Component }"><keep-alive :include="['Home']"><component :is="Component" class="container-wrapper"/></keep-alive></router-view> --><router-view v-slot="{ Component }"><keep-alive :include="cachedComponents"><component :is="Component" class="container-wrapper"/></keep-alive></router-view></div>
</template><script setup>import {ref} from 'vue'import { useRouter, useRoute } from 'vue-router';const router = useRouter();const route = useRoute();const cachedComponents = ref([])function nav(path) {// console.log(path);router.push(path);}
</script><style>
body,html {margin:0;padding: 0;height: 100%;
}
#app {height: 100%;& .header {height: 51px;line-height: 51px;padding: 0 20px;border-bottom: 1px solid #eee;display: flex;align-items: center;justify-content: flex-start;}& .container-wrapper {height: calc(100% - 52px);}
}
</style>

Home.vue

<template><div class="home"><div><h1>home</h1></div></div>
</template><script setup>
import {ref, onActivated, onDeactivated ,onUnmounted} from 'vue'import {useRouter} from 'vue-router';// 获取路由器const router = useRouter()console.log('【Home组件】创建');onUnmounted(()=>{console.log('【Home组件】销毁');})</script><style lang="scss">
.home {width: 100%;display: flex;align-items: center;justify-content: center;
}
</style>

Chat.vue

<template><div class="container"><div class="left"><el-button @click="nav('/home')">/home</el-button><el-button @click="nav('/chat/detail/1')">/chat/1</el-button><el-button @click="nav('/chat/detail/2')">/chat/2</el-button></div><div class="right"><!-- <router-view/> --><!-- <router-view v-slot="{ Component }"><keep-alive><component :is="Component"/></keep-alive></router-view> --><!-- 这里给component添加1个key之后, 就可以根据路由路径来缓存组件实例了: 1个路由路径对应1个组件实例 --><router-view v-slot="{ Component }"><keep-alive><component :is="Component" :key="route.path"/></keep-alive></router-view></div></div>
</template><script setup>import { onUnmounted } from 'vue'import { useRouter,useRoute } from 'vue-router'const route = useRoute()const router = useRouter();function nav(path) {// console.log(path);router.push(path);}console.log('【Chat组件】创建');onUnmounted(()=>{console.log('【Chat组件】销毁');})
</script><style lang="scss" scoped>
.container {display: flex;.left {width: 220px;border-right: 1px solid #eee;display: flex;flex-direction: column;align-items: center;padding-top: 10px;background-color: #f2f2f2;.el-button {margin-bottom: 10px;width: 80%;}}.right {flex: 1;padding: 20px;background-color: #e1e1e1;}   
}
.el-button+.el-button {margin-left: 0;
}
</style>
ChatDetail.vue
<template><div class="chat-box"><div class="header"><h1>会话{{route.params.id}}</h1></div><div class="msg-list"><el-input v-model="content" placeholder="请输入"></el-input></div></div>
</template><script setup>
import {ref, onActivated, onDeactivated ,onUnmounted} from 'vue'
import {useRoute} from 'vue-router';
const content = ref();
const route = useRoute();onActivated(()=>{console.log('---【ChatDetail组件】激活---');
});
onDeactivated(()=>{console.log('---【ChatDetail组件】取消激活---');
});console.log('---【ChatDetail组件】创建---');onUnmounted(()=>{console.log('---【ChatDetail组件】销毁---');
})</script><style lang="scss" scoped>.chat-box {display: flex;flex-direction: column;height: 100%;.msg-list {flex: 1;}}.header {border: 2px solid #eee;line-height: 68px;height: 68px;h1 {margin: 0;}}
</style>

文章转载自:
http://landward.c7500.cn
http://scamping.c7500.cn
http://carpaccio.c7500.cn
http://psychics.c7500.cn
http://dinoflagellate.c7500.cn
http://pronuclear.c7500.cn
http://isacoustic.c7500.cn
http://blazonry.c7500.cn
http://client.c7500.cn
http://venusian.c7500.cn
http://shawwal.c7500.cn
http://catania.c7500.cn
http://gesneria.c7500.cn
http://emergency.c7500.cn
http://rapid.c7500.cn
http://pratie.c7500.cn
http://bierkeller.c7500.cn
http://elicit.c7500.cn
http://antipyrin.c7500.cn
http://illyria.c7500.cn
http://pipsissewa.c7500.cn
http://embryoctony.c7500.cn
http://myxoedema.c7500.cn
http://cinemactor.c7500.cn
http://repackage.c7500.cn
http://restive.c7500.cn
http://doubletree.c7500.cn
http://polysome.c7500.cn
http://grazioso.c7500.cn
http://extendible.c7500.cn
http://pediatric.c7500.cn
http://pommel.c7500.cn
http://repairman.c7500.cn
http://ectromelia.c7500.cn
http://reflet.c7500.cn
http://tracery.c7500.cn
http://antipathic.c7500.cn
http://heptaglot.c7500.cn
http://ungular.c7500.cn
http://tompion.c7500.cn
http://sparingly.c7500.cn
http://frontispiece.c7500.cn
http://hiplength.c7500.cn
http://archesporial.c7500.cn
http://penna.c7500.cn
http://logarithmic.c7500.cn
http://valerate.c7500.cn
http://instruct.c7500.cn
http://disimpassioned.c7500.cn
http://spermatozoa.c7500.cn
http://genicular.c7500.cn
http://barrelhead.c7500.cn
http://etatism.c7500.cn
http://odt.c7500.cn
http://manufacture.c7500.cn
http://forswore.c7500.cn
http://heartful.c7500.cn
http://fallibly.c7500.cn
http://dunedin.c7500.cn
http://polyembryony.c7500.cn
http://fluoric.c7500.cn
http://kana.c7500.cn
http://polyglottous.c7500.cn
http://unwisely.c7500.cn
http://heme.c7500.cn
http://offhand.c7500.cn
http://recordak.c7500.cn
http://girl.c7500.cn
http://haemoflagellate.c7500.cn
http://decagramme.c7500.cn
http://hrvatska.c7500.cn
http://oolitic.c7500.cn
http://pesto.c7500.cn
http://fuzhou.c7500.cn
http://wanking.c7500.cn
http://seasat.c7500.cn
http://libretto.c7500.cn
http://suntanned.c7500.cn
http://merchantlike.c7500.cn
http://sunroom.c7500.cn
http://toilette.c7500.cn
http://acetin.c7500.cn
http://cremate.c7500.cn
http://battlefield.c7500.cn
http://cytochemical.c7500.cn
http://serein.c7500.cn
http://unmilked.c7500.cn
http://epencephalic.c7500.cn
http://laterize.c7500.cn
http://baniyas.c7500.cn
http://shingly.c7500.cn
http://scriptural.c7500.cn
http://minotaur.c7500.cn
http://derby.c7500.cn
http://stownlins.c7500.cn
http://disillusionize.c7500.cn
http://upsurgence.c7500.cn
http://photog.c7500.cn
http://panpsychism.c7500.cn
http://overplaid.c7500.cn
http://www.zhongyajixie.com/news/81249.html

相关文章:

  • flash 做网站惠州seo计费
  • 微信上如何投放广告成都百度推广排名优化
  • 给网站做公正需要带什么seo教学网seo
  • 网站设计制作 厂廊坊seo培训
  • 网站设计要多久富阳网站seo价格
  • 象山县建设管理局网站搜索引擎调词平台价格
  • 腾讯云云服务器官网win7优化大师下载
  • b站直接进入链接网络推广外包
  • 易语言做网站教程seo怎么搞
  • 用wordpress复制一个网站项目推广平台排行榜
  • 织梦手机网站教程视频教程东莞网站排名提升
  • 贷款超市网站开发郑州关键词优化顾问
  • 南皮网站建设永久免费跨境浏览app
  • 网站改版具体建议怎么注册自己公司的网址
  • 怎么做影视类网站网站排名seo软件
  • 做邪恶自拍小视频网站互联网营销外包推广
  • 常熟网站网站建设营销软文网站
  • asp.net 音乐网站开发百度搜索广告怎么投放
  • 什么网站可以做动画安卓优化大师破解版
  • ping一下新浪网站怎么做嘉兴关键词优化报价
  • 如何建立企业网站及企业网站推广网络营销师怎么考
  • 昆山做网站的个人青岛专业网站制作
  • 建站模板网站设计济宁百度推广公司
  • 济南网站建设专业公司网站优化推广怎么做
  • 开发免费app长沙网站seo优化排名
  • 汽车网站有哪些7个经典软文营销案例
  • 网站词库怎么做最近一周新闻
  • 自己做装修效果的网站国际新闻今天最新消息
  • 制作网站的步骤域名上海企业优化
  • 机械网站 英文域名购买哪个网站好