gctGenerator/site/.vuepress/components/codes/qft/config.vue

101 lines
2.2 KiB
Vue
Raw Normal View History

2022-04-08 16:29:24 +09:00
<template>
<div id="config">
2022-12-17 08:54:58 +09:00
<section class="appearance">
<h3>{{ l.h3 }}</h3>
<TextConfig v-model="textConfig" />
2022-04-08 16:29:24 +09:00
</section>
<section class="freeze">
2022-12-17 08:54:58 +09:00
<h3>{{ l.freeze.h3 }}</h3>
2022-04-22 19:23:15 +09:00
<div>
2022-12-17 08:54:58 +09:00
{{ l.freeze.duration }}<input type="number" min="0" max="32767" v-model="freezeDuration" />
{{ l.freeze.frame }} = {{ ((freezeDuration * 1001) / 30000).toFixed(2) }} {{ l.freeze.sec }}
2022-04-22 19:23:15 +09:00
</div>
2022-04-08 16:29:24 +09:00
<table>
<tbody>
<tr v-for="key in freezeKeys" :key="key">
2022-12-17 08:54:58 +09:00
<td>{{ l.freeze.rows[key] }}</td>
<td>
<input type="checkbox" :checked="freeze[key]" @change="onChangeFreeze($event, key)" />
</td>
2022-04-08 16:29:24 +09:00
</tr>
</tbody>
</table>
</section>
</div>
</template>
<script>
import { defaultConfig, lskey, getConfig, getPreviewText, codes, statusKeys } from './codegen.js';
2023-02-01 02:49:55 +09:00
import { makeUpdateConfig } from '../utils';
2022-04-08 16:29:24 +09:00
import labels from './labels.json';
import TextConfig from '../TextConfig.vue';
2022-04-08 16:29:24 +09:00
const updateConfig = makeUpdateConfig(lskey, defaultConfig, getPreviewText);
2022-04-08 16:29:24 +09:00
export default {
components: {
TextConfig,
},
2022-04-08 16:29:24 +09:00
props: {
2022-12-17 08:54:58 +09:00
version: { type: String },
2022-04-08 16:29:24 +09:00
},
methods: {
onChangeFreeze($event, key) {
2022-04-22 19:23:15 +09:00
this.freeze[key] = $event.target.checked;
2022-04-08 16:29:24 +09:00
this.updateConfig();
},
updateConfig,
2022-04-08 16:29:24 +09:00
},
data() {
const config = getConfig();
2022-04-08 16:29:24 +09:00
return {
...config,
2022-04-08 16:29:24 +09:00
// const
freezeKeys: [
...Object.keys(codes[this.version]?.freezeCodeHooks ?? {}),
...statusKeys,
],
2022-04-08 16:29:24 +09:00
};
},
computed: {
l() {
return labels[this.$lang] ?? labels['en-US'];
},
textConfig: {
get() {
return this;
},
set(value) {
Object.assign(this, value);
this.updateConfig();
},
},
2022-04-08 16:29:24 +09:00
},
watch: {
2022-04-22 19:23:15 +09:00
freezeDuration: updateConfig,
2022-04-08 16:29:24 +09:00
},
2022-12-17 08:54:58 +09:00
};
2022-04-08 16:29:24 +09:00
</script>
<style scoped>
2022-12-17 08:54:58 +09:00
input[type='number'],
td.right {
2022-04-08 16:29:24 +09:00
text-align: right;
}
2022-12-17 08:54:58 +09:00
input[type='number'] {
2022-04-08 16:29:24 +09:00
width: 3em;
margin: 0 2px;
}
.appearance > div {
padding: 0 0 4px;
}
2022-12-17 08:54:58 +09:00
input[type='number'] {
2022-04-08 16:29:24 +09:00
-moz-appearance: textfield;
}
2022-12-17 08:54:58 +09:00
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
2022-04-08 16:29:24 +09:00
-webkit-appearance: none;
margin: 0;
}
</style>