Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Vue3 #89

Open
nigelPam opened this issue Feb 16, 2023 · 1 comment
Open

Using Vue3 #89

nigelPam opened this issue Feb 16, 2023 · 1 comment

Comments

@nigelPam
Copy link

Not an issue, but this may help somebody.

I was having some problems using Vue3 with pixi layer, but have overcome them, so anybody else using Vue may be interested.

The pure Javascript demos have a document.addEventListener("DOMContentLoaded", event handler, so pixis are drawn after loading.

With Vue, I had two methods. One to draw the basic map, and load textures, and another to draw the pixels.

Then, after drawing the map, I used nexttick to draw the pixels.

nexttick is a very useful Vue function which waits until the next time the DOM is loaded. It replaces the DOMContentLoaded event.

@nigelPam
Copy link
Author

More advice. Make the Vue very 'light'. Use javascript variables rather than Vue properties, for example do not have a Vue property for the map, using a plain Javascript variable.

I tore my hair out for several days until I moved some properties to Javascript variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant