首页 > 其他分享 >AIArena Frontend 初步练习

AIArena Frontend 初步练习

时间:2023-04-06 20:23:21浏览次数:41  
标签:Frontend AIArena menu 练习 list item meta logo path

尝试对starter项目的页面进行改变

修改侧边栏,只留下最上面的「仪表盘」和「列表页」两个大模块

in SideNav.vue the code for the sidebar menu is:

<menu-content :navData="menu" />

from there we can get to MenuContent.vue

I think it is referencing the items in a list, which is computed by the getMenuList function

  computed: {
    list(): Array<MenuRoute> {
      return getMenuList(this.navData);
    },
  },
const getMenuList = (list: MenuRoute[], basePath?: string): MenuRoute[] => {
  if (!list) {
    return [];
  }

  return list
    .map((item) => {
      const path = basePath && !item.path.includes(basePath) ? `${basePath}/${item.path}` : item.path;
      return {
        path,
        title: item.meta?.title,
        icon: item.meta?.icon || '',
        children: getMenuList(item.children, path),
        meta: item.meta,
        redirect: item.redirect,
      };
    })
    .filter((item) => item.meta && item.meta.hidden !== true);
};

and the list is from MenuRoute, and that is from '@/interface'

but it is just definition in there it seems:

export interface MenuRoute {
  path: string;
  title?: string;
  icon?:
    | string
    | {
        render: () => void;
      };
  redirect?: string;
  children: MenuRoute[];
  meta: any;
}

so the point is, where is the this.navData sent into getMenuList

it seems navData is sent in from something like

<menu-content v-if="item.children" :nav-data="item.children" />

in SideNav.vue

<menu-content :navData="menu" /> 

and that menu is here:

export default Vue.extend({
  name: 'sideNav',
  components: {
    MenuContent,
  },
  props: {
    menu: Array,
    showLogo: {
      type: Boolean,
      default: true,
    },

the menu here is sent in from LayoutSidebar.vue(supposedly)

<side-nav
    v-if="showSidebar"
    :showLogo="showSidebarLogo"
    :layout="setting.layout"
    :isFixed="setting.isSidebarFixed"
    :menu="sideMenu"
    :theme="mode"
    :isCompact="setting.isSidebarCompact"
    :maxLevel="setting.splitMenu ? 2 : 3"
  />

and this sideMenu is from that same file

sideMenu() {
      const { layout, splitMenu } = this.$store.state.setting;
      let { menuRouters } = this;
      if (layout === 'mix' && splitMenu) {
        menuRouters.forEach((menu) => {
          if (this.$route.path.indexOf(menu.path) === 0) {
            menuRouters = menu.children.map((subMenu) => ({ ...subMenu, path: `${menu.path}/${subMenu.path}` }));
          }
        });
      }
      return menuRouters;
    },

but what is this.$store.state.setting?

there is the file src/store/index.ts, and that is from src/store/modules/setting.ts

可是还是没有找到,只能出此下策:

MenuContent.vue里面加入一个if判断,把要删的页面全部filter掉

    <template v-for="item in list">
      <template v-if="item.title != '表单页' && item.title != '详情页' && item.title != '外部页面' && item.title != '结果页' && item.title != '个人页' && item.title != '登录页'">

之所以是没有直接 =='仪表盘'这样,是因为如果这样子菜单就没了(原因未知)

result:

尝试修改基础列表页,将列表中的「合同编号」这一列删去

seems to be in layouts/pages/list/base/index.vue

110:合同编号

 // { title: '合同状态', colKey: 'status', width: 200, cell: { col: 'status' } },
 // {
 //   title: '合同编号',
 //   width: 200,
 //   ellipsis: true,
 //   colKey: 'no',
 // },

success!

把public/favicon.ico改了之后:

the svg of logs and images are in src/assets

assets-t-logo.svg is the small T logo

assets-logo-full.svg is the larger logo including Tencent Design

let's try to change the large one. after copying the following into assets-logo-full.svg

<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M32.4853 24.4853C34.6569 22.3137 36 19.3137 36 16C36 9.37258 30.6274 4 24 4C17.3726 4 12 9.37258 12 16C12 19.3137 13.3431 22.3137 15.5147 24.4853" stroke="#333" stroke-width="4" stroke-linecap="round"/><path d="M6 44L7 39L18 31L24 37L30 31L41 39L42 44" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.9934 21.0071C13.0061 16.8965 13.6749 13.8941 15 11.9999C16.9877 9.15871 18.387 9.36755 19.4054 9.81009C20.4238 10.2526 21.0226 13.1442 22.7236 13.9777C24.4246 14.8112 28.7777 14.9141 30.2687 15.9167C31.7597 16.9194 35.1696 18.7844 34.3195 21.9684" stroke="#333" stroke-width="4"/></svg>

we get the following result:

it is shown in SideNav.vue:

      <template #logo>
        <span v-if="showLogo" :class="`${prefix}-side-nav-logo-wrapper`" @click="() => handleNav('/dashboard/base')">
          <component :is="getLogo" :class="`${prefix}-side-nav-logo-${collapsed ? 't' : 'tdesign'}-logo`" />
        </span>
      </template>

标签:Frontend,AIArena,menu,练习,list,item,meta,logo,path
From: https://www.cnblogs.com/mnluzimu/p/17294039.html

相关文章

  • Python小练习:权重初始化(Weight Initialization)
    Python小练习:权重初始化(WeightInitialization)作者:凯鲁嘎吉-博客园 http://www.cnblogs.com/kailugaji/调用Pytorch中的torch.nn.init.xxx实现对模型权重与偏置初始化。1.weight_init_test.py1#-*-coding:utf-8-*-2#Author:凯鲁嘎吉CoralGajic3#https://w......
  • 链表练习4
    已知整型链表,设计算法,删除所有结点值为x的结点,删除的结点个数通过形参返回。#include<stdio.h>#include<stdlib.h>typedefstructnode{intdata;structnode*next;}Node,*LinkList;LinkListcreate(){LinkListh,r,s;h=(LinkList)malloc(sizeof(Node));r=h;inta;sc......
  • Python小练习:处理字符串
    Python小练习:处理字符串作者:凯鲁嘎吉-博客园 http://www.cnblogs.com/kailugaji/介绍两种处理字符串的方式:1.将英语名词单数转化为复数形式(仅适用于一般形式),2.将字符串(带有下换线_)转化为驼峰化形式。1.word_test.py1#-*-coding:utf-8-*-2#Author:凯鲁嘎吉......
  • 2023_4_5 蓝桥杯练习
    《P8671[蓝桥杯2018国AC]约瑟夫环 循环(%)问题》   我尝试用STL中的list与vector进行模拟可以发现复杂度都是>=O(N*K)的,会超时只有通过数学推式来得到全部正确的答案这里简单说一下STLlist与vector中对插入,删除元素的用法:list:......
  • NFS练习题
    NFS练习题1.开放/nfs/share目录,提供给任意用户只读(/etc/exportsro)查询1.任意客户端2.任意的用户​​​​ 服务端showmoutexportfssystemctlstartnfs 修改了nfs配置文件,需要重启什么吗?修改了nfs配置文件,只需要让nfs重新读取该配置文件即可,你都不需要重新,因为你......
  • 练习——集合排序
    packagecom.collection_.list_;publicclassBook{privateStringname;privateStringauther;privatedoubleprice;publicBook(Stringname,Stringauther,doubleprice){this.name=name;this.auther=auther;......
  • 链表练习3
    已知整型链表,设计算法,在所有结点值为x的结点前插入结点值为y的结点,插入的结点个数通过函数值返回。#include<stdio.h>#include<stdlib.h>typedefstructnode{//用Node代替structnodeinta;structnode*next;}Node,*LinkList;LinkListcreate();Link......
  • C++ Primer 第五版 第十一章 练习题编程题目答案
    https://github.com/jzplp/Cpp-Primer-Answer练习11.1map用关键字索引,是一个字典。vector用整数索引,是一个列表。练习11.2list链表vector顺序列表deque双端队列map字典set集合练习11.311.3map单词计数程序代码练习11.411.4去标点map单词计数程序代码练习11.5如果关键......
  • 数组练习1
    1、将密码文件的每一行作为元数赋值给数组  2、使用关联数组统计密码文件中用户使用的不同类型shell的数量   3、使用关联数组按扩展名统计指定目录中文件的数量  ......
  • hivesql练习_会话划分问题
    现有页面浏览记录表(page_view_events)如下,表中有每个用户的每次页面访问记录。user_idpage_idview_timestamp100home1659950435100good_search1659950446100good_list1659950457100home1659950541100good_detail1659950552100cart16599505631......