[improvement] rename packages dir to src (#3659)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { createNamespace } from '../utils';
|
||||
import Info from '../info';
|
||||
import { ChildrenMixin } from '../mixins/relation';
|
||||
|
||||
const [createComponent, bem] = createNamespace('sidebar-item');
|
||||
|
||||
export default createComponent({
|
||||
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>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-sidebar-item {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
padding: @sidebar-padding;
|
||||
overflow: hidden;
|
||||
color: @sidebar-text-color;
|
||||
font-size: @sidebar-font-size;
|
||||
line-height: @sidebar-line-height;
|
||||
word-break: break-all;
|
||||
background-color: @sidebar-background-color;
|
||||
border-left: 3px solid transparent;
|
||||
user-select: none;
|
||||
|
||||
&__text {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: @sidebar-active-color;
|
||||
}
|
||||
|
||||
&:not(:last-child)::after {
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
&--select {
|
||||
color: @sidebar-selected-text-color;
|
||||
font-weight: @sidebar-selected-font-weight;
|
||||
border-color: @sidebar-selected-border-color;
|
||||
|
||||
&::after {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
&,
|
||||
&:active {
|
||||
background-color: @sidebar-selected-background-color;
|
||||
}
|
||||
}
|
||||
|
||||
.van-info {
|
||||
right: 4px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user