Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev mipengine.org #851

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4ee1872
add mip-sidenav
chenqiushi Jul 3, 2018
3c21b8d
fix sidenav 组件
chenqiushi Jul 17, 2018
b5df4b6
fix style
chenqiushi Jul 18, 2018
69d3ac6
Merge branch 'master' of github.com:mipengine/mip2-extensions-platfor…
clark-t Jul 19, 2018
8bc7f0c
Merge branch 'dev-mipengine.org' of github.com:mipengine/mip2-extensi…
clark-t Jul 19, 2018
9f25fa7
去掉 stop
clark-t Jul 19, 2018
706dab7
fix style
chenqiushi Jul 19, 2018
d1a32ed
fix 多级目录样式问题
chenqiushi Jul 19, 2018
79efcd9
fix 递归 warning
chenqiushi Jul 20, 2018
f07046a
fix style
chenqiushi Jul 20, 2018
0a88a4f
fix: 锚点状态
chenqiushi Jul 23, 2018
d62830d
stylus => less
chenqiushi Jul 26, 2018
8bb632a
fix style
chenqiushi Aug 1, 2018
b8f9427
侧边栏支持定位
chenqiushi Aug 1, 2018
cf813b6
容错
chenqiushi Aug 1, 2018
20f7312
fix bug
chenqiushi Aug 1, 2018
14b0e10
容错:没有 hash 时,默认选择第一章节
chenqiushi Aug 1, 2018
9489e58
滚动距离修正 + 去掉 stop
chenqiushi Aug 2, 2018
0da62dc
reset stop
chenqiushi Aug 2, 2018
fcb8519
fix chapter indent bug
chenqiushi Aug 9, 2018
002b164
处理多层标题的缩进问题
chenqiushi Aug 17, 2018
13da057
update style of chapters
chenqiushi Aug 22, 2018
f9af858
给组件增加事件
clark-t Sep 20, 2018
6ed6c75
mip-stepper-tabs
liuruoran88 Dec 19, 2018
d040050
merge master
clark-t Dec 19, 2018
932e2c1
Merge branch 'dev-mipengine.org' of github.com:mipengine/mip2-extensi…
clark-t Dec 19, 2018
02f21bd
增加 mipengine.org 官网所需的侧边栏组件
clark-t Dec 19, 2018
298a9af
按照第三方站长组件的命名规范重新修改组件名称
clark-t Dec 19, 2018
9a66361
删掉 .stylelint
clark-t Dec 19, 2018
23146cc
组件重命名
clark-t Dec 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions sites/mipengine.org/components/mip-mipengine-sidenav/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `mip-mipengine-sidenav`

## 说明

组件功能说明

## 示例

示例说明

## 属性

属性说明

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<template>
<div
ref="sidenavLeft"
class="sidenav-wrapper"
@click="click($event)"
>
<sidenav-menu
:menu="menu"
:url="url"
:level="level"
:activeindex="activeIndex">
<template slot-scope="slotProps">
<sidenav-chapter
:chapters="chapters"
:level="level"
:active="activeChapter"
@select="chapterSelected"/>
</template>
</sidenav-menu>
</div>
</template>

<style scoped lang="less">
.sidenav-wrapper {
}
</style>

<script>
import SidenavChapter from './mip-sidenav-chapter'
import SidenavMenu from './mip-sidenav-menu'

export default {
name: 'MipSidenav',
components: {
SidenavChapter,
SidenavMenu
},
props: {
menu: {
type: Array,
default: null
},
chapters: {
type: Array,
default: null
},
level: {
type: Number,
default: 0
},
url: {
type: String,
default: ''
}
},
data () {
return {
activeChapter: decodeURIComponent(location.hash) || ''
}
},
computed: {
activeIndex: function () {
return this.menu.findIndex(m => {
return m.children && m.children.find(c => {
return c.url === this.url
})
})
}
},
mounted () {
let activeDom = this.$refs.sidenavLeft.querySelectorAll('.activemenu')[0]
let activeTop = activeDom ? activeDom.offsetTop : 0
let scrollDom = document.querySelectorAll('.layout-sidebar')[0]
if (scrollDom) {
scrollDom.scrollTop = activeTop
}
},
methods: {
chapterSelected (key) {
this.activeChapter = key
},
click (e) {
this.$nextTick(() => {
this.$emit('clicked', e)
})
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<template>
<div class="wd-infinity-chapters">
<template v-for="(item, index) in chapters">
<a
v-if="level !== 0"
:key="item.text"
:class="{selected: active ? active === item.hash : (index === 0 && level === 1)}"
:href="item.hash"
class="chapter-title"
@click="select(item.hash)"
>
<div v-html="item.text"/>
</a>
<div
v-if="item.children"
:class="'children-' + level"
:key="item.text">
<mip-sidenav-chapter
:chapters="item.children"
:level="level + 1"
:active="active"
@select="select"/>
</div>
</template>
</div>
</template>

<style scoped lang="less">
.wd-infinity-chapters {
position: relative;
div[class^="children-"] {
.chapter-title {
font-size: 14px;
line-height: 24px;
color: #555;
padding: 10px 10px 10px 0;
display: block;
cursor: pointer;
margin-left: 10px;
&:active {
background: #f5f5f5;
}
@media (min-width: 768px) {
&:hover {
background: #f5f5f5;
}
}
&.selected {
>div {
color: #000;
font-weight: bold;
border-left: 2px solid #000;
transition: border .2s linear;
}
}

>div {
border-left: 2px solid transparent;
padding-left: 30px;
margin-left: -12px;
position: relative;
&::before {
content: '·';
color: #000;
display: inline-block;
padding-right: 5px;
position: absolute;
left: 20px;
}
}
}
}
.children-0 {
margin-left: 10px;
border-left: 2px solid #f1f1f1;
&>.wd-infinity-chapters {
margin-bottom: 16px;
&>.chapter-title {
>div {
padding-left: 20px;
&::before {
display: none;
}
}
}
// 隐藏多余的 border
&>:first-child {
&:before {
content: '';
height: 12px;
border-left: 6px solid #fff;
position: absolute;
top: 0;
left: -4px;
}
}
&>:last-child {
&:after {
content: '';
height: 12px;
border-left: 6px solid #fff;
position: absolute;
bottom: 0;
left: -4px;
}
}
}
}

// 特殊第4、5层
.children-2 {
&>.wd-infinity-chapters {
padding-left: 10px;
&>.chapter-title {
>div {
padding-left: 40px;
margin-left: -22px;
&::before {
left: 30px;
}
}
}
}
}

.children-3 {
&>.wd-infinity-chapters {
padding-left: 10px;
&>.chapter-title {
>div {
padding-left: 50px;
margin-left: -32px;
&::before {
left: 40px;
}
}
}
}
}
}
</style>

<script>
export default {
name: 'MipSidenavChapter',
props: {
chapters: {
type: Array,
default: null
},
level: {
type: Number,
default: 0
},
active: {
type: String,
default: ''
}
},
mounted () {
},
methods: {
select (key) {
this.$emit('select', key)
}
}
}
</script>
Loading