1.步骤条封装

This commit is contained in:
dingyongya
2022-01-04 18:12:13 +08:00
parent af5a0e0cc9
commit acef2f91b0
11 changed files with 1236 additions and 422 deletions

View File

@@ -44,362 +44,371 @@
</lay-layout>
</template>
<script>
import { ref, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ref, watch } from "vue";
import { useRouter, useRoute } from "vue-router";
export default {
setup() {
const route = useRoute()
const router = useRouter()
const currentPath = ref('/zh-CN/guide')
const route = useRoute();
const router = useRouter();
const currentPath = ref("/zh-CN/guide");
watch(
() => route.path,
(val) => {
currentPath.value = val
currentPath.value = val;
},
{
immediate: true,
deep: true,
}
)
);
const menus = [
{
id: 1,
title: '通用',
title: "通用",
children: [
{
id: 20,
title: '颜色',
subTitle: 'color',
path: '/zh-CN/components/color',
title: "颜色",
subTitle: "color",
path: "/zh-CN/components/color",
},
{
id: 6,
title: '按钮',
subTitle: 'button',
path: '/zh-CN/components/button',
title: "按钮",
subTitle: "button",
path: "/zh-CN/components/button",
},
{
id: 7,
title: '图标',
subTitle: 'iconfont',
path: '/zh-CN/components/icon',
title: "图标",
subTitle: "iconfont",
path: "/zh-CN/components/icon",
},
{
id: 10,
title: '动画',
subTitle: 'animation',
path: '/zh-CN/components/animation',
title: "动画",
subTitle: "animation",
path: "/zh-CN/components/animation",
},
],
},
{
id: 1,
title: '布局',
title: "布局",
children: [
{
id: 111,
title: '骨架屏',
subTitle: 'skeleton',
path: '/zh-CN/components/skeleton',
title: "骨架屏",
subTitle: "skeleton",
path: "/zh-CN/components/skeleton",
},
{
id: 4,
title: '布局',
subTitle: 'layout',
path: '/zh-CN/components/layout',
title: "布局",
subTitle: "layout",
path: "/zh-CN/components/layout",
},
{
id: 5,
title: '容器',
subTitle: 'container',
path: '/zh-CN/components/container',
title: "容器",
subTitle: "container",
path: "/zh-CN/components/container",
},
{
id: 11,
title: '栅格',
subTitle: 'grid',
path: '/zh-CN/components/grid',
title: "栅格",
subTitle: "grid",
path: "/zh-CN/components/grid",
},
{
id: 8,
title: '面板',
subTitle: 'panel',
path: '/zh-CN/components/panel',
title: "面板",
subTitle: "panel",
path: "/zh-CN/components/panel",
},
{
id: 9,
title: '卡片',
subTitle: 'card',
path: '/zh-CN/components/card',
title: "卡片",
subTitle: "card",
path: "/zh-CN/components/card",
},
],
},
{
id: 1,
title: '导航',
title: "导航",
children: [
{
id: 16,
title: '菜单',
subTitle: 'nav',
path: '/zh-CN/components/menu',
title: "菜单",
subTitle: "nav",
path: "/zh-CN/components/menu",
},
{
id: 17,
title: '面包屑',
subTitle: 'breadcrumb',
path: '/zh-CN/components/breadcrumb',
title: "面包屑",
subTitle: "breadcrumb",
path: "/zh-CN/components/breadcrumb",
},
{
id: 28,
title: '选项卡',
subTitle: 'tab',
path: '/zh-CN/components/tab',
title: "选项卡",
subTitle: "tab",
path: "/zh-CN/components/tab",
},
{
id: 27,
title: '下拉菜单',
subTitle: 'dropdown',
path: '/zh-CN/components/dropdown',
title: "下拉菜单",
subTitle: "dropdown",
path: "/zh-CN/components/dropdown",
},
{
id: 42,
title: '返回顶部',
subTitle: 'backtop',
path: '/zh-CN/components/backtop',
title: "返回顶部",
subTitle: "backtop",
path: "/zh-CN/components/backtop",
},
],
},
{
id: 1,
title: '表单',
title: "表单",
children: [
{
id: 36,
title: '开关',
subTitle: 'switch',
path: '/zh-CN/components/switch',
title: "开关",
subTitle: "switch",
path: "/zh-CN/components/switch",
},
{
id: 32,
title: '复选框',
subTitle: 'checkbox',
path: '/zh-CN/components/checkbox',
title: "复选框",
subTitle: "checkbox",
path: "/zh-CN/components/checkbox",
},
{
id: 33,
title: '单选框',
subTitle: 'radio',
path: '/zh-CN/components/radio',
title: "单选框",
subTitle: "radio",
path: "/zh-CN/components/radio",
},
{
id: 34,
title: '输入框',
subTitle: 'input',
path: '/zh-CN/components/input',
title: "输入框",
subTitle: "input",
path: "/zh-CN/components/input",
},
{
id: 341,
title: '数字输入框',
subTitle: 'inputNumber',
path: '/zh-CN/components/inputNumber',
title: "数字输入框",
subTitle: "inputNumber",
path: "/zh-CN/components/inputNumber",
},
{
id: 35,
title: '文本域',
subTitle: 'textarea',
path: '/zh-CN/components/textarea',
title: "文本域",
subTitle: "textarea",
path: "/zh-CN/components/textarea",
},
{
id: 39,
title: '下拉选择',
subTitle: 'select',
path: '/zh-CN/components/select',
title: "下拉选择",
subTitle: "select",
path: "/zh-CN/components/select",
},
{
id: 40,
title: '颜色选择器',
subTitle: 'colorPicker',
path: '/zh-CN/components/colorPicker',
title: "颜色选择器",
subTitle: "colorPicker",
path: "/zh-CN/components/colorPicker",
},
{
id: 29,
title: '图标选择器',
subTitle: 'iconPicker',
path: '/zh-CN/components/iconPicker',
title: "图标选择器",
subTitle: "iconPicker",
path: "/zh-CN/components/iconPicker",
},
{
id: 26,
title: '评分',
subTitle: 'rate',
path: '/zh-CN/components/rate',
title: "评分",
subTitle: "rate",
path: "/zh-CN/components/rate",
},
{
id: 37,
title: '滑块',
subTitle: 'slider',
path: '/zh-CN/components/slider',
title: "滑块",
subTitle: "slider",
path: "/zh-CN/components/slider",
},
{
id: 12,
title: '表单',
subTitle: 'form',
path: '/zh-CN/components/form',
title: "表单",
subTitle: "form",
path: "/zh-CN/components/form",
},
],
},
{
id: 1,
title: '展示',
title: "展示",
children: [
{
id: 18,
title: '进度',
subTitle: 'progress',
path: '/zh-CN/components/progress',
title: "进度",
subTitle: "progress",
path: "/zh-CN/components/progress",
},
{
id: 19,
title: '时间线',
subTitle: 'timeline',
path: '/zh-CN/components/timeline',
title: "时间线",
subTitle: "timeline",
path: "/zh-CN/components/timeline",
},
{
id: 21,
title: '折叠面板',
subTitle: 'collapse',
path: '/zh-CN/components/collapse',
title: "折叠面板",
subTitle: "collapse",
path: "/zh-CN/components/collapse",
},
{
id: 22,
title: '表格',
subTitle: 'table',
path: '/zh-CN/components/table',
title: "表格",
subTitle: "table",
path: "/zh-CN/components/table",
},
{
id: 23,
title: '头像',
subTitle: 'avatar',
path: '/zh-CN/components/avatar',
title: "头像",
subTitle: "avatar",
path: "/zh-CN/components/avatar",
},
{
id: 25,
title: '空',
subTitle: 'empty',
path: '/zh-CN/components/empty',
title: "空",
subTitle: "empty",
path: "/zh-CN/components/empty",
},
{
id: 29,
title: '分页',
subTitle: 'page',
path: '/zh-CN/components/page',
title: "分页",
subTitle: "page",
path: "/zh-CN/components/page",
},
{
id: 30,
title: '树形组件',
subTitle: 'tree',
path: '/zh-CN/components/tree',
title: "树形组件",
subTitle: "tree",
path: "/zh-CN/components/tree",
},
{
id: 31,
title: '穿梭框',
subTitle: 'transfer',
path: '/zh-CN/components/transfer',
title: "穿梭框",
subTitle: "transfer",
path: "/zh-CN/components/transfer",
},
{
id: 38,
title: '轮播',
subTitle: 'carousel',
path: '/zh-CN/components/carousel',
title: "轮播",
subTitle: "carousel",
path: "/zh-CN/components/carousel",
},
{
id: 43,
title: '数字滚动',
subTitle: 'countUp',
path: '/zh-CN/components/countup',
title: "数字滚动",
subTitle: "countUp",
path: "/zh-CN/components/countup",
},
],
},
{
id: 1,
title: '辅助',
title: "辅助",
children: [
{
id: 13,
title: '徽章',
subTitle: 'badge',
path: '/zh-CN/components/badge',
title: "徽章",
subTitle: "badge",
path: "/zh-CN/components/badge",
},
{
id: 14,
title: '区块',
subTitle: 'block',
path: '/zh-CN/components/block',
title: "区块",
subTitle: "block",
path: "/zh-CN/components/block",
},
{
id: 15,
title: '分割',
subTitle: 'line',
path: '/zh-CN/components/line',
title: "分割",
subTitle: "line",
path: "/zh-CN/components/line",
},
{
id: 24,
title: '字段',
subTitle: 'field',
path: '/zh-CN/components/field',
title: "字段",
subTitle: "field",
path: "/zh-CN/components/field",
},
{
id: 25,
title: '文字提示',
subTitle: 'tooltip',
path: '/zh-CN/components/tooltip',
title: "文字提示",
subTitle: "tooltip",
path: "/zh-CN/components/tooltip",
},
{
id: 99,
title: "分步",
subTitle: "setup",
path: "/zh-CN/components/step",
},
],
},
{
id: 1,
title: '反馈',
title: "反馈",
children: [
{
id: 90,
title: '弹层',
subTitle: 'modal',
path: '/zh-CN/components/modal',
},{
title: "弹层",
subTitle: "modal",
path: "/zh-CN/components/modal",
},
{
id: 91,
title: '加载',
subTitle: 'modal',
path: '/zh-CN/components/load',
},{
title: "加载",
subTitle: "modal",
path: "/zh-CN/components/load",
},
{
id: 92,
title: '询问',
subTitle: 'confirm',
path: '/zh-CN/components/confirm',
},{
title: "询问",
subTitle: "confirm",
path: "/zh-CN/components/confirm",
},
{
id: 93,
title: '消息',
subTitle: 'msg',
path: '/zh-CN/components/msg',
title: "消息",
subTitle: "msg",
path: "/zh-CN/components/msg",
},
],
},
]
];
const selected = ref(1)
const selected = ref(1);
const handleClick = function (menu) {
selected.value = menu.id
router.push(menu.path)
}
selected.value = menu.id;
router.push(menu.path);
};
return {
menus,
selected,
currentPath,
handleClick,
}
};
},
}
};
</script>