Skip to content

Instantly share code, notes, and snippets.

@fimion
Last active June 23, 2021 15:53
Show Gist options
  • Save fimion/69bef93fd95522951a8e212e64699a3b to your computer and use it in GitHub Desktop.
Save fimion/69bef93fd95522951a8e212e64699a3b to your computer and use it in GitHub Desktop.
import constantMixin from './ConstantMixin.js";
const MAX = 5;
const MIN = 0;
export default {
name:"MyComponent",
mixins:[
constantMixin({ MAX, MIN }),
],
}
export default function constantMixin(constants={}){
const computed = {};
Object.keys(constants).forEach((key)=>{
computed[key] = ()=>constants[key];
});
return { computed };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment