mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 03:11:15 +00:00
[new feature] add IndexBar component
This commit is contained in:
26
packages/index-anchor/index.js
Normal file
26
packages/index-anchor/index.js
Normal 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>
|
||||
);
|
||||
}
|
||||
});
|
8
packages/index-anchor/index.less
Normal file
8
packages/index-anchor/index.less
Normal file
@@ -0,0 +1,8 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-index-anchor {
|
||||
padding: 0 15px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 32px;
|
||||
}
|
Reference in New Issue
Block a user