Skip to content

Commit

Permalink
feat: 🎸 显示更多组建开发中
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Dec 25, 2020
1 parent c395e27 commit fa9f24d
Show file tree
Hide file tree
Showing 21 changed files with 723 additions and 85 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -19,15 +19,15 @@
"clipboard": "^2.0.6",
"core-js": "^3.6.5",
"echarts": "^4.9.0",
"element-plus": "1.0.1-beta.11",
"element-plus": "1.0.1-beta.14",
"highlight.js": "^10.4.0",
"lodash-es": "^4.17.15",
"mitt": "^2.1.0",
"mockjs": "^1.1.0",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.2.0",
"qs": "^6.9.4",
"resize-observer-polyfill": "^1.5.1",
"screenfull": "^5.0.2",
"vditor": "^3.7.0",
"vue": "3.0.4",
Expand Down
84 changes: 84 additions & 0 deletions src/components/More/index.vue
@@ -0,0 +1,84 @@
<template>
<div class="more__item clearfix">
<p class="more__item--text">{{ content }}</p>
</div>
</template>

<script lang="ts">
import { defineComponent, PropType, computed, unref, onMounted, nextTick, ref } from 'vue'
export default defineComponent({
name: 'More',
props: {
// 内容
content: {
type: String as PropType<string>,
default: ''
},
// 默认展示几行
lineClamp: {
type: Number as PropType<number>,
default: 0
},
// 宽度
width: {
type: String as PropType<string>,
default: '300px'
},
// style
style: {
type: Object as PropType<object>,
default: () => {
return {
width: '300px',
float: 'left'
}
}
}
},
setup(props) {
const styleObj = computed(() => {
})
}
})
</script>

<style lang="less" scoped>
.more__item {
width: 528px;
height: 122px;
float: left;
.more__item--text {
width: 476px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
font-size: 14px;
color: #545c63;
line-height: 28px;
transition: all .1s;
text-align: left;
&:hover {
background: #fff;
height: auto;
position: relative;
z-index: 5;
border-radius: 8px;
box-shadow: 0 8px 16px 0 rgba(7,17,27,.2);
-webkit-line-clamp: inherit;
padding: 10px;
margin-top: -10px;
margin-left: -10px;
}
}
}
.clearfix:after {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
</style>
20 changes: 0 additions & 20 deletions src/components/Setting/index.vue
Expand Up @@ -35,14 +35,6 @@
<div class="setting__title">顶部菜单主题</div> -->

<!-- <div class="setting__title">界面功能</div> -->
<!-- <div class="setting__item">
<span>固定顶部操作栏</span>
<el-switch v-model="fixedNavbar" @change="setFixedNavbar" />
</div>
<div class="setting__item">
<span>固定标签页</span>
<el-switch v-model="fixedTags" @change="setFixedTags" />
</div> -->

<div class="setting__title">界面显示</div>
<div class="setting__item">
Expand Down Expand Up @@ -116,16 +108,6 @@ export default defineComponent({
appStore.SetCollapsed(false)
}
// const fixedNavbar = ref<boolean>(appStore.fixedNavbar)
// function setFixedNavbar(fixedNavbar: boolean) {
// appStore.SetFixedNavbar(fixedNavbar)
// }
// const fixedTags = ref<boolean>(appStore.fixedTags)
// function setFixedTags(fixedTags: boolean) {
// appStore.SetFixedTags(fixedTags)
// }
const fixedHeader = ref<boolean>(appStore.fixedHeader)
function setFixedHeader(fixedHeader: boolean) {
appStore.SetFixedHeader(fixedHeader)
Expand Down Expand Up @@ -179,8 +161,6 @@ export default defineComponent({
return {
drawer, toggleClick,
layout, setLayout,
// fixedNavbar, setFixedNavbar,
// fixedTags, setFixedTags,
fixedHeader, setFixedHeader,
navbar, setNavbar,
hamburger, setHamburger,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index/layout/components/AppMain.vue
Expand Up @@ -26,7 +26,7 @@ export default defineComponent({

<style lang="less" scoped>
.app-main {
overflow: hidden;
// overflow: hidden;
padding: 20px;
}
</style>
52 changes: 48 additions & 4 deletions src/pages/index/router/index.ts
Expand Up @@ -24,6 +24,8 @@ const Layout = () => import('../layout/index.vue')
affix: true 如果设置为true,则会一直固定在tag项中(默认 false)
noTagsView: true 如果设置为true,则不会出现在tag中(默认 false)
activeMenu: '/dashboard' 显示高亮的路由路径
followAuth: '/dashboard' 跟随哪个路由进行权限过滤
showMainRoute: true 设置为true即使hidden为true,也依然可以进行路由跳转(默认 false)
}
**/

Expand Down Expand Up @@ -178,6 +180,14 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
meta: {
title: '弹窗'
}
},
{
path: 'more',
component: () => import('_p/index/views/components-demo/more/index.vue'),
name: 'MoreDemo',
meta: {
title: '显示更多'
}
}
]
},
Expand Down Expand Up @@ -499,11 +509,45 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
},
children: [
{
path: 'example',
component: () => import('_p/index/views/example-demo/example/index.vue'),
name: 'Example',
path: 'example-dialog',
component: () => import('_p/index/views/example-demo/example-dialog/index.vue'),
name: 'ExampleDialog',
meta: {
title: '列表综合实例-弹窗'
}
},
{
path: 'example-page',
component: () => import('_p/index/views/example-demo/example-page/index.vue'),
name: 'ExamplePage',
meta: {
title: '列表综合实例-页面'
}
},
{
path: 'example-add',
component: () => import('_p/index/views/example-demo/example-page/example-add.vue'),
name: 'ExampleAdd',
meta: {
title: '列表综合实例'
title: '列表综合实例-新增',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example-demo/example-page'
}
},
{
path: 'example-edit',
component: () => import('_p/index/views/example-demo/example-page/example-edit.vue'),
name: 'ExampleEdit',
meta: {
title: '列表综合实例-编辑',
noTagsView: true,
noCache: true,
hidden: true,
showMainRoute: true,
activeMenu: '/example-demo/example-page'
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions src/pages/index/router/types.d.ts
Expand Up @@ -10,6 +10,8 @@ export interface RouteMeta {
activeMenu?: string
parent?: string
noTagsView?: boolean
followAuth?: string
showMainRoute?: boolean
}

export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
Expand Down
20 changes: 0 additions & 20 deletions src/pages/index/store/modules/app.ts
Expand Up @@ -7,8 +7,6 @@ export interface AppState {
showLogo: Boolean
showNavbar: Boolean
fixedHeader: Boolean
// fixedTags: Boolean
// fixedNavbar: Boolean
layout: String
showBreadcrumb: Boolean
showHamburger: Boolean
Expand All @@ -25,8 +23,6 @@ class App extends VuexModule implements AppState {
public showLogo = true // 是否显示logo
public showTags = true // 是否显示标签栏
public showNavbar = true // 是否显示navbar
// public fixedTags = true // 是否固定标签栏
// public fixedNavbar = true // 是否固定navbar
public fixedHeader = true // 是否固定header
public layout = 'Classic' // layout布局
public showBreadcrumb = true // 是否显示面包屑
Expand All @@ -53,14 +49,6 @@ class App extends VuexModule implements AppState {
private SET_NAVBAR(showNavbar: boolean): void {
this.showNavbar = showNavbar
}
// @Mutation
// private SET_FIXEDTAGS(fixedTags: boolean): void {
// this.fixedTags = fixedTags
// }
// @Mutation
// private SET_FIXEDNAVBAR(fixedNavbar: boolean): void {
// this.fixedNavbar = fixedNavbar
// }
@Mutation
private SET_FIXEDHEADER(fixedHeader: boolean): void {
this.fixedHeader = fixedHeader
Expand Down Expand Up @@ -114,14 +102,6 @@ class App extends VuexModule implements AppState {
public SetFixedHeader(fixedHeader: boolean): void {
this.SET_FIXEDHEADER(fixedHeader)
}
// @Action
// public SetFixedTags(fixedTags: boolean): void {
// this.SET_FIXEDTAGS(fixedTags)
// }
// @Action
// public SetFixedNavbar(fixedNavbar: boolean): void {
// this.SET_FIXEDNAVBAR(fixedNavbar)
// }
@Action
public SetLayout(layout: 'Classic' | 'LeftTop' | 'Top' | 'Test'): void {
this.SET_LAYOUT(layout)
Expand Down
34 changes: 1 addition & 33 deletions src/pages/index/store/modules/permission.ts
Expand Up @@ -51,45 +51,13 @@ class Permission extends VuexModule implements PermissionState {
}
}

// // 二级以上的菜单降级成二级菜单
// function formatRouter(routes: AppRouteRecordRaw[], basePath = '/', list: AppRouteRecordRaw[] = [], parent: AppRouteRecordRaw) {
// routes.map((item: AppRouteRecordRaw) => {
// item.path = path.resolve(basePath, item.path)
// const meta: RouteMeta = item.meta || {}
// if (!meta.parent && parent) {
// meta.parent = parent.path
// item.meta = meta
// }
// if (item.redirect && item.redirect !== 'noredirect') {
// item.redirect = path.resolve(basePath, item.redirect as any)
// }
// if (item.children && item.children.length > 0) {
// const arr: AppRouteRecordRaw[] = formatRouter(item.children, item.path, list, item)
// delete item.children
// list.concat(arr)
// }
// list.push(item)
// })
// return list
// }

// // 菜单降级
// function getFlatRoutes(routes: AppRouteRecordRaw[]): AppRouteRecordRaw[] {
// return routes.map((child: AppRouteRecordRaw) => {
// if (child.children && child.children.length > 0) {
// child.children = formatRouter(child.children, child.path, [], child)
// }
// return child
// })
// }

// 路由过滤,主要用于权限控制
function generateRoutes(routes: AppRouteRecordRaw[]): AppRouteRecordRaw[] {
const res: AppRouteRecordRaw[] = []

for (const route of routes) {
// skip some route
if (route.meta && route.meta.hidden) {
if (route.meta && route.meta.hidden && !route.meta.showMainRoute) {
continue
}

Expand Down
46 changes: 46 additions & 0 deletions src/pages/index/views/components-demo/more/index.vue
@@ -0,0 +1,46 @@
<template>
<div>
<el-alert
effect="dark"
:closable="false"
title="显示更多组件。"
type="info"
style="margin-bottom: 20px;"
/>

<el-alert
effect="dark"
:closable="false"
title="默认显示一行,超出隐藏。"
type="info"
style="margin-bottom: 20px;margin-top: 20px;"
/>
<div>
<More :line-clamp="3" content="2020版是根据(前端)全栈工程师岗位要求,结合时下技术热点及未来前端术发展趋势全新制作的课程,让你实现从零基础到具备全栈能力的就业水平。相比之前的版本,我们有几大重要内容:1. 两大核心企业项目贯穿整个体系,实现项目闭环开发,亲历从0到1的企业级项目。项目之间强关联,还原企业开发模式,渐进式实现,过程更顺滑。第一个旅游网项目,还原企业迭代开发,同一个项目从PC端演变到移动webapp,掌握跨端开发能力。 第二个电商全栈项目,用Vue.js 实现前端,node.js+koa2+MongoDB实现后端,打造6大核心业务,15+精美网页,12+真实数据接口,并打通前后端数据联调。2. 项目驱动式教学,案例融入课程讲解中,让学习不枯燥。多领域案例帮你开拓眼界和经验。3. 不用担心版本问题,课程截止上线使用最新版本。比如Vue3.0等,让大家学到新技术。4. 技术覆盖更实用更全面,从0基础到全栈能力循序渐进的培养,慕课网宗旨只学有用的。帮你打通跨端和全栈技能。5. 慕课网网红讲师亲授,讲解更细致,阶梯式习题,整门课程代码量将达到6万行,相当于1~2年工作经验所敲代码。" />
</div>
<el-alert
effect="dark"
:closable="false"
title="默认显示3行,超出隐藏。"
type="info"
style="margin-bottom: 20px;margin-top: 20px;"
/>
<div>
<More :line-clamp="3" content="2020版是根据(前端)全栈工程师岗位要求,结合时下技术热点及未来前端术发展趋势全新制作的课程,让你实现从零基础到具备全栈能力的就业水平。相比之前的版本,我们有几大重要内容:1. 两大核心企业项目贯穿整个体系,实现项目闭环开发,亲历从0到1的企业级项目。项目之间强关联,还原企业开发模式,渐进式实现,过程更顺滑。第一个旅游网项目,还原企业迭代开发,同一个项目从PC端演变到移动webapp,掌握跨端开发能力。 第二个电商全栈项目,用Vue.js 实现前端,node.js+koa2+MongoDB实现后端,打造6大核心业务,15+精美网页,12+真实数据接口,并打通前后端数据联调。2. 项目驱动式教学,案例融入课程讲解中,让学习不枯燥。多领域案例帮你开拓眼界和经验。3. 不用担心版本问题,课程截止上线使用最新版本。比如Vue3.0等,让大家学到新技术。4. 技术覆盖更实用更全面,从0基础到全栈能力循序渐进的培养,慕课网宗旨只学有用的。帮你打通跨端和全栈技能。5. 慕课网网红讲师亲授,讲解更细致,阶梯式习题,整门课程代码量将达到6万行,相当于1~2年工作经验所敲代码。" />
</div>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import More from '_c/More/index.vue'
export default defineComponent({
// name: 'MoreDemo',
components: {
More
}
})
</script>

<style>
</style>
Expand Up @@ -112,7 +112,7 @@ const columns = [
]
export default defineComponent({
// name: 'Example',
// name: 'ExampleDialog',
components: {
IfnoWrite
},
Expand Down

0 comments on commit fa9f24d

Please sign in to comment.