adapted components to pinia

This commit is contained in:
Gator
2022-12-02 17:10:21 +01:00
parent f318350149
commit 3a2cbc9349
8 changed files with 310 additions and 324 deletions

View File

@ -63,20 +63,20 @@
</div>
</form>
<div class="form-field">
<input type="button" name="start" value="start" @click="draw1d" />
<input type="button" name="start" value="start" @click="toggleDraw1d()" />
<input
type="button"
name="reset"
class="reset"
value="reset"
@click="reset"
@click="toggleReset"
/>
</div>
</MenuRow>
</template>
<script>
import { mapActions, mapState, mapWritableState } from 'pinia'
import { mapActions, mapWritableState } from 'pinia'
import { presetRules, initialStates } from "./preset.js"
import { globalStore } from "../stores/index.js";
import MenuRow from "./MenuRow.vue";
@ -95,14 +95,11 @@
...mapWritableState(
globalStore, {
initialState: "initial1dState",
}
),
...mapState(
globalStore, {
rules: "rules1d"
}
),
rules1dFileName() {
// TODO: broken
return (
Object.keys(this.rules)
.map((index) => {
@ -113,7 +110,7 @@
},
},
methods: {
...mapActions(globalStore, ["draw1d", "reset"]),
...mapActions(globalStore, ["toggleDraw1d", "toggleReset"]),
copyRules() {
const rules = JSON.stringify(this.rules);
navigator.clipboard.writeText(rules);