-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose enum constants #10
Conversation
Do you know about the frontend |
I did not, but I also can't find any usages nor documentations surrounding it. I'm currently adding my enums to Any example or reference to doing it properly would of course be welcome. |
You should add local enums to a The you can do computed: {
...mapState('local', ['enums']),
}
....
$this.enums.myEnum._get(key)` BTW if you have the time a PR in the docs with this would be great ;) |
Thanks, I'll look into using & documenting it! I do believe certain use-cases could benefit from this simpler exposure. p.s.: I hope you had a nice holiday :-) |
Yes I did, finally leveraged 3.2.0 :)))) The same for you :) |
Thanks, I did recently :) Just as a If you have an enum ( ex.: class MyEnumClass extends Enum
{
const onEnter = 0;
const onExit = 1;
const manual = 2;
protected static $data = [
self::onEnter => 'Automatically on enter',
self::onExit => 'Automatically on exit',
self::manual => 'Manually',
];
} In the frontend, I want to check If confirmed, I'd document exposing via |
It has a little magic but only if you are using |
@aocneanu commented on May 2, 2019, 9:06 AM GMT+2:
Do you mean declaring Thanks! |
Basically the constant name should match the label without spaces |
Ah, yes; because spaces get trimmed in the flip. I'll note it alongside the constant method 👍 |
Allows exposing the constants for usage in frontend (where $data is being used for more descriptive labels)