Skip to content

Commit cbd0104

Browse files
committed
fixed vue ts stuff
1 parent f9fd157 commit cbd0104

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

src/components/nav-buttons/ExportMenu.vue

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ Description:
1818
</q-btn>
1919
</template>
2020

21-
<script lang="ts">
22-
import * as types from "types";
21+
<script>
2322
import { useExportComponent } from "../composables/useExportComponent.js";
2423
import { mapState } from "vuex";
25-
import { defineComponent } from "vue";
2624
const { fs, ipcRenderer } = window;
2725
2826
import writeNested from "../../mixins/writeNested";
2927
3028
31-
export default defineComponent({
29+
export default {
3230
name: "ExportProjectComponent",
3331
mixins: [writeNested],
3432
methods: {
@@ -42,11 +40,11 @@ export default defineComponent({
4240
message: "Choose location to save folder in",
4341
nameFieldLabel: "Application Name",
4442
})
45-
.then((result:any) => {
43+
.then((result) => {
4644
this.exportFile(result.filePath)
4745
alert('Successfully Exported')
4846
})
49-
.catch((err:string) => console.log(err));
47+
.catch((err) => console.log(err));
5048
},
5149
exportProject: function () {
5250
@@ -58,7 +56,7 @@ export default defineComponent({
5856
* invokes: createRouterImports(this.componentMap['App'].children),
5957
* createExport(this.componentMap['App'].children)
6058
* */
61-
createRouter(location:string) {
59+
createRouter(location) {
6260
if (this.exportAsTypescript === "on") {
6361
fs.writeFileSync(
6462
path.join(location, "src", "router", "index.ts"),
@@ -77,8 +75,8 @@ export default defineComponent({
7775
* @description import routed components from the /views/ dir
7876
* @argument: this.componentMap['App'].children
7977
*/
80-
createRouterImports(routes):string {
81-
let str:string = "import { createRouter, createWebHistory } from 'vue-router';\n";
78+
createRouterImports(routes) {
79+
let str = "import { createRouter, createWebHistory } from 'vue-router';\n";
8280
for(let view in routes) {
8381
str += `import ${view} from '../views/${view}.vue';\n`;
8482
}
@@ -87,8 +85,8 @@ export default defineComponent({
8785
/**
8886
* @description creates the `export default` code in <script>
8987
*/
90-
createExport(routes):string {
91-
let str:string = "export default createRouter({\n\thistory: createWebHistory(import.meta.env.BASE_URL),\n\troutes: [\n";
88+
createExport(routes) {
89+
let str = "export default createRouter({\n\thistory: createWebHistory(import.meta.env.BASE_URL),\n\troutes: [\n";
9290
for(let view in routes) {
9391
// HomeView route is initialized to "localhost:3000/" url
9492
if (view === "HomeView") {
@@ -107,7 +105,7 @@ export default defineComponent({
107105
* @description: creates component code <template>, <script>, <style>
108106
* invokes writeTemplate, writeScript, writeStyle
109107
*/
110-
createComponentCode(componentLocation, componentName, children, routes):void {
108+
createComponentCode(componentLocation, componentName, children, routes) {
111109
if (componentName === "App") {
112110
fs.writeFileSync(
113111
componentLocation + ".vue",
@@ -125,14 +123,14 @@ export default defineComponent({
125123
}
126124
},
127125
// creates assets folder
128-
createAssetFile(targetLocation:string, assetLocation):void {
126+
createAssetFile(targetLocation, assetLocation) {
129127
let saved = remote.nativeImage.createFromPath(assetLocation);
130128
let urlData = saved.toPNG();
131129
fs.writeFileSync(targetLocation + ".png", urlData);
132130
},
133-
writeTemplateTag(componentName:string):string {
131+
writeTemplateTag(componentName) {
134132
// create reference object - replace later
135-
const htmlElementMap:types.HtmlElementMap = {
133+
const htmlElementMap = {
136134
div: ["<div", "</div>"],
137135
button: ["<button", "</button>"],
138136
form: ["<form", "</form>"],
@@ -270,7 +268,7 @@ export default defineComponent({
270268
/**
271269
* @description imports child components into <script>
272270
*/
273-
writeScript(componentName: string, children) {
271+
writeScript(componentName, children) {
274272
// add import mapstate and mapactions if they exist
275273
const currentComponent = this.componentMap[componentName];
276274
const routes = Object.keys(this.routes);
@@ -401,7 +399,7 @@ export default defineComponent({
401399
*/
402400
/* UPDATE THIS TO GRAB INFORMATION FROM this.componentMap NOT this.routes*/
403401
/* this.componentMap does not have x-y positioning stored */
404-
writeStyle(componentName:string) {
402+
writeStyle(componentName) {
405403
let htmlArray = this.componentMap[componentName].htmlList;
406404
let styleString = "";
407405
console.log(componentName);
@@ -512,7 +510,7 @@ export default defineComponent({
512510
}
513511
},
514512
createESLintRC(location) {
515-
let str:string;
513+
let str;
516514
if (this.exportAsTypescript === "on") {
517515
str += `require("@rushstack/eslint-patch/modern-module-resolution");\n\n`;
518516
}
@@ -550,14 +548,14 @@ export default defineComponent({
550548
},
551549
createTSDeclaration(location) {
552550
if (this.exportAsTypescript === "on") {
553-
let str:string = `/// <reference types="vite/client" />`;
551+
let str = `/// <reference types="vite/client" />`;
554552
fs.writeFileSync(path.join(location, "env.d.ts"), str);
555553
} else {
556554
return;
557555
}
558556
},
559557
createStore(location) {
560-
let str:string = `import { createStore } from 'vuex';\n`;
558+
let str = `import { createStore } from 'vuex';\n`;
561559
str += `\nconst store = createStore({`;
562560
str += `\n\tstate () {`;
563561
str += `\n\t\treturn {`;
@@ -602,7 +600,7 @@ export default defineComponent({
602600
},
603601
// create package.json file
604602
createPackage(location) {
605-
let str:string = `{`;
603+
let str = `{`;
606604
str += `\n\t"name": "My-OverVue-Project",`;
607605
str += `\n\t"version": "0.0.0",`;
608606
str += `\n\t"scripts": {`;
@@ -717,7 +715,7 @@ export default defineComponent({
717715
"containerH"
718716
]),
719717
},
720-
});
718+
};
721719
</script>
722720
723721
<style scoped>

src/components/nav-buttons/ImportMenu.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ Description:
1717
</q-btn>
1818
</template>
1919

20-
<script lang="ts">
20+
<script>
2121
import { mapActions } from "vuex";
2222
import ImportComponent from "../left-sidebar/ComponentTab/ImportComponent.vue"
2323
const Mousetrap = require("mousetrap");
2424
const { fs, ipcRenderer } = window;
25-
import { defineComponent } from "vue";
2625
27-
export default defineComponent({
26+
export default {
2827
name: "ImportMenu",
2928
components: {
3029
ImportComponent
3130
},
3231
methods: {
3332
...mapActions(["openProject"]),
3433
// opens project
35-
openJSONFile(data:string) {
34+
openJSONFile(data) {
3635
if (data === undefined) return;
3736
const jsonFile = JSON.parse(fs.readFileSync(data[0], "utf8"));
3837
this.openProject(jsonFile);
@@ -48,8 +47,8 @@ export default defineComponent({
4847
},
4948
],
5049
})
51-
.then((res:any) => this.openJSONFile(res.filePaths))
52-
.catch((err:string) => console.log(err));
50+
.then((res) => this.openJSONFile(res.filePaths))
51+
.catch((err) => console.log(err));
5352
},
5453
5554
openProjectJSON() {
@@ -62,7 +61,7 @@ export default defineComponent({
6261
this.openProjectJSON();
6362
});
6463
},
65-
});
64+
};
6665
</script>
6766

6867
<style scoped>

src/layouts/MyLayout.vue

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Description:
138138
</q-layout>
139139
</template>
140140

141-
<script lang="ts">
141+
<script>
142142
// HomeSideDropDown contains RouteDisplay, VuexForm and Edit but we'll be separating these components across different tabs
143143
import RightSidebar from "../components/right-sidebar/RightSidebar.vue";
144144
import ExportMenu from "../components/nav-buttons/ExportMenu.vue";
@@ -149,19 +149,18 @@ import SlackLoginWindow from "../components/slack_login/SlackLoginWindow.vue";
149149
import ComponentTab from "../components/left-sidebar/ComponentTab/ComponentTab.vue";
150150
import StoreTab from "../components/left-sidebar/StoreTab/StoreTab.vue";
151151
import { mapState, mapActions } from "vuex";
152-
import { defineComponent } from "vue";
153152
154-
export default defineComponent({
153+
export default {
155154
// Passed down from App.vue
156155
props: ["doneAction", "undoneAction", "undoTrigger", "redoTrigger"],
157156
data() {
158157
return {
159-
tab: "component" as string,
160-
left: true as boolean,
161-
right: true as boolean,
162-
dashWidth: 950 as number,
163-
originalWidth: 400 as number,
164-
originalLeft: 400 as number,
158+
tab: "component",
159+
left: true,
160+
right: true,
161+
dashWidth: 950,
162+
originalWidth: 400,
163+
originalLeft: 400,
165164
timer: null,
166165
};
167166
},
@@ -237,7 +236,7 @@ export default defineComponent({
237236
this.$emit('redo')
238237
}
239238
},
240-
});
239+
};
241240
242241
</script>
243242

0 commit comments

Comments
 (0)