mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
44 lines
833 B
JavaScript
44 lines
833 B
JavaScript
import { use } from '../utils';
|
|
import Info from '../info';
|
|
import { ChildrenMixin } from '../mixins/relation';
|
|
|
|
const [sfc, bem] = use('sidebar-item');
|
|
|
|
export default sfc({
|
|
mixins: [ChildrenMixin('vanSidebar')],
|
|
|
|
props: {
|
|
url: String,
|
|
info: [String, Number],
|
|
title: String
|
|
},
|
|
|
|
computed: {
|
|
select() {
|
|
return this.index === +this.parent.activeKey;
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
onClick() {
|
|
this.$emit('click', this.index);
|
|
this.parent.$emit('change', this.index);
|
|
}
|
|
},
|
|
|
|
render(h) {
|
|
return (
|
|
<a
|
|
href={this.url}
|
|
class={[bem({ select: this.select }), 'van-hairline']}
|
|
onClick={this.onClick}
|
|
>
|
|
<div class={bem('text')}>
|
|
{this.title}
|
|
<Info info={this.info} class={bem('info')} />
|
|
</div>
|
|
</a>
|
|
);
|
|
}
|
|
});
|