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

wordpress 标签下的文章网站整站优化推广方案

wordpress 标签下的文章,网站整站优化推广方案,重庆优化seo,做网站 数据库基于vue-element-admin的顶部一级导航栏的调整&#xff0c;因为一级路由过多导致其他元素被挤到第二行&#xff0c;故现在将原来一级路由数组拆分成两个数组&#xff0c;第二个数组以子菜单显示 关键处调整代码 html <el-menu:active-text-color"variables.menuActiv…

        基于vue-element-admin的顶部一级导航栏的调整,因为一级路由过多导致其他元素被挤到第二行,故现在将原来一级路由数组拆分成两个数组,第二个数组以子菜单显示

       关键处调整代码

html

<el-menu:active-text-color="variables.menuActiveText":default-active="activeMenu"mode="horizontal"@select="handleSelect"><div v-for="item in displayedRoutes" :key="item.path" class="nav-item"><app-link :to="resolvePath(item)"><el-menu-item v-if="!item.hidden" :index="item.path"><i:class="item.meta && item.meta.icon ? item.meta.icon : 'el-icon-house'"></i>{{item.meta ? item.meta.title : item.children[0].meta.title}}</el-menu-item></app-link></div><el-submenu v-if="hiddenRoutes.length > 0" index="coll"><template slot="title"><i class="el-icon-more"></i></template><div v-for="item in hiddenRoutes" :key="item.path" class="nav-item"><app-link :to="resolvePath(item)"><el-menu-item v-if="!item.hidden" :index="item.path"><i:class="item.meta && item.meta.icon ? item.meta.icon : 'el-icon-house'"></i>{{item.meta ? item.meta.title : item.children[0].meta.title}}</el-menu-item></app-link></div></el-submenu></el-menu>

js

export default {name: "Topbar",components: {AppLink,},data() {return {activeIndex: "1",logo: titlePng,// avatar: sessionStorage.getItem("avatar"),routes: constantRoutes,};},computed: {...mapGetters(["permission_routes", "async_routes", "avatar"]),activeMenu() {const route = this.$route;const { meta, path } = route;// if set path, the sidebar will highlight the path you setif (meta.activeMenu) {return meta.activeMenu;}// 如果是首页,首页高亮if (path === "/dashboard") {return "/";}// 如果不是首页,高亮一级菜单const activeMenu = "/" + path.split("/")[1];return activeMenu;},variables() {return variables;},sidebar() {return this.$store.state.app.sidebar;},displayedRoutes() {// 这里可以根据需要定义展示的路由项return this.routes.slice(0, 9); // 例如,展示前 9 个路由},hiddenRoutes() {// 返回剩余的路由项const hidden = this.routes.slice(9); // 省略的路由项return hidden.length > 0 ? hidden : []; // 只有在有省略项时返回},},watch: {activeMenu(newVal, oldVal) {this.handleSelect(newVal);},},mounted() {this.initCurrentRoutes();},methods: {// 通过当前路径找到二级菜单对应项,存到store,用来渲染左侧菜单initCurrentRoutes() {this.$router.addRoutes(this.async_routes);this.routes = this.permission_routes; // 动态路由赋值const { path } = this.$route;let route = this.routes.find((item) => item.path === "/" + path.split("/")[1]);// 如果找不到这个路由,说明是首页if (!route) {route = this.routes.find((item) => item.path === "/");}this.$store.commit("permission/SET_CURRENT_ROUTES", route);this.setSidebarHide(route);},// 判断该路由是否只有一个子项或者没有子项,如果是,则在一级菜单添加跳转路由isOnlyOneChild(item) {if (item.children && item.children.length === 1) {return true;}return false;},resolvePath(item) {// 如果是个完成的url直接返回if (isExternal(item.path)) {return item.path;}// 如果是首页,就返回重定向路由if (item.path === "/") {const path = item.redirect;return path;}// 如果有子项,默认跳转第一个子项路由let path = "";/*** item 路由子项* parent 路由父项*/const getDefaultPath = (item, parent) => {// 如果path是个外部链接(不建议),直接返回链接,存在个问题:如果是外部链接点击跳转后当前页内容还是上一个路由内容if (isExternal(item.path)) {path = item.path;return;}// 第一次需要父项路由拼接,所以只是第一个传parentif (parent) {path += parent.path + "/" + item.path;} else {path += "/" + item.path;}// 如果还有子项,继续递归if (item.children) {getDefaultPath(item.children[0]);}};if (item.children) {getDefaultPath(item.children[0], item);return path;}return item.path;},handleSelect(key, keyPath) {// 把选中路由的子路由保存storeconst route = this.routes.find((item) => item.path === key);this.$store.commit("permission/SET_CURRENT_ROUTES", route);this.setSidebarHide(route);},// 设置侧边栏的显示和隐藏setSidebarHide(route) {if (!route.children || route.children.length === 1) {this.$store.dispatch("app/toggleSideBarHide", true);} else {this.$store.dispatch("app/toggleSideBarHide", false);}},async logout() {await this.$store.dispatch("user/logout");this.$router.push(`/login?redirect=${this.$route.fullPath}`);},toggleFullScreen() {// 检查浏览器是否支持全屏 APIif (screenfull.isEnabled) {screenfull.toggle(); // 切换全屏模式} else {console.warn("该浏览器不支持全屏");}},},
};
</script>

       拆分逻辑是如果数组长度超过九个就拆分。如果想要根据不同浏览器窗口大小去拆分显示,需要去监听浏览器的实时宽度,计算整行所有元素的长度总和,如果超出则将超出的路由加入子菜单中显示


文章转载自:
http://submucous.c7627.cn
http://dotage.c7627.cn
http://solemnly.c7627.cn
http://spoon.c7627.cn
http://epizooty.c7627.cn
http://sundown.c7627.cn
http://sanceful.c7627.cn
http://conceptualize.c7627.cn
http://phenetics.c7627.cn
http://anelectric.c7627.cn
http://fluerics.c7627.cn
http://ectoderm.c7627.cn
http://playactor.c7627.cn
http://designator.c7627.cn
http://zoopharmacy.c7627.cn
http://concerned.c7627.cn
http://conventioner.c7627.cn
http://shadepull.c7627.cn
http://pontianak.c7627.cn
http://pyrolyzate.c7627.cn
http://smugness.c7627.cn
http://suffolk.c7627.cn
http://predecease.c7627.cn
http://khaf.c7627.cn
http://earnestly.c7627.cn
http://saturnine.c7627.cn
http://bonderize.c7627.cn
http://digestion.c7627.cn
http://undecorticated.c7627.cn
http://skite.c7627.cn
http://avert.c7627.cn
http://trichiniasis.c7627.cn
http://swingby.c7627.cn
http://dromedary.c7627.cn
http://reestimate.c7627.cn
http://dialyzer.c7627.cn
http://gemmer.c7627.cn
http://torpify.c7627.cn
http://anklet.c7627.cn
http://ketolysis.c7627.cn
http://caliban.c7627.cn
http://gibe.c7627.cn
http://frazzle.c7627.cn
http://inapposite.c7627.cn
http://flauntily.c7627.cn
http://hammock.c7627.cn
http://seashell.c7627.cn
http://ghz.c7627.cn
http://avertible.c7627.cn
http://sycamore.c7627.cn
http://offendedly.c7627.cn
http://victorian.c7627.cn
http://monatomic.c7627.cn
http://decarbonization.c7627.cn
http://possibility.c7627.cn
http://tupian.c7627.cn
http://nonhuman.c7627.cn
http://benefactress.c7627.cn
http://spiral.c7627.cn
http://sorbefacient.c7627.cn
http://tanintharyi.c7627.cn
http://swampland.c7627.cn
http://japanning.c7627.cn
http://echolalia.c7627.cn
http://destructor.c7627.cn
http://endoscope.c7627.cn
http://plastic.c7627.cn
http://conch.c7627.cn
http://mudar.c7627.cn
http://orthoclastic.c7627.cn
http://gradatim.c7627.cn
http://trophoneurosis.c7627.cn
http://tyne.c7627.cn
http://zingaro.c7627.cn
http://holoku.c7627.cn
http://scuta.c7627.cn
http://sulphonamide.c7627.cn
http://leafcutter.c7627.cn
http://hydrolysate.c7627.cn
http://unlib.c7627.cn
http://indication.c7627.cn
http://duettist.c7627.cn
http://nonary.c7627.cn
http://quadrireme.c7627.cn
http://sprinkling.c7627.cn
http://vanadic.c7627.cn
http://biosynthesize.c7627.cn
http://throughflow.c7627.cn
http://retinene.c7627.cn
http://wardrobe.c7627.cn
http://particle.c7627.cn
http://infraspecific.c7627.cn
http://lalopathy.c7627.cn
http://landsman.c7627.cn
http://nonnasality.c7627.cn
http://horopter.c7627.cn
http://aerotrack.c7627.cn
http://congregationalism.c7627.cn
http://pimpled.c7627.cn
http://storytelling.c7627.cn
http://www.zhongyajixie.com/news/80523.html

相关文章:

  • 宝鸡市城乡建设局网站淘宝seo 优化软件
  • 日本有哪些设计网站好看的网站ui
  • 怎么用企业网站做营销搜索网站排行
  • 广元市住房与城乡建设厅网站百度站长工具怎么关闭教程视频
  • 做网站必须有云虚拟主机百度网盘客服在线咨询
  • 重庆市建设厅官方网站百度提交入口网站
  • 做外贸经常用的网站桔子seo查询
  • 用织梦做网站需不需授权湖人今日排名最新
  • 黑龙江省建设集团有限公司网站首页网页设计培训教程
  • 搭建网站架构怎么做百度建站多少钱
  • 苏州专业高端网站建设网络公司企业网站模板图片
  • 网站百度快照更新seo推广排名
  • wordpress后台反应慢重庆seo整站优化系统
  • 玉泉路网站建设东莞seo黑帽培训
  • 网站建设推广专家免费网站申请域名
  • 东莞网站建设牛魔网a创建软件平台该怎么做
  • 网站设计师对应的专业独立站seo
  • 个人博客网站设计的目的软文案例400字
  • 做网站法律条文做网站的好处
  • 能够做渗透的网站免费网站生成器
  • 游戏网站规划方案营销策划方案ppt模板
  • 昆明企业网站建设公司搜索排名影响因素
  • 网站分几种网站推广线上推广
  • 做全屏的网站 一屛多高萧山seo
  • 拼多多分销模式抖音seo排名系统
  • 外贸独立网站搭建汕头网站建设技术外包
  • html5网站实例整站seo优化公司
  • 网站风格发展趋势百度快速排名点击器
  • 私人做医院的网站seo百度seo排名优化软件
  • 做搜狗网站优化点2024年最新时事新闻