# Custom Components/Templates in Nuxt App

**URL:** <https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736>\
**Category:** CMS\
**Created:** [July 2, 2021, 2:21pm UTC](https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736 "2021-07-02T14:21:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![somecallmejosh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/somecallmejosh/32/492_2.png) [@somecallmejosh](https://forum.builder.io/u/somecallmejosh)\
**Post date:** [July 2, 2021, 2:21pm UTC](https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736/1 "2021-07-02T14:21:00Z")

</div>

Hello, I am looking to use Builder within a Nuxt/Vue App. I am able to connect to my models, capture & display model data, etc. My templates/symbols are displaying as expected. I am using Segment for page load and click event data capturing on other “static” pages within my site. I am trying to figure out if it is possible to pass click event data from [Builder.io](http://Builder.io) to my Nuxt application.

```auto
<template>
  <div class="bg-lt-grey-25">
    <div class="container mx-auto bg-white shadow-lg">
      <div v-if="notFound">
        <!-- Show your 404 content -->
        Page not found
      </div>
      <div v-else>
        <RenderContent
          :key="$route.path"
          model="landing-page"
          @contentLoaded="contentLoaded"
          @contentError="contentError"
          :options="{
            url: $route.path,
          }"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { builder, RenderContent } from '@builder.io/vue'
import Vue from 'vue'

// TODO: enter your public API key
builder.init(process.env.BUILDER_API_KEY)

export default Vue.extend({
  data: () => ({
    notFound: false,
    meta: {},
  }),
  components: { RenderContent },
  methods: {
    contentLoaded(content) {
      if (!content) {
        if (this.$nuxt.context.ssrContext) {
          this.$nuxt.context.ssrContext.res.statusCode = 404
        }
        this.notFound = true
      }
      this.meta = {
        metaCanonicalUrL: content.data.metaCanonicalUrL,
        metaDescription: content.data.metaDescription,
        metaNoindex: content.data.metaNoindex,
        metaPageTitle: content.data.metaPageTitle,
      }
    },
    contentError(err) {
      // Handle error
    },
    // IS THIS POSSIBLE?
    buttoClick() {
      alert('a button from Bilder.io was clicked in builder.')
    },
  },
  head() {
    return {
      title: this.meta.metaPageTitle,
      link: [{ rel: 'canonical', href: this.meta.metaCanonicalUrL }],
      meta: [
        {
          hid: 'robots',
          name: 'robots',
          content: this.meta.metaNoindex === 'true' ? 'noindex' : '',
        },
        {
          hid: 'og:url',
          property: 'og:url',
          content: this.meta.metaCanonicalUrL,
        },
        {
          hid: 'og:title',
          property: 'og:title',
          content: this.meta.metaPageTitle,
        },
        {
          hid: 'description',
          name: 'description',
          content: this.meta.metaDescription,
        },
        {
          hid: 'og:description',
          name: 'og:description',
          content: this.meta.metaDescription,
        },
      ],
    }
  },
})
</script>

```

Regarding my `buttonClick()` method above… what’s the best practice in a Nuxt/Vue environment for dealing with click events in a [Builder.io](http://Builder.io) template or symbol? I appreciate any help or advice. Thank you.

---

<div class="post-metadata">

**Author:** ![maddy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/maddy/32/11_2.png) [@maddy](https://forum.builder.io/u/maddy)\
**Post date:** [July 7, 2021, 4:12pm UTC](https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736/2 "2021-07-07T16:12:48Z")

</div>

Hi @somecallmejosh 👋 Thanks for reaching out!

To pass click event data in Builder you can use data bindings (in the data tab in the editor).

---

<div class="post-metadata">

**Author:** ![somecallmejosh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/somecallmejosh/32/492_2.png) [@somecallmejosh](https://forum.builder.io/u/somecallmejosh)\
**Post date:** [July 9, 2021, 7:25pm UTC](https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736/3 "2021-07-09T19:25:23Z")

</div>

Hi @maddy, thanks for your reply. Can that be passed down as a prop in the `<RenderContent>` component? I’m trying to figure out how to communicate this click to my Nuxt app? Am I thinking of this the wrong way, perhaps?

---

<div class="post-metadata">

**Author:** ![markpinero](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@markpinero](https://forum.builder.io/u/markpinero)\
**Post date:** [July 19, 2021, 7:02pm UTC](https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736/4 "2021-07-19T19:02:29Z")

</div>

@somecallmejosh you can try using an event handler with capture mode:

```auto
<RenderContent ... @click.capture="onClick" />

```

```auto
  methods: {
    ...,
    onClick(event) {
      if (event.target.tagName === "A") {
        // DO THIS
      }
    }
  }

```

---

<div class="post-metadata">

**Author:** ![somecallmejosh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/somecallmejosh/32/492_2.png) [@somecallmejosh](https://forum.builder.io/u/somecallmejosh)\
**Post date:** [July 21, 2021, 5:24pm UTC](https://forum.builder.io/t/custom-components-templates-in-nuxt-app/736/5 "2021-07-21T17:24:53Z")

</div>

Hi @markpinero - Thanks for the lead. I gave this a try, and binding the click handler to the `<RenderContent>` component doesn’t seem to work. But, placing it on a parent wrapper seems to do the trick.

```auto
<div @click="onClick">
  <RenderContent ... />
</div>

```

I’ll take it. 🙂
