jsdoc-vuejs
jsdoc-vuejs copied to clipboard
[Bug] - can't set Required?
Awesome plugin, really liking how it works so far.
Not sure if this a bug, known or other, but I can't seem to set the Required?
table cell in the @vue-props
declaration.
/**
* @vue-prop {('cube-grid'|'three-bounce')} [name='cube-grid'] - optional='Yes' - true - name of loader to use
* @vue-prop {Number} [size=30] - [optional='Yes'] - size of loading icons width
* @vue-prop {String} [bgColor=#000] - required='Yes' - hexadecimal color value for loader
* @vue-prop {String} [bgColor=#000] - [required='Yes'] - hexadecimal color value for loader
*/
Nothing seems to work, and Required?
is always No
Hi, and thanks for your words.
I think you need to use this to make a property required:
/**
* @vue-prop {String} bgColor - hexadecimal color value for loader
*/
Since it uses bgColor
instead of [bgColor=#000]
, the property is now seen as required.
See https://github.com/Kocal/jsdoc-vuejs#usage and https://jsdoc.app/tags-param.html#optional-parameters-and-default-values for more information
Thank you for your reply, how then would you set the default value, along side required?
* @vue-prop {('cube-grid'|'three-bounce')} [name='cube-grid'] - name of loader to use
* @vue-prop {('cube-grid'|'three-bounce')} name - name of loader to use
I can't seem to get both to work, the bug, or I am doing something very wrong. Thanks!
How can a Vue props can be required if it has a default value?
@Kocal fair enough, but the documentation is then confusing since Required?
says no
. Would it not make more sense to then void the value e.g. -
since the Default Value
is present? Similar to how its show when Required?
is Yes
?
I will be honest here and admit that I also find the documentation might benefit from being a little clearer on what part of that syntax designates what. I am currently doing a lot of trial and error . I got there eventually, but knowing that the default value needs to be sqashed in the square brackets with the name, whereas other bits are simply separated by spaces. The hyphens before "description" seem to be more of a stylistic best practice? I could easily remove them.