layui/docs/src/layouts/Layout.vue

373 lines
8.2 KiB
Vue
Raw Normal View History

2021-09-26 22:09:33 +00:00
<template>
2021-09-27 08:42:13 +00:00
<div class="width:100%;height:300px">
2021-09-27 14:01:22 +00:00
<lay-layout>
<lay-header style="background: #393d49">
2021-09-28 17:48:18 +00:00
<lay-logo>
2021-09-29 02:56:20 +00:00
<img src="../assets/logo.png" />
2021-09-28 17:48:18 +00:00
</lay-logo>
2021-10-06 15:22:30 +00:00
<ul
class="layui-nav layui-layout-left"
style="margin-top: 10px; margin-bottom: 0px"
>
<lay-form>
<lay-search :datas="menus" />
2021-10-06 15:22:30 +00:00
</lay-form>
</ul>
<ul
class="layui-nav layui-layout-right"
style="margin-top: 0px; margin-bottom: 0px"
>
<li class="layui-nav-item">
<a href="https://gitee.com/layui-vue/layui-vue-sample"> 案例 </a>
</li>
2021-09-29 02:56:20 +00:00
<li class="layui-nav-item">
<a href="https://gitee.com/layui-vue/layui-vue"> 仓库 </a>
2021-09-29 02:56:20 +00:00
</li>
<li class="layui-nav-item">
<a
2021-10-20 07:14:14 +00:00
href="https://gitee.com/layui-vue/layui-vue/issues?assignee_id=&author_id=&branch=&collaborator_ids=&issue_search=&label_ids=&label_text=&milestone_id=&priority=&private_issue=&program_id=&project_id=Jmysy%2Flayui-vue&project_type=&scope=&sort=&state=all&target_project="
>
反馈
</a>
2021-09-29 02:56:20 +00:00
</li>
<li class="layui-nav-item">
<a href="javascript:void(0)"> 0.1.7 </a>
</li>
2021-09-29 02:56:20 +00:00
</ul>
2021-09-27 14:01:22 +00:00
</lay-header>
<lay-side>
<ul
class="layui-menu layui-menu-lg layui-menu-docs"
style="padding: 6px"
>
2021-09-30 02:49:45 +00:00
<li
v-for="menu in menus"
:key="menu"
:class="[
currentPath === menu.path ? 'layui-menu-item-checked2' : '',
]"
2021-09-30 02:49:45 +00:00
@click="handleClick(menu)"
>
<div class="layui-menu-body-title">
2021-09-30 05:54:04 +00:00
<router-link :to="menu.path">
<span>{{ menu.title }}</span>
<span class="layui-font-12 layui-font-gray">
{{ menu.subTitle }}
</span>
</router-link>
</div>
2021-09-29 02:56:20 +00:00
</li>
2021-09-27 14:01:22 +00:00
</ul>
</lay-side>
<lay-body>
<div style="padding: 20px">
<router-view />
2021-09-27 14:01:22 +00:00
</div>
</lay-body>
</lay-layout>
2021-09-27 08:42:13 +00:00
</div>
2021-09-26 22:09:33 +00:00
</template>
<script>
2021-10-06 15:22:30 +00:00
import { ref, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
2021-09-26 22:09:33 +00:00
export default {
setup() {
2021-10-06 15:22:30 +00:00
const route = useRoute()
2021-09-30 02:49:45 +00:00
const router = useRouter()
const currentPath = ref('/zh-CN/guide')
2021-10-06 15:22:30 +00:00
watch(
() => route.path,
(val) => {
currentPath.value = val
},
{
immediate: true,
deep: true,
2021-10-06 15:22:30 +00:00
}
)
2021-09-30 02:49:45 +00:00
const menus = [
2021-10-06 15:22:30 +00:00
{
id: 1,
title: '介绍',
subTitle: 'introduce',
path: '/zh-CN/guide/introduce',
2021-10-06 15:22:30 +00:00
},
{
id: 2,
title: '安装',
subTitle: 'get started',
path: '/zh-CN/guide/getStarted',
2021-10-06 15:22:30 +00:00
},
{
id: 3,
title: '更新',
subTitle: 'change log',
2021-10-06 15:22:30 +00:00
path: '/zh-CN/guide/changelog',
},
{
id: 4,
title: '布局',
subTitle: 'layout',
path: '/zh-CN/components/layout',
},
{
id: 5,
title: '容器',
subTitle: 'container',
path: '/zh-CN/components/container',
},
{
id: 6,
title: '按钮',
subTitle: 'button',
path: '/zh-CN/components/button',
},
{
id: 7,
title: '图标',
subTitle: 'iconfont',
path: '/zh-CN/components/icon',
},
{
id: 8,
title: '面板',
subTitle: 'panel',
path: '/zh-CN/components/panel',
},
{
id: 9,
title: '卡片',
subTitle: 'card',
path: '/zh-CN/components/card',
},
{
id: 10,
title: '动画',
subTitle: 'animation',
path: '/zh-CN/components/animation',
},
{
id: 11,
title: '栅格',
subTitle: 'grid',
path: '/zh-CN/components/grid',
},
{
id: 12,
title: '表单',
subTitle: 'form',
path: '/zh-CN/components/form',
},
{
id: 13,
title: '徽章',
subTitle: 'badge',
path: '/zh-CN/components/badge',
},
{
id: 14,
title: '区块',
subTitle: 'block',
path: '/zh-CN/components/block',
},
{
id: 15,
title: '分割',
subTitle: 'line',
path: '/zh-CN/components/line',
},
{
id: 16,
title: '菜单',
subTitle: 'nav',
path: '/zh-CN/components/menu',
},
{
id: 17,
title: '面包屑',
subTitle: 'breadcrumb',
path: '/zh-CN/components/breadcrumb',
},
{
id: 18,
title: '进度',
subTitle: 'progress',
path: '/zh-CN/components/progress',
},
{
id: 19,
title: '时间线',
subTitle: 'timeline',
path: '/zh-CN/components/timeline',
},
{
id: 20,
title: '颜色',
subTitle: 'color',
path: '/zh-CN/components/color',
},
{
id: 21,
title: '手风琴',
subTitle: 'collapse',
path: '/zh-CN/components/collapse',
},
{
id: 22,
title: '表格',
subTitle: 'table',
path: '/zh-CN/components/table',
},
{
id: 23,
title: '头像',
subTitle: 'avatar',
path: '/zh-CN/components/avatar',
},
{
id: 24,
title: '字段',
subTitle: 'field',
path: '/zh-CN/components/field',
},
{
id: 25,
title: '空',
subTitle: 'empty',
path: '/zh-CN/components/empty',
},
{
id: 26,
title: '评分',
subTitle: 'rate',
path: '/zh-CN/components/rate',
},
{
id: 27,
title: '下拉菜单',
subTitle: 'dropdown',
path: '/zh-CN/components/dropdown',
},
{
id: 28,
title: '选项卡',
subTitle: 'tab',
path: '/zh-CN/components/tab',
},
{
2021-10-06 18:03:35 +00:00
id: 29,
title: '图标选择',
subTitle: 'iconPicker',
path: '/zh-CN/components/iconPicker',
},
{
2021-10-09 02:41:52 +00:00
id: 29,
title: '分页',
subTitle: 'page',
path: '/zh-CN/components/page',
2021-10-06 15:22:30 +00:00
},
{
id: 30,
title: '树形组件',
subTitle: 'tree',
path: '/zh-CN/components/tree',
},
{
id: 31,
title: '穿梭框',
2021-10-10 16:11:54 +00:00
subTitle: 'transfer',
path: '/zh-CN/components/transfer',
},
2021-10-12 08:22:26 +00:00
{
id: 32,
title: '复选框',
subTitle: 'checkbox',
path: '/zh-CN/components/checkbox',
},
{
id: 33,
title: '单选框',
subTitle: 'radio',
path: '/zh-CN/components/radio',
},
{
id: 34,
title: '输入框',
subTitle: 'input',
path: '/zh-CN/components/input',
},
{
id: 35,
title: '文本域',
subTitle: 'textarea',
path: '/zh-CN/components/textarea',
},
{
id: 36,
title: '开关',
subTitle: 'switch',
path: '/zh-CN/components/switch',
},
{
id: 37,
title: '滑块',
subTitle: 'slider',
path: '/zh-CN/components/slider',
},
{
id: 38,
title: '轮播',
subTitle: 'carousel',
path: '/zh-CN/components/carousel',
},
2021-09-30 02:49:45 +00:00
]
const selected = ref(1)
const handleClick = function (menu) {
selected.value = menu.id
router.push(menu.path)
}
return {
menus,
selected,
2021-10-06 15:22:30 +00:00
currentPath,
2021-09-30 02:49:45 +00:00
handleClick,
}
2021-09-26 22:09:33 +00:00
},
}
2021-09-28 17:48:18 +00:00
</script>
<style>
.layui-logo img {
height: 31px;
width: 82px;
left: 15px;
top: 16px;
}
2021-09-30 02:49:45 +00:00
.layui-menu-docs {
padding-top: 10px;
}
2021-09-30 05:54:04 +00:00
.layui-menu-docs .layui-menu-body-title .layui-font-gray {
padding-left: 10px;
}
2021-10-10 17:08:26 +00:00
@media screen and (max-width: 768px) {
.layui-side {
width: 0px !important;
2021-10-10 17:08:26 +00:00
}
.layui-body {
left: 0px !important;
width: 100% !important;
2021-10-10 17:08:26 +00:00
}
.layui-logo {
display: none !important;
2021-10-10 17:08:26 +00:00
}
.layui-layout-left {
left: 0px !important;
2021-10-10 17:08:26 +00:00
}
}
</style>