frequi_origin/src/components/ftbot/StrategySelect.vue

53 lines
1.3 KiB
Vue
Raw Normal View History

2020-07-31 05:17:50 +00:00
<template>
2021-01-19 20:48:17 +00:00
<div>
2021-01-19 20:51:34 +00:00
<div class="w-100 d-flex">
2022-04-19 05:05:34 +00:00
<b-form-select
id="strategy-select"
v-model="locStrategy"
:options="botStore.activeBot.strategyList"
>
2021-05-24 09:34:48 +00:00
</b-form-select>
<div class="ms-2">
<b-button @click="botStore.activeBot.getStrategyList">
<i-mdi-refresh />
</b-button>
2021-01-19 20:51:34 +00:00
</div>
</div>
2022-04-19 05:05:34 +00:00
<textarea
v-if="showDetails && botStore.activeBot.strategy"
v-model="strategyCode"
class="w-100 h-100"
></textarea>
2021-01-19 20:48:17 +00:00
</div>
2020-07-31 05:17:50 +00:00
</template>
2022-12-10 12:39:06 +00:00
<script setup lang="ts">
2022-04-19 05:05:34 +00:00
import { useBotStore } from '@/stores/ftbotwrapper';
2022-12-10 12:39:06 +00:00
import { computed, onMounted } from 'vue';
2022-04-16 12:38:33 +00:00
2022-12-10 12:39:06 +00:00
const props = defineProps({
modelValue: { type: String, required: true },
showDetails: { default: false, required: false, type: Boolean },
});
const emit = defineEmits(['update:modelValue']);
const botStore = useBotStore();
2022-04-16 12:38:33 +00:00
2022-12-10 12:39:06 +00:00
const strategyCode = computed((): string => botStore.activeBot.strategy?.code);
const locStrategy = computed({
get() {
return props.modelValue;
2022-04-16 12:38:33 +00:00
},
2022-12-10 12:39:06 +00:00
set(strategy: string) {
botStore.activeBot.getStrategy(strategy);
emit('update:modelValue', strategy);
},
});
onMounted(() => {
if (botStore.activeBot.strategyList.length === 0) {
botStore.activeBot.getStrategyList();
}
2022-04-16 12:38:33 +00:00
});
2020-07-31 05:17:50 +00:00
</script>