Skip to content

Commit 41dd44b

Browse files
author
Julia Bakerink
committed
Fixed TypeScript bug where state/toggle was being reset when dropdown was closed
1 parent 3db6606 commit 41dd44b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/layouts/MyLayout.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ Description:
6060
<SlackLoginWindow />
6161
<div class="typescript">
6262
<p> <b>TypeScript: </b> </p>
63-
<label for="typescript" class="switch">
64-
<input class="switch-input" type="checkbox" name="typescript" id="typescript" :value="exportAsTypescript" @change="syncTypescriptFlag" />
65-
<span class="switch-label" data-on="On" data-off="Off"></span>
66-
<span class="switch-handle"></span>
63+
<label for="typescript" class="switch" >
64+
<input v-if="this.exportAsTypescript === 'on'" class="switch-input" type="checkbox" name="typescript" id="typescript" :value="this.exportAsTypescript" @change="syncTypescriptFlag" checked/>
65+
<input v-else class="switch-input" type="checkbox" name="typescript" id="typescript" :value="this.exportAsTypescript" @change="syncTypescriptFlag"/>
66+
<span class="switch-label" :value="this.exportAsTypescript" data-on="on" data-off="off"></span>
67+
<span class="switch-handle" :value="this.exportAsTypescript"></span>
6768
</label>
6869
</div>
70+
6971
</div>
7072
<i id="btn"></i>
7173
</q-menu >
@@ -230,6 +232,8 @@ export default {
230232
// this.$emit("redo");
231233
// },
232234
syncTypescriptFlag(e) {
235+
console.log("Test")
236+
console.log(e.target.value)
233237
let checkboxValue;
234238
if (e.target.value === "off") {
235239
checkboxValue = "on";
@@ -240,6 +244,13 @@ export default {
240244
}
241245
},
242246
};
247+
248+
function check (a){
249+
if(a === true){
250+
return checked
251+
}
252+
return
253+
}
243254
</script>
244255

245256
<style lang="scss">

0 commit comments

Comments
 (0)