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

制作网站的程序语言青岛网页搜索排名提升

制作网站的程序语言,青岛网页搜索排名提升,网页设计与制作教程第五版答案,网站改版制作自己的项目要写一个竖栏菜单,所以记录一下思路吧,先粗糙的实现一把,有机会再把细节修饰一下 功能上就是无论这个菜单有多少层级,都能显示出来,另外,需要带图标,基于element-plus写成&#xff0…

自己的项目要写一个竖栏菜单,所以记录一下思路吧,先粗糙的实现一把,有机会再把细节修饰一下

功能上就是无论这个菜单有多少层级,都能显示出来,另外,需要带图标,基于element-plus写成,当这个菜单栏点开的时候最好整个页面的高度不要有变化,最后整成了个小草稿

MyMenu.vue
<template><!-- 自己写的竖栏菜单组件 --><!-- <el-menu style="height: 100%;width:100%"> --><el-scrollbar max-height=100%><el-menu style="width: 100%;border: 0;" unique-opened :default-active="props.defaultIndex" active-text-color="#ffd04b"background-color="#545c64" text-color="#fff"><MenuTree :menu-data="props.data"></MenuTree></el-menu></el-scrollbar>
</template>
<script lang="ts" setup>
import MenuTree from "./MenuTree.vue"
const props=defineProps<{data:Array<any>,defaultIndex:string}>()
</script>

里面有个递归组件

MenuTree.vue
<template><!-- 递归组件 --><!-- 为了创建无限菜单而使用 --><template v-for="value in props.menuData"><!-- 没有children就是一个单标签 --><el-menu-item v-if="!value.children" :index="value.index"><template v-if="value.icon"><component :is="value.icon" style="width: 1rem;"></component></template>{{ value.title }}</el-menu-item><!-- 多标签的情况 --><el-sub-menu v-else :index="value.index"><template #title><template v-if="value.icon"><component :is="value.icon" style="width: 1rem;"></component></template> <span>{{ value.title }}</span></template><MenuTree :menuData="value.children"></MenuTree></el-sub-menu></template>
</template>
<script setup lang="ts">
import MenuTree from "../Page1/MenuTree.vue"
const props=defineProps<{menuData:Array<any>}>()
</script>

最后写个参数挂载一下,我这边用的icon是element-plus组件自带的

<template><el-container style="height: 100vh;"><el-header style="padding: 0;height: 5rem;"><div style="height: 100%;background-color:pink"><span>welcome to page1</span><br /><span>该页面用来写一个竖版menu</span></div></el-header><el-container style="height: calc(100vh - 5rem);"><el-aside width="15%" style="background-color:lightblue;"><MyMenu :data="menuData" :default-index="defaultIndex"/></el-aside><el-main style="background-color:rgb(246, 199, 11);"><component :is="iconStr" style="width: 1rem;"></component></el-main></el-container></el-container>
</template>
<script setup lang="ts">
import {ref} from "vue"
import { Search,Select,Close,User } from '@element-plus/icons-vue';
import MyMenu from './MyMenu.vue';
let menuData = [{title: "睡觉",index: "0",icon: Select},{title: "游戏",index: "1",icon: Search,children: [{title: "上古卷轴",index: "1-1",children: [{title: "上古卷轴匕首雨",index: "1-1-1",},{title: "上古卷轴天际",index: "1-1-2",icon: Select}]},{title: "辐射",index: "1-2",children: [{title: "龙万德",index: "1-2-1"},{title: "辐射新维加斯",index: "1-2-2"}]}]},{title: "美食",index: "2",icon: Close,children: [{title: "淮扬菜",index: "2-1",children: [{title: "红烧狮子头",index: "2-1-1"},{title: "猪头肉",index: "2-1-2"},]},{title: "川菜",index: "2-2",children: [{title: "四川泡菜",index: "2-2-1"},{title: "水煮鱼",index: "2-2-2"},{title: "开水白菜",index: "2-2-3"},]},{title: "粤菜",index: "2-3",children: [{title: "白切鸡",index: "2-3-1"},{title: "顺德鱼生",index: "2-3-2"},{title: "猪肚鸡",index: "2-3-3"},]}]},{title: "编程",index: "3",icon: User,children: [{title: "golang",index: "3-1",children: [{title: "云原生",index: "3-1-1"},{title: "gin",index: "3-1-2"}]},{title: "js",index: "3-2"},{title: "python",index: "3-3"}]}
]
// 默认index值
let defaultIndex = ref("0")
</script>

主要过程就是写了一个递归的菜单栏,然后用el-scrollbar包装了一下,以免这个菜单展开的时候把盒子高度撑开。

细节上难看了一点,此外我觉得整个菜单的高度应该和传入数组的最大深度相关,得把这个el-scrollbar组件换掉才行,先写着,有时间完善。

http://www.hkea.cn/news/891472/

相关文章:

  • 中华建设杂志网站记者数据指数
  • 网站开发测试情况南召seo快速排名价格
  • 上海仓储公司小红书seo优化
  • 南京建设公司网站网络营销整合推广
  • wordpress更改语言沈阳seo优化
  • wordpress免费网站世界大学排名
  • 做网站的属于什么专业?百度爱采购竞价推广
  • 网站建设一年多少恰东莞网站到首页排名
  • 新企业网站应该怎么做SEO优化广告联盟有哪些
  • 手机app开发网站建设软文推广文章案例
  • 网站自然排名百度经验官网登录
  • dz网站模板沧州网站优化公司
  • 桂林论坛天涯社区培训行业seo整站优化
  • 做伊瑞尔竞技场的网站搜索引擎简称seo
  • 46云虚拟主机股票发行ipo和seo是什么意思
  • 新泰做网站菏泽seo
  • 网站建设排名东莞seo收费
  • 做网站前后端的发布流程自己如何制作网站
  • 网站营销与推广策略百度一下官网首页百度
  • 网站建设张世勇100个免费推广b站
  • 网络营销的常用工具百度关键词优化点击 教程
  • 公司网站要怎么做少儿编程培训机构排名前十
  • 一个好的网站是什么样的商家联盟营销方案
  • 网站解除域名绑定网站广告收费标准
  • 郑州的建设网站有哪些手续免费发布推广信息的平台有哪些
  • 手机做网站软件优化服务平台
  • 网站图片装修的热切图怎么做营销技巧培训
  • 可以上传图片的网站怎么做百度关键词点击
  • 泉州网站制作广州seo网站开发
  • cuntlove wordpressseo外链发布工具