fixing vue state update

This commit is contained in:
sanjayk03-dev
2024-01-22 23:03:43 +05:30
parent e0a2767b00
commit 8ba566702a
2 changed files with 4 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ module.exports = {
return this.mach_state == "READY"; return this.mach_state == "READY";
}, },
updateNewGcode: function (event) { updateNewGcode: function (event) {
return this.newGcode[this.tab - 1] = event.target.value; this.newGcode[this.tab - 1] = event.target.value;
}, },
macrosList: function () { macrosList: function () {
return this.config.macrosList.map((el) => el.gcode_file_name); return this.config.macrosList.map((el) => el.gcode_file_name);
@@ -60,7 +60,8 @@ module.exports = {
if (text.length > 20e6) { if (text.length > 20e6) {
this.newGcode[this.tab - 1]="File is large - gcode view disabled"; this.newGcode[this.tab - 1]="File is large - gcode view disabled";
} else { } else {
this.newGcode[this.tab - 1]=text; // this.newGcode[this.tab - 1]=text;
Vue.set(this.newGcode,this.tab,text);
} }
} else { } else {
this.newGcode[this.tab - 1]=""; this.newGcode[this.tab - 1]="";

View File

@@ -76,8 +76,7 @@ script#macros-template(type="text/x-template")
br br
.gcodeContainer .gcodeContainer
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode") textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
//- gcode-viewer(v-if="state.selected !== 'default'") //- gcode-viewer(v-if="state.selected !== 'default'")
p.gcode-para {{newGcode[tab-1]}}
button.submit-macros(title="Save Macros",@click="confirmSave=true", button.submit-macros(title="Save Macros",@click="confirmSave=true",
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
button.submit-macros(title="Cancel Macros",@click="cancelMacros", button.submit-macros(title="Cancel Macros",@click="cancelMacros",