nuxtjs-phaser
Empower your Phaser game with Vue/Nuxt
1,559
11
| Install | |
|---|---|
npm install nuxtjs-phaser |
|
| Latest Version: | 3.0.17 |
| Vue: | 3 |
| Older releases: | 2 |
| License: | MIT |
| Last Updated: | May 20, 2025 |
| Links: | GitHub · npm |
Maintainer: williampsena
Nuxt Phaser
This plugin empowers your game using Vue/Nuxt.
Why Vue and Nuxt?
With Vue/Nuxt you can make web development simple and powerful, using these features:
- Build
- Tests
- Plugins (like Workbox, GTM, Adsense, ...)
Setup
- Add
nuxtjs-phaserdependency using yarn or npm to your project
npm install nuxtjs-phaser --save
yarn add nuxtjs-phaser
- Add
nuxtjs-phasertopluginssection ofnuxt.config.js
plugins: [
{ src: 'node_modules/nuxtjs-phaser', mode: 'client' }
],
Usage
Loading phaser manually
You can load phaser on your component, where and how you want:
const myGame = new Phaser.Game()
this.$phaser.initialize(myGame)
Loading phaser by component
You can load phaser using vue component:
import PhaserGame from 'nuxtjs-phaser/phaserGame.vue'
<div>
<PhaserGame :createGame="createGame" />
<div>
Phaser Events
Phaser uses has own Event Emitter, this plugin allows you to emit and listen to events between Vue (Nuxt) and Phaser.
// listen events
this.$phaser.eventEmitter.addListener('jump', ({ superJump = false }) => {
myPlayer.jump(superJump)
}, this)
// emit events with args
this.$phaser.eventEmitter.emit('jump', { superJump: false })
Built-in Events
- pause
Pause a scene.
// emit events with args
this.$phaser.eventEmitter.emit('pause', 'level')
- resume
Resume a scene.
// emit events with args
this.$phaser.eventEmitter.emit('resume', 'level')
- restart
Restart a scene.
// emit events with args
this.$phaser.eventEmitter.emit('restart', 'default')
Project sample
Check out this project sample.


Articles
Related Packages
nuxt-define
One utility function for module authors to define compiler constants for all bui...
13,412,511
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 3.0.17 | ^3.3.4 | MIT | |
| 3.0.16 | ^3.2.47 | MIT | |
| 3.0.15 | ^3.2.47 | MIT | |
| 3.0.14 | ^3.2.47 | MIT | |
| 3.0.13 | ^3.2.47 | MIT | |
| 3.0.12 | ^3.2.47 | MIT | |
| 3.0.11 | ^3.2.47 | MIT | |
| 3.0.10 | ^3.2.47 | MIT | |
| 3.0.9 | ^3.2.47 | MIT | |
| 3.0.8 | ^3.2.47 | MIT | |
| 3.0.6 | ^3.2.47 | MIT | |
| 3.0.5 | ^3.2.47 | MIT | |
| 3.0.4 | ^3.2.47 | MIT | |
| 3.0.3 | ^3.2.47 | MIT | |
| 3.0.2 | ^3.2.47 | MIT | |
| 3.0.1 | ^3.2.47 | MIT | |
| 3.0.0 | ^3.2.47 | MIT | |
| 1.0.17 | ^2.6.10 | MIT | |
| 1.0.16 | ^2.6.10 | MIT | |
| 1.0.15 | ^2.6.10 | MIT | |
| 1.0.14 | ^2.6.10 | MIT | |
| 1.0.13 | ^2.6.10 | MIT | |
| 1.0.12 | ^2.6.10 | MIT | |
| 1.0.11 | ^2.6.10 | MIT | |
| 1.0.10 | ^2.6.10 | MIT | |
| 1.0.7 | ^2.6.10 | MIT | |
| 1.0.6 | ^2.6.10 | MIT | |
| 1.0.4 | ^2.6.10 | MIT | |
| 1.0.3 | ^2.6.10 | MIT | |
| 1.0.2 | ^2.6.10 | MIT |
Showing the latest 30 of 32. See every release on npm
Pre-releases (2)
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.9-0 | ^2.6.10 | MIT | |
| 1.0.8-0 | ^2.6.10 | MIT |