Skip to content

Instantly share code, notes, and snippets.

@NAKKA-K
Created December 24, 2019 22:07
Show Gist options
  • Save NAKKA-K/95fd8f6579f09d3d636ca2a876cb12d2 to your computer and use it in GitHub Desktop.
Save NAKKA-K/95fd8f6579f09d3d636ca2a876cb12d2 to your computer and use it in GitHub Desktop.
Nuxtでnuxt-linkの中に別の操作をするボタンを配置した時にうまく動作させる方法
<template>
<v-btn @click="(e) => $emit('click', e)">
<slot></slot>
</btn>
</template>
<template>
<nuxt-link to="/another">
<p>別ページに遷移する</p>
<primary-btn @click.prevent="() => alert('click button')">
アラートを出す
</btn>
</nuxt-link>
</template>
<script>
import PrimaryBtn from '~/components/atoms/PrimaryBtn.vue'
export default {
components: {
PrimaryBtn
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment