Skip to content

Commit c857312

Browse files
author
Julia Bakerink
committed
Added export typescript functionality to both EditDeleteComponent and ComponentDisplay. Need to add defineComponent to mixin file
1 parent bf461ef commit c857312

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

src/components/ComponentDisplay.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export default {
158158
"componentChildrenMultiselectValue",
159159
"imagePath",
160160
"activeComponentObj",
161+
"exportAsTypescript",
161162
]),
162163
// used in VueDraggableResizeable component
163164
activeRouteArray() {

src/components/ExportComponentMixin.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,14 @@ export default {
161161
methods += " },\n";
162162
}
163163
// concat all code within script tags
164-
let output = "\n\n<script>\n";
164+
// if exportAsTypescript is on, out should be <script lang="ts">
165+
console.log("export as typescript:", this.exportAsTypescript);
166+
let output;
167+
if (this.exportAsTypescript === 'on') {
168+
output = "\n\n<script lang='ts'>\n";
169+
} else {
170+
output = "\n\n<script>\n";
171+
}
165172
output += imports + "\nexport default {\n name: '" + componentName + "'";
166173
output += ",\n components: {\n";
167174
output += childrenComponentNames + " },\n";
@@ -170,6 +177,7 @@ export default {
170177
output += methods;
171178
// eslint-disable-next-line no-useless-escape
172179
output += "};\n<\/script>";
180+
console.log('output', output);
173181
return output;
174182
},
175183
/**

src/components/home_sidebar_items/ComponentTab/EditDeleteComponents.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export default {
186186
"activeComponent",
187187
"activeComponentObj",
188188
"componentMap",
189+
"exportAsTypescript",
189190
]),
190191
191192
activeRouteDisplay() {

tsTestProps/Test.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div>
3+
</div>
4+
</template>
5+
6+
<script lang='ts'>
7+
import { mapState, mapActions } from "vuex";
8+
// need to add import defineComponent
9+
import { defineComponent } from "vue";
10+
11+
export default defineComponent({
12+
name: 'TestContainer',
13+
components: {
14+
},
15+
data () {
16+
return {
17+
testProp: "PLACEHOLDER FOR VALUE",
18+
}
19+
},
20+
computed: {
21+
...mapState([
22+
"testState",
23+
]),
24+
},
25+
methods: {
26+
...mapActions([
27+
"testAction",
28+
]),
29+
},
30+
});
31+
</script>
32+
33+
<style scoped>
34+
</style>

tstest/Test.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div>
3+
</div>
4+
</template>
5+
6+
<script lang='ts'>
7+
import Child from '@/components/Child.vue';
8+
9+
export default {
10+
name: 'Test',
11+
components: {
12+
Child,
13+
},
14+
};
15+
</script>
16+
17+
<style scoped>
18+
</style>

0 commit comments

Comments
 (0)