gctGenerator/site/.vuepress/components/codes/AttemptCounter/config.vue
sup39 d75bdaa3ff Add 'Attempt Counter', Instant Level Select 0.2
Merge preview related config to codes/preview.js
2023-02-05 23:32:35 +09:00

76 lines
1.6 KiB
Vue

<template>
<div>
<section class="appearance">
<h3>{{ l('h3.appearance') }}</h3>
<TextConfig v-model="textConfig" />
<div>
<span>{{ l('display.duration') }}</span><input type="number" min="0" max="255" v-model="duration" />
{{ l('display.frame') }} = {{ ((duration * 1001) / 30000).toFixed(2) }} {{ l('display.sec') }}
</div>
</section>
</div>
</template>
<script>
import { defaultConfig, lskey, getConfig, getPreviewText } from './codegen.js';
import { makeUpdateConfig, makeGetLabel } from '../utils';
import labels from '../labels.json';
import TextConfig from '../TextConfig.vue';
const updateConfig = makeUpdateConfig(lskey, defaultConfig, getPreviewText);
export default {
components: {
TextConfig,
},
props: {
version: { type: String },
},
methods: {
updateConfig,
},
data() {
const config = getConfig();
return {...config};
},
computed: {
l() {
return makeGetLabel(labels, this.$lang);
},
textConfig: {
get() {
return this;
},
set(value) {
Object.assign(this, value);
this.updateConfig();
},
},
},
watch: {
duration: updateConfig,
},
};
</script>
<style scoped>
input[type='number'],
td.right {
text-align: right;
}
input[type='number'] {
width: 3em;
margin: 0 2px;
}
.appearance > div {
padding: 0 0 4px;
}
input[type='number'] {
-moz-appearance: textfield;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>