question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extending the VBtn component

See original GitHub issue

Steps to reproduce

  • I used the NUXT template (vuetifyjs/nuxt) for project, without modifications;
  • Extended VBtn component;
./components/MyBtn.vue
<script>
import VBtn from '../node_modules/vuetify/src/components/VBtn/VBtn'

export default {
  name: 'my-btn',
  extends: VBtn,
  methods: {
    genContent () {
      return this.$createElement(
        'div',
        { 'class': 'my-class-btn__content' },
        [this.$slots.default]
      )
    }
  }
}
</script>
  • Add the extented component to index page
./pages/index.vue
<template>
  <v-layout>
    <v-flex>
      <my-btn>My Button</my-btn>
    </v-flex>
  </v-layout>
</template>

<script>
import MyBtn from '../components/MyBtn'

export default {
  components: {
    MyBtn
  }
}
</script>

Versions

Latest version starter template vuetifyjs/nuxt:

  • nuxt 1.0.0-rc6
  • vuetify 0.15.7
  • and nodejs 6.11

What is expected ?

Wanted to change the content and styles of the button.

What is actually happening ?

Error occurs during compilation (npm run dev)

 ERROR  Failed to compile with 1 errors                                                                                                                                         23:55:03

 error  in ./node_modules/vuetify/src/mixins/route-link.js

Module parse failed: ...\vuetify-test2\node_modules\vuetify\src\mixins\route-link.js Unexpected token (36:10)
You may need an appropriate loader to handle this file type.
|         }],
|         on: {
|           ...(this.$listeners || {}),
|           click: this.click
|         }

 @ ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["...//vuetify-test2//node_modules//babel-preset-vue-app//dist//index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vuetify/src/components/VBtn/VBtn.vue 7:0-56
 @ ./node_modules/vuetify/src/components/VBtn/VBtn.vue
 @ ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["...//vuetify-test2//node_modules//babel-preset-vue-app//dist//index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./components/MyBtn.vue
 @ ./components/MyBtn.vue
 @ ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["...//vuetify-test2//node_modules//babel-preset-vue-app//dist//index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./pages/index.vue
 @ ./pages/index.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?name=client&reload=true&timeout=3000&path=/__webpack_hmr ./.nuxt/client.js

Reproduction Link

See code above. Sory, I do not know how to place an example with imports.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jacekkarczmarczykcommented, Sep 26, 2017

I’m not familiar with nuxt or with vuetify nuxt template, so maybe it’s a stupid question, but is there something that could be done in the template or in the docs (more detailed info) to avoid this kind of problems?

0reactions
lock[bot]commented, Apr 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extending Vuetify's VBtn component to create a reusable icon ...
I've been using the example Codepen (https://codepen.io/whoistobias/pen/yLNgjwy) to try to extend the Vuetify VBtn component to create a ...
Read more >
Button component — Vuetify
The v-btn component replaces the standard html button with a material design theme and a ... block buttons extend the full available width....
Read more >
Extending Vuetify Component - CodePen
1. const VBtn = Vue.options.components["VBtn"]; ; 2. ​ ; 3. const ActivateButton = { ; 4. extends: VBtn, ; 5. methods: {.
Read more >
Extending Vuetify's VBtn component to create a reusable icon ...
[Solved]-Extending Vuetify's VBtn component to create a reusable icon button component-Vue.js ... The problem is your icon names are incorrect. The default icon ......
Read more >
How to Use the Vuetify Button Component - Coding Beauty
Vuetify provides the v-btn component for creating a button. ... This makes the button extend to its full available width:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found