Skip to content

Instantly share code, notes, and snippets.

@vitogit
Created March 24, 2019 16:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save vitogit/0f941c81ab3b1e728195948e545238b2 to your computer and use it in GitHub Desktop.
<template>
<div id="app">
<h1>Simple Chessboard with legal moves</h1>
<chessboard ref="cb"/>
</div>
</template>
<script>
import {chessboard} from 'vue-chessboard'
import 'vue-chessboard/dist/vue-chessboard.css'
export default {
name: 'app',
components: {
chessboard
},
mounted() {
let ref_cb = this.$refs.cb
ref_cb.game.move('e4')
ref_cb.board.set({
fen: ref_cb.game.fen(),
turnColor: ref_cb.toColor(),
movable: {
color: ref_cb.toColor(),
dests: ref_cb.possibleMoves(),
},
})
ref_cb.afterMove()
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment