Created
May 18, 2021 09:32
-
-
Save jellehak/3091ead61d0ad243cb94875df27a48bf to your computer and use it in GitHub Desktop.
vue-created-methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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