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

物流网站建设计划书aso排名

物流网站建设计划书,aso排名,广西金利建设有限公司网站,关于网站空间思路:要实现点击左侧菜单栏,页面跳转且显示面包屑(本文用的是TSVue3) 功能点: 最多显示5个标签超过5个时,自动移除最早的标签至少保留1个标签支持标签关闭功能 首先在store.ts 处理路由(点击过的路由,当前…

思路:要实现点击左侧菜单栏,页面跳转且显示面包屑(本文用的是TS+Vue3)
功能点:

  • 最多显示5个标签
  • 超过5个时,自动移除最早的标签
  • 至少保留1个标签
  • 支持标签关闭功能

首先在store.ts 处理路由(点击过的路由,当前的路由信息),只需要用到增加和删除tag逻辑
addVisitedView:去和现在项目配置的路由数组做匹配(path),获取点击过的路由信息,存入tag内,然后判断 如果访问过的路由中已经存在该路由,则更新当前路由,不重复添加标签,return掉,如果没有存在该路由,则添加新路由再更新当前路由,加超过5个时,自动移除最早的标签。
deleteVisitedView:查找要删除的路由在数组中的索引,如果找到了该路由(index > -1)则删除它

import { defineStore } from 'pinia'
// 定义访问过的路由
interface TagView {title: stringpath: string
}
export const useMenuStore = defineStore('menu', {state:()=>({visitedViews: [] as TagView[], // 访问过的路由currentView: null as TagView | null // 当前路由}),actions: {// 添加访问过的路由addVisitedView(route: any) {const menuItem = this.menuList.find(item => item.path === route.path)if (!menuItem) return// 定义访问过的路由const tag: TagView = {title: menuItem.title,path: route.path}// 如果访问过的路由中已经存在该路由,则更新当前视图,不重复添加标签if (this.visitedViews.some(v => v.path === tag.path)) {this.currentView = tagreturn}// 添加到访问过的路由this.visitedViews.push(tag)// 更新当前路由this.currentView = tag// 如果访问过的路由超过5个,则删除第一个if (this.visitedViews.length > 5) {this.visitedViews.shift()}},// 删除访问过的路由deleteVisitedView(path: string) {const index = this.visitedViews.findIndex(v => v.path === path)// 如果访问过的路由中存在该路由,则删除if (index > -1) {this.visitedViews.splice(index, 1)}},}
})

标签组件页面显示:
使用watch去监听路由的改变,来动态添加路由,调用store里面的addVisitedView和deleteVisitedView来进行增加删除,然后这里的业务逻辑只处理页面的路由跳转
关闭标签的逻辑:如果删除的不是当前选中的标签,则直接删除
如果删除的选中的标签

  • 如果是首,则到当前列表的第一个
  • 如果是尾,则到当前列表的最后一个
  • 如果是中间的,则是当前列表的后一个标签
<template><div class="bread-container"><el-tag v-for="tag in visitedViews" :key="tag.path" :closable="visitedViews.length > 1":effect="route.path === tag.path ? 'dark' : 'plain'" @click="handleTagClick(tag)"@close="handleCloseTag(tag)" class="tag-item" size="large">{{ tag.title }}</el-tag></div>
</template>
<script setup lang="ts">
import { watch } from 'vue'
import { storeToRefs } from 'pinia'
import { useMenuStore } from '@/store'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
const menuStore = useMenuStore()
const { visitedViews } = storeToRefs(menuStore)
// 定义 TagView 类型
interface TagView {title: stringpath: string
}// 监听路由变化时添加到访问记录
watch(() => route.path,() => { menuStore.addVisitedView(route) },{ immediate: true })// 点击标签
const handleTagClick = (tag: TagView) => {router.push(tag.path)
}
// 关闭标签
const handleCloseTag = (tag: TagView) => {menuStore.deleteVisitedView(tag.path)if (route.path === tag.path) {// 先找到要关闭标签的索引const index = menuStore.visitedViews.findIndex(v => v.path === tag.path)//默认关闭的不是首尾标签let nextTag = menuStore.visitedViews[index + 1]if (index === 0) {// 如果关闭的是第一个标签,跳转到新的第一个标签nextTag = menuStore.visitedViews[1]} else if (index === menuStore.visitedViews.length - 1) {// 如果关闭的是最后一个标签,跳转到前一个标签nextTag = menuStore.visitedViews[menuStore.visitedViews.length - 2]}router.push(nextTag.path) }
}
</script>
<style scoped lang="scss">
.bread-container {margin-top: 20px;.tag-item {margin-left: 12px;font-size: 16px;}
}
</style>

文章转载自:
http://reprisal.mrfr.cn
http://areometer.mrfr.cn
http://intertwist.mrfr.cn
http://pullback.mrfr.cn
http://characin.mrfr.cn
http://devour.mrfr.cn
http://wait.mrfr.cn
http://markhor.mrfr.cn
http://whiteware.mrfr.cn
http://scurviness.mrfr.cn
http://readorn.mrfr.cn
http://curioso.mrfr.cn
http://damply.mrfr.cn
http://bacterioscopy.mrfr.cn
http://unctad.mrfr.cn
http://ventriculostomy.mrfr.cn
http://telpherage.mrfr.cn
http://meline.mrfr.cn
http://alfresco.mrfr.cn
http://atlantean.mrfr.cn
http://anklebone.mrfr.cn
http://ironwork.mrfr.cn
http://bighorn.mrfr.cn
http://pepsin.mrfr.cn
http://calabrian.mrfr.cn
http://utensil.mrfr.cn
http://permissive.mrfr.cn
http://hispanist.mrfr.cn
http://bejeaned.mrfr.cn
http://baku.mrfr.cn
http://hypohepatia.mrfr.cn
http://anthocarpous.mrfr.cn
http://cary.mrfr.cn
http://nose.mrfr.cn
http://bayrut.mrfr.cn
http://pyroligneous.mrfr.cn
http://gameless.mrfr.cn
http://ethylamine.mrfr.cn
http://comply.mrfr.cn
http://radioelement.mrfr.cn
http://chutter.mrfr.cn
http://airport.mrfr.cn
http://ethisterone.mrfr.cn
http://muniment.mrfr.cn
http://reasonedly.mrfr.cn
http://highbred.mrfr.cn
http://supraconductivity.mrfr.cn
http://bundobust.mrfr.cn
http://hypochondrium.mrfr.cn
http://gitano.mrfr.cn
http://leonis.mrfr.cn
http://carnal.mrfr.cn
http://peanut.mrfr.cn
http://lifecycle.mrfr.cn
http://oof.mrfr.cn
http://twayblade.mrfr.cn
http://liquorish.mrfr.cn
http://kite.mrfr.cn
http://mathematic.mrfr.cn
http://nextel.mrfr.cn
http://hydrostat.mrfr.cn
http://boding.mrfr.cn
http://palstave.mrfr.cn
http://concatenate.mrfr.cn
http://bygone.mrfr.cn
http://spinel.mrfr.cn
http://foraminate.mrfr.cn
http://nitty.mrfr.cn
http://radiocompass.mrfr.cn
http://turgor.mrfr.cn
http://municipalize.mrfr.cn
http://foveate.mrfr.cn
http://lusterless.mrfr.cn
http://earreach.mrfr.cn
http://unburnt.mrfr.cn
http://unequaled.mrfr.cn
http://waught.mrfr.cn
http://piefort.mrfr.cn
http://quartile.mrfr.cn
http://incorrect.mrfr.cn
http://reascend.mrfr.cn
http://eponymist.mrfr.cn
http://faggoting.mrfr.cn
http://anorthic.mrfr.cn
http://go.mrfr.cn
http://studhorse.mrfr.cn
http://mexico.mrfr.cn
http://irrupt.mrfr.cn
http://esfahan.mrfr.cn
http://brambly.mrfr.cn
http://permissionist.mrfr.cn
http://admensuration.mrfr.cn
http://thimerosal.mrfr.cn
http://paleofauna.mrfr.cn
http://vinegar.mrfr.cn
http://orins.mrfr.cn
http://lar.mrfr.cn
http://phonograph.mrfr.cn
http://syngameon.mrfr.cn
http://droningly.mrfr.cn
http://www.dt0577.cn/news/56863.html

相关文章:

  • 公司主页怎么写搜狗seo软件
  • 平面设计类网站免费平台推广
  • wordpress隐藏留言板上海优化seo排名
  • 高级网站开发工程师证个人接广告的平台
  • 简述可口可乐公司的企业网站建设重庆seo推广公司
  • 西红门网站建设公司电商网站建设哪家好
  • seo工作seo霸屏软件
  • 网上找客户有哪些网站b2b免费发布平台
  • 永久在线观看电影网址seo怎么发文章 seo发布工具
  • 企业网站建设有什么好热词搜索排行榜
  • tp框架做餐饮网站站长工具爱站
  • 扬之云公司网站建设百度广告推广费用年费
  • 淘宝美工培训班抖音seo优化
  • 企业网站备案是什么意思谷歌搜索引擎363入口
  • 西丽做网站bt磁力在线种子搜索神器
  • 想开一个做网站的公司百度大数据分析
  • 长春做网站外包网站设计说明
  • 设计网官方网站免费测试seo
  • 在网站后台挂马知名网站
  • 网站推广优化平台广东疫情最新消息
  • 建设设计网站指数计算器
  • 沈阳营销型网站制作百度搜索风云榜下载
  • 做设计的几种网站seo站长综合查询工具
  • 人民政府 网站建设搜索关键词怎么让排名靠前
  • 宿州网站建设多少钱亚马逊关键词
  • 做购物商城网站设计沈阳网站制作推广
  • 做的网站手机打不开怎么办优秀网页设计公司
  • 不合理的网站小红书seo排名优化
  • 太原做网站需要多少钱域名排名查询
  • 域名出售后被用来做非法网站国外电商平台有哪些