Skip to content

Commit c11599a

Browse files
committed
refactor: cleanup
1 parent 8d4d229 commit c11599a

File tree

6 files changed

+28
-26
lines changed

6 files changed

+28
-26
lines changed

src/components/Breadcrumb/Breadcrumb.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ export default {
1616
default: () => []
1717
}
1818
},
19+
computed: {
20+
routeRecords: function () {
21+
return this.list.filter((route) => route.name || route.meta.label)
22+
}
23+
},
1924
methods: {
2025
getName (item) {
2126
return item.meta && item.meta.label ? item.meta.label : item.name || null
2227
},
2328
isLast (index) {
2429
return index === this.list.length - 1
2530
}
26-
},
27-
computed: {
28-
routeRecords: function () {
29-
return this.list.filter((route) => route.name || route.meta.label)
30-
}
3131
}
3232
}
3333
</script>

src/components/Footer/Footer.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ export default {
1313
default: false
1414
}
1515
},
16-
mounted: function () {
17-
this.isFixed()
18-
},
1916
computed: {
2017
classList () {
2118
return [
2219
'app-footer'
2320
]
2421
}
2522
},
23+
mounted: function () {
24+
this.isFixed()
25+
},
2626
methods: {
2727
isFixed () {
2828
this.fixed ? document.body.classList.add('footer-fixed') : document.body.classList.remove('footer-fixed')

src/components/Sidebar/SidebarNav.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ import VuePerfectScrollbar from 'vue-perfect-scrollbar'
5757
5858
export default {
5959
name: 'SidebarNav',
60-
props: {
61-
navItems: {
62-
type: Array,
63-
required: true,
64-
default: () => []
65-
}
66-
},
6760
components: {
6861
SidebarNavDivider,
6962
SidebarNavDropdown,
@@ -73,6 +66,13 @@ export default {
7366
SidebarNavLabel,
7467
VuePerfectScrollbar
7568
},
69+
props: {
70+
navItems: {
71+
type: Array,
72+
required: true,
73+
default: () => []
74+
}
75+
},
7676
data () {
7777
return {}
7878
},

src/components/Sidebar/SidebarNavDivider.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: 'sidebar-nav-divider',
88
props: {
99
classes: {
10-
type: String,
10+
type: [String, Array, Object],
1111
default: ''
1212
}
1313
},
@@ -19,7 +19,8 @@ export default {
1919
]
2020
},
2121
itemClasses () {
22-
return this.classes ? this.classes.split(' ') : ''
22+
const classes = this.classes
23+
return !classes ? [] : typeof classes === 'string' || classes instanceof String ? classes.split(' ') : Array.isArray(classes) ? classes : Object.keys(classes).filter(i=>classes[i])
2324
}
2425
}
2526
}

src/components/Switch/Switch.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
:required="required"
88
:name="name"
99
:value="value"
10-
@change="handleChange"
1110
class="switch-input form-check-input"
1211
type="checkbox"
1312
true-value="value"
1413
false-value="uncheckedValue"
14+
@change="handleChange"
1515
>
1616
<template v-if="label">
1717
<span
@@ -32,11 +32,6 @@ export default {
3232
prop: 'modelChecked',
3333
event: 'change'
3434
},
35-
data: function () {
36-
return {
37-
checkedData: this.isChecked ? this.value : this.uncheckedValue
38-
}
39-
},
4035
props: {
4136
id: {
4237
type: String,
@@ -108,6 +103,11 @@ export default {
108103
default: 'Off'
109104
}
110105
},
106+
data: function () {
107+
return {
108+
checkedData: this.isChecked ? this.value : this.uncheckedValue
109+
}
110+
},
111111
computed: {
112112
classList () {
113113
return [
@@ -126,6 +126,9 @@ export default {
126126
return this.modelChecked === this.value
127127
}
128128
},
129+
mounted() {
130+
this.toggle(this.defaultChecked || this.checked || this.isChecked);
131+
},
129132
methods: {
130133
handleChange (event) {
131134
this.toggle(event.target.checked);
@@ -135,8 +138,5 @@ export default {
135138
this.$emit('change', this.checkedData);
136139
}
137140
},
138-
mounted() {
139-
this.toggle(this.defaultChecked || this.checked || this.isChecked);
140-
},
141141
}
142142
</script>

src/components/__tests__/__snapshots__/SidebarNavLabel.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ exports[`SidebarNavLabel.vue renders correctly 1`] = `
1212
class="fa fa-circle text-info "
1313
/>
1414
15+
1516
</a>
1617
</li>
1718
`;

0 commit comments

Comments
 (0)