1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
| import _extends from "@babel/runtime/helpers/esm/extends";
| import { createNamespace } from '../utils';
| import { ChildrenMixin } from '../mixins/relation';
| import { route, routeProps } from '../utils/router';
| import Info from '../info';
|
| var _createNamespace = createNamespace('sidebar-item'),
| createComponent = _createNamespace[0],
| bem = _createNamespace[1];
|
| export default createComponent({
| mixins: [ChildrenMixin('vanSidebar')],
| props: _extends({}, routeProps, {
| dot: Boolean,
| // @deprecated
| info: [Number, String],
| badge: [Number, String],
| title: String,
| disabled: Boolean
| }),
| computed: {
| select: function select() {
| return this.index === +this.parent.activeKey;
| }
| },
| methods: {
| onClick: function onClick() {
| if (this.disabled) {
| return;
| }
|
| this.$emit('click', this.index);
| this.parent.$emit('input', this.index);
| this.parent.setIndex(this.index);
| route(this.$router, this);
| }
| },
| render: function render() {
| var _this$slots, _this$badge;
|
| var h = arguments[0];
|
| if (process.env.NODE_ENV === 'development' && this.info) {
| console.warn('[Vant] SidebarItem: "info" prop is deprecated, use "badge" prop instead.');
| }
|
| return h("a", {
| "class": bem({
| select: this.select,
| disabled: this.disabled
| }),
| "on": {
| "click": this.onClick
| }
| }, [h("div", {
| "class": bem('text')
| }, [(_this$slots = this.slots('title')) != null ? _this$slots : this.title, h(Info, {
| "attrs": {
| "dot": this.dot,
| "info": (_this$badge = this.badge) != null ? _this$badge : this.info
| },
| "class": bem('info')
| })])]);
| }
| });
|
|