Skip to content

Commit 38df0bf

Browse files
committed
minor cleaning
1 parent 5b6818c commit 38df0bf

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/components/dashboard_items/CodeSnippet.vue

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ export default {
4141
computed: {
4242
// needs access to current component aka activeComponent
4343
...mapState(['componentMap', 'activeComponent', 'activeComponentObj']),
44-
activeObj (){
45-
return this.activeComponentObj
46-
}
4744
},
4845
methods: {
4946
getWindowHeight (e) {
@@ -140,12 +137,12 @@ export default {
140137
141138
// add import mapstate and mapactions if they exist
142139
let imports = ''
143-
if (this.activeObj.actions.length || this.activeObj.state.length){
140+
if (this.activeComponentObj.actions.length || this.activeComponentObj.state.length){
144141
imports += 'import { '
145-
if (this.activeObj.actions.length && this.activeObj.state.length) {
142+
if (this.activeComponentObj.actions.length && this.activeComponentObj.state.length) {
146143
imports += 'mapState, mapActions'
147144
}
148-
else if (this.activeObj.state.length) imports += 'mapState'
145+
else if (this.activeComponentObj.state.length) imports += 'mapState'
149146
else imports += 'mapActions'
150147
imports += ' } from "vuex"\n'
151148
}
@@ -163,9 +160,9 @@ export default {
163160
164161
// if true add data section and populate with props
165162
let data = ''
166-
if (this.activeObj.props.length){
163+
if (this.activeComponentObj.props.length){
167164
data += ' data () {\n return {'
168-
this.activeObj.props.forEach(prop => {
165+
this.activeComponentObj.props.forEach(prop => {
169166
data += `\n ${prop}: "PLACEHOLDER FOR VALUE",`
170167
})
171168
data += '\n'
@@ -175,10 +172,10 @@ export default {
175172
176173
// if true add computed section and populate with state
177174
let computed = ''
178-
if (this.activeObj.state.length){
175+
if (this.activeComponentObj.state.length){
179176
computed += ' computed: {'
180177
computed += '\n ...mapState(['
181-
this.activeObj.state.forEach((state) =>{
178+
this.activeComponentObj.state.forEach((state) =>{
182179
computed += `\n "${state}",`
183180
})
184181
computed += '\n ]),\n'
@@ -187,10 +184,10 @@ export default {
187184
188185
// if true add methods section and populate with actions
189186
let methods = ''
190-
if (this.activeObj.actions.length){
187+
if (this.activeComponentObj.actions.length){
191188
methods += ' methods: {'
192189
methods += '\n ...mapActions(['
193-
this.activeObj.actions.forEach((action) => {
190+
this.activeComponentObj.actions.forEach((action) => {
194191
methods += `\n "${action}",`
195192
})
196193
methods += '\n ]),\n'

0 commit comments

Comments
 (0)