Skip to content

Instantly share code, notes, and snippets.

@jellehak
Created May 18, 2021 09:32
Show Gist options
  • Save jellehak/3091ead61d0ad243cb94875df27a48bf to your computer and use it in GitHub Desktop.
Save jellehak/3091ead61d0ad243cb94875df27a48bf to your computer and use it in GitHub Desktop.
vue-created-methods
<script>
export default {
methods: {
fetch() {
//...
}
}
}
export default {
created() {
this.fetch = () => {
//...
}
}
}
export default {
methods: {
fetch() {
//...
}
}
}
export default {
created() {
const helper = () => { return 'cool' }
const fetch = () => {
return helper()
}
// Bind to Vue
this.fetch = fetch
this.fetchAlso = fetch // PRO: Easy aliassing
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment