Skip to content

Instantly share code, notes, and snippets.

@daikiojm
Created April 29, 2021 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daikiojm/6479c82859bd8ce4971ba11469203c51 to your computer and use it in GitHub Desktop.
Save daikiojm/6479c82859bd8ce4971ba11469203c51 to your computer and use it in GitHub Desktop.
party.js with vue sfc component
<template>
<div class="container">
<button
ref="buttonRef"
href="#"
class="button--green"
@click.prevent="handleClick"
>
party
</button>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from '@nuxtjs/composition-api'
import * as party from 'party-js'
export default defineComponent({
setup() {
const buttonRef = ref<HTMLButtonElement>()
const handleClick = () => {
party.confetti(buttonRef.value!)
}
return {
handleClick,
buttonRef,
}
},
})
</script>
<style>
.container {
margin: 0 auto;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment