Skip to content

Instantly share code, notes, and snippets.

@mqli
Last active August 30, 2016 09:10
Show Gist options
  • Save mqli/0e1c365a69cbed01d93ac8ce8afdde1b to your computer and use it in GitHub Desktop.
Save mqli/0e1c365a69cbed01d93ac8ce8afdde1b to your computer and use it in GitHub Desktop.
Way of Extend a '.vue' File Component

It not a good practise,you should alway use mixin as you can.

  • Say that your have a 3rd party component fits your need 90%
  • Only a bit of code you want to customize, maybe just the html layout
  • The component doesn't have a option for that
  • the component is a '.vue' import by vue-loader so you can't OtherComponent.extend
  import OtherComponent from 'OtherComponent'
  Vue.extend(OtherComponent).extend({
    methods: codeThatDoesNotFitYourNeed(){
      // customize code
    }
  })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment