Created
April 2, 2018 15:45
-
-
Save stephane303/a6f52a0ea31728eef2dc882886e1b4e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div :id="id" style="float:left;margin:20px;"> | |
</div> | |
</template> | |
<script> | |
import Phaser from 'phaser' | |
export default { | |
name: 'HelloWorld', | |
data () { | |
return { | |
msg: 'Welcome to Your Vue.js App', | |
id: null, | |
game: null | |
} | |
}, | |
destroyed () { | |
console.log('id:' + this.game.canvas.parentNode.id) | |
this.game.canvas.parentNode.removeChild(this.game.canvas) | |
this.game.destroy() | |
}, | |
beforeMount () { | |
this.id = 'game' + this._uid | |
}, | |
mounted () { | |
var config = { | |
parent: this.id, | |
type: Phaser.CANVAS, | |
audio: {noAudio: true}, | |
width: 200, | |
height: 200, | |
scene: { | |
preload: preload, | |
create: create | |
} | |
} | |
this.game = new Phaser.Game(config) | |
function preload () { | |
} | |
function create () { | |
console.log(this) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment