canvas-confetti
canvas-confetti copied to clipboard
canvas.getContext is not a function
When creating a canvas as :
var canvas = this.$refs.notifyContainer canvas.confetti = confetti.create(canvas, { resize: true })
canvas.confetti({ spread: 70, origin: { y: 1.2 } });
console shows error : "TypeError: canvas.getContext is not a function"
I am using vue, and $refs is a way to reach in to dom, effetely its the same as getElementbyId
without canvas , the confetti appears to display as normal in the middle of the screen.
What i need is for the confetti to be displayed within the dev, just like your canvas demo.
Try canvas = confetti.create(canvas, { resize: true })
instead
I am not familiar with vue. Do you have a reduced reproduction case for this issue? getContext
is a standard method on the canvas, so I would expect that the value you are passing in as canvas
is in fact not an actual canvas.
Closing this bug due to inactivity. If this is still an issue, please let me know and we can reopen this bug or create a new one.