working vue components for 1D automata

This commit is contained in:
2022-01-10 11:13:44 +01:00
parent 890018c0dc
commit 4f26becf9f
7 changed files with 123 additions and 123 deletions

View File

@ -4,31 +4,28 @@
<div class="form-field">
<label for="live">Living cell color</label>
<input
id="live"
name="live"
name="liveColor"
type="color"
:value="liveColor"
@click="updateCellProperties"
@value="cellProperties.liveColor"
@input="updateCellProperties"
>
</div>
<div class="form-field">
<label for="dead">Dead cell color</label>
<input
id="dead"
name="dead"
name="deadColor"
type="color"
:value="deadColor"
@click="updateCellProperties"
:value="cellProperties.deadColor"
@input="updateCellProperties"
>
</div>
<div class="form-field">
<label>Cell size</label>
<input
id="cellSize"
name="cellSize"
name="size"
type="number"
:value="size"
@click="updateCellProperties"
:value="cellProperties.size"
@input="updateCellProperties"
>
</div>
</form>
@ -44,15 +41,19 @@ export default {
},
data() {
return {
size : this.$store.state.cellProperties['size'],
liveColor : this.$store.state.cellProperties['liveColor'],
deadColor : this.$store.state.cellProperties['deadColor'],
cellProperties: this.$store.state.cellProperties
}
},
methods: {
getCellProperties(event) {
const elem = event.target
const prop = this.$store.state.cellProperties
return prop[elem.name]
},
updateCellProperties(event) {
const elem = event.target
const prop = {'name' : elem.name, 'value' : elem.value}
//console.log(prop)
this.$store.commit('setCellProperties', prop)
}
},