Created
November 3, 2017 08:51
-
-
Save ndabAP/7ddb5bc9ccd38de4c4a80bb5c0205f0c to your computer and use it in GitHub Desktop.
Decorators in Vue.js
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
<template> | |
<div> | |
<!-- User form --> | |
</div> | |
</template> | |
<script> | |
import User from 'src/decorators/UserDecorator' | |
export default { | |
@User() | |
data () {} | |
} | |
</script> |
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
export default rest => { | |
return (target, name, descriptor) => { | |
descriptor.value = () => { | |
return { | |
user: { | |
username: '', | |
password: '' | |
}, | |
...rest | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment