[new feature] add IndexBar component

This commit is contained in:
陈嘉涵
2019-05-08 15:39:27 +08:00
parent e9854daf29
commit c92791e8da
19 changed files with 515 additions and 3 deletions

View File

@@ -0,0 +1,26 @@
import { use } from '../utils';
import { ChildrenMixin } from '../mixins/relation';
const [sfc, bem] = use('index-anchor');
export default sfc({
mixins: [ChildrenMixin('vanIndexBar', { indexKey: 'childrenIndex' })],
props: {
index: [String, Number]
},
methods: {
scrollIntoView() {
this.$el.scrollIntoView();
}
},
render(h) {
return (
<div class={bem()}>
{this.slots('default') ? this.slots('default') : this.index}
</div>
);
}
});

View File

@@ -0,0 +1,8 @@
@import '../style/var';
.van-index-anchor {
padding: 0 15px;
font-size: 14px;
font-weight: 500;
line-height: 32px;
}