Fix prep command adding order in apps

This commit is contained in:
Yukino Song
2025-02-06 19:41:40 +08:00
parent 9f33b3f726
commit 7757e28c28
+4 -4
View File
@@ -171,7 +171,7 @@
<label for="appName" class="form-label">{{ $t('apps.cmd_prep_name') }}</label> <label for="appName" class="form-label">{{ $t('apps.cmd_prep_name') }}</label>
<div class="form-text">{{ $t('apps.cmd_prep_desc') }}</div> <div class="form-text">{{ $t('apps.cmd_prep_desc') }}</div>
<div class="d-flex justify-content-start mb-3 mt-3" v-if="editForm['prep-cmd'].length === 0"> <div class="d-flex justify-content-start mb-3 mt-3" v-if="editForm['prep-cmd'].length === 0">
<button class="btn btn-success" @click="addPrepCmd"> <button class="btn btn-success" @click="addPrepCmd(-1)">
<i class="fas fa-plus mr-1"></i> {{ $t('apps.add_cmds') }} <i class="fas fa-plus mr-1"></i> {{ $t('apps.add_cmds') }}
</button> </button>
</div> </div>
@@ -205,7 +205,7 @@
<button class="btn btn-danger" @click="editForm['prep-cmd'].splice(i,1)"> <button class="btn btn-danger" @click="editForm['prep-cmd'].splice(i,1)">
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</button> </button>
<button class="btn btn-success" @click="addPrepCmd"> <button class="btn btn-success" @click="addPrepCmd(i)">
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
</button> </button>
</td> </td>
@@ -510,7 +510,7 @@
}); });
} }
}, },
addPrepCmd() { addPrepCmd(idx) {
const template = { const template = {
do: "", do: "",
undo: "" undo: ""
@@ -520,7 +520,7 @@
template.elevated = false; template.elevated = false;
} }
this.editForm["prep-cmd"].push(template); this.editForm["prep-cmd"].splice(idx + 1, 0, template);
}, },
showCoverFinder($event) { showCoverFinder($event) {
this.coverCandidates = []; this.coverCandidates = [];