提交 7d5ea60c 编写于 作者: A Amy 提交者: doly mood

feat(Index list): navbar prop (#148)

* feat(index-list): navbar Prop

* test(index-list): navbar prop

* docs(index-list): navbar prop
上级 98e06ab0
......@@ -137,6 +137,7 @@
| - | - | - | - |
| title | title | String | - |
| data | data to be displayed | Array | [] |
| navbar | whether need navbar | Boolean | true |
| speed | when click the navigator, the transition time of scrolling to the specific anchor (unit: ms). | number | 0 |
- `data` sub configuration
......
......@@ -137,6 +137,7 @@
| - | - | - | - |
| title | 标题 | String | - |
| data | 需要展示的数据 | Array | [] |
| navbar | 是否需要导航栏 | Boolean | true |
| speed | 点击导航栏索引时,滚动到相应位置的动画时间(单位:ms) | number | 0 |
- `data` 子配置项
......
......@@ -18,7 +18,7 @@
</ul>
</div>
</cube-scroll>
<div class="cube-index-list-nav" @touchstart="onShortcutTouchStart" @touchmove.stop.prevent="onShortcutTouchMove">
<div v-if="navbar" class="cube-index-list-nav" @touchstart="onShortcutTouchStart" @touchmove.stop.prevent="onShortcutTouchMove">
<ul class="cube-index-list-nav-list">
<li
v-for="(item, index) in shortcutList"
......@@ -68,6 +68,10 @@
speed: {
type: Number,
default: 0
},
navbar: {
type: Boolean,
default: true
}
},
data() {
......
......@@ -132,6 +132,15 @@ describe('IndexList', () => {
})
})
it('should not have navbar when navbar prop is false', () => {
vm = createIndexList({
data,
navbar: false
})
const navbar = vm.$el.querySelector('.cube-index-list-nav')
expect(navbar).to.equal(null)
})
it('run normal when group or item undefined', () => {
vm = createIndexList({
data: [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册