54 lines
1.9 KiB
Vue
54 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import converter from 'ral-hex-converter'
|
|
const lamelles_count = useState('lamelles_count', () => 8)
|
|
const fence_section = useState<number>('fence_section', () => 2000 * 0.001)
|
|
const pillar_color = useState('pillar_color', () => 'gray')
|
|
const lamelle_color = useState('lamelle_color', () => 'violet')
|
|
|
|
const parametric = {
|
|
length: {
|
|
min: 100,
|
|
max: 2400,
|
|
step: 10,
|
|
},
|
|
height: {
|
|
min: 220,
|
|
max: 2400,
|
|
step: 115,
|
|
}
|
|
}
|
|
const form_state = reactive({
|
|
length: fence_section.value * 1000,
|
|
height: lamelles_count.value * parametric.height.step
|
|
})
|
|
const changeParametres = () => {
|
|
const lamelles = Math.floor(form_state.height / parametric.height.step)
|
|
lamelles_count.value = lamelles
|
|
fence_section.value = form_state.length * 0.001
|
|
}
|
|
const setLamelleColor = (color: string) => {
|
|
lamelle_color.value = color
|
|
}
|
|
watch(form_state, changeParametres, { deep: true })
|
|
</script>
|
|
<template>
|
|
<div class="container">
|
|
<form class="form">
|
|
<div class="form-item">
|
|
<label for="length">Длина секции, мм</label>
|
|
<input id="length" type="number" v-bind="parametric.length" v-model="form_state.length" />
|
|
</div>
|
|
<div class="form-item">
|
|
<label for="height">Высота забора, мм</label>
|
|
<input id="height" type="number" v-bind="parametric.height" v-model="form_state.height" />
|
|
</div>
|
|
<div class="colors flex flex-wrap">
|
|
<template v-for="color in converter.hex">
|
|
<div class="color size-5" :class="[{ 'outline outline-primary': color == lamelle_color }]"
|
|
:style="[{ backgroundColor: color }]" @click="setLamelleColor(color)">
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</template> |