Skip to content

Instantly share code, notes, and snippets.

@Fl0pZz

Fl0pZz/Field.vue Secret

Last active February 3, 2017 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fl0pZz/20cb64e309d03cc0c083ea2b6f46053e to your computer and use it in GitHub Desktop.
Save Fl0pZz/20cb64e309d03cc0c083ea2b6f46053e to your computer and use it in GitHub Desktop.
<template src='./index.html' />
<script src="./index.js" lang="babel"></script>
<div @keyup.up="goUp" @keyup.down="goDown" @keyup.left="goLeft" @keyup.right="goRight">
<template v-for="n in size">
<cell v-for="m in size" :value="abc" :isActive="false"></cell>
</template>
</div>
import { mapActions, mapState } from 'vuex'
import * as types from 'store/mutation-types'
import store from 'store/store'
import Cell from './cell/Cell'
const FIELD_SIZE = 4
export default {
name: 'field',
components: { Cell },
data: () => ({
size: FIELD_SIZE
}),
beforeCreate() {
store.commit(types.INIT_STATE, FIELD_SIZE)
},
computed: {
...mapState([
'field'
])
},
methods: {
...mapActions([
'goUp',
'goDown',
'goLeft',
'goRight'
])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment