修改programs引用方式

This commit is contained in:
fofolee 2025-02-12 15:14:55 +08:00
parent 6e8a0c79e3
commit b4a14e2a9e
4 changed files with 18 additions and 8 deletions

View File

@ -171,7 +171,7 @@ export default {
let option =
command.program === "custom"
? command.customOptions
: this.$root.programs[command.program];
: programs[command.program];
option.scptarg = command.scptarg || "";
option.charset = command.charset || {};
option.envPath = this.$root.nativeProfile.envPath.trim() || "";

View File

@ -46,7 +46,7 @@
width="16px"
/>
<div>|</div>
<q-img :src="$root.programs[commandInfo.program].icon" width="16px" />
<q-img :src="programs[commandInfo.program].icon" width="16px" />
<div class="text-subtitle2">{{ programName }}</div>
</div>
</q-card-section>
@ -55,6 +55,7 @@
<script>
import CommandTypeTag from "../CommandTypeTag.vue";
import platformTypes from "js/options/platformTypes.js";
import programs from "js/options/programs.js";
export default {
name: "DenseLayout",
@ -69,11 +70,12 @@ export default {
data() {
return {
platformTypes,
programs,
};
},
computed: {
program() {
return this.$root.programs[this.commandInfo.program];
return this.programs[this.commandInfo.program];
},
programName() {
return this.program.shortName ?? this.program.name;

View File

@ -50,6 +50,7 @@
<script>
import CommandTypeTag from "../CommandTypeTag.vue";
import platformTypes from "js/options/platformTypes.js";
import programs from "js/options/programs.js";
export default {
name: "ListLayout",
@ -64,11 +65,12 @@ export default {
data() {
return {
platformTypes,
programs,
};
},
computed: {
program() {
return this.$root.programs[this.commandInfo.program];
return this.programs[this.commandInfo.program];
},
},
};

View File

@ -17,13 +17,13 @@
>
<template v-slot:append>
<q-avatar size="lg" square>
<img :src="$root.programs[modelValue.program].icon" />
<img :src="programs[modelValue.program].icon" />
</q-avatar>
</template>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>
<img width="32" :src="$root.programs[scope.opt].icon" />
<img width="32" :src="programs[scope.opt].icon" />
</q-item-section>
<q-item-section>
<q-item-label v-html="scope.opt" />
@ -162,6 +162,7 @@
</template>
<script>
import programs from "js/options/programs.js";
export default {
name: "CommandLanguageBar",
@ -190,9 +191,14 @@ export default {
"save",
"show-composer",
],
data() {
return {
programs,
};
},
computed: {
programLanguages() {
return Object.keys(this.$root.programs);
return Object.keys(this.programs);
},
},
methods: {
@ -235,7 +241,7 @@ export default {
},
matchLanguage() {
if (!this.modelValue.customOptions.ext) return;
let language = Object.values(this.$root.programs).filter(
let language = Object.values(this.programs).filter(
(program) => program.ext === this.modelValue.customOptions.ext
);
if (language.length) {