@@ -22,37 +22,27 @@ var vueDocs = require('vue-docgen-api');
22
22
var componentInfo = vueDocs .parse (filePath);
23
23
```
24
24
25
+
26
+ ## parse(filePath \[ , webpackConfig \] )
27
+
28
+ | Parameter | Type | Description |
29
+ | -------------- | ------ | --------------- |
30
+ | filePath | string | The file path |
31
+ | webpackConfig | object | Optional argument, extracts the necessary loaders to document the component. |
32
+
33
+
25
34
## Using JSDoc tags
26
35
27
36
You can use the following [ JSDoc] [ ] tags when documenting components, props and methods.
28
37
29
- ## PropTypes
30
-
31
- ### Example
38
+ ## Example
32
39
33
40
For the following component
34
41
35
42
``` html
36
43
<template >
37
44
<table class =" grid" >
38
- <thead >
39
- <tr >
40
- <th v-for =" key in columns"
41
- @click =" sortBy(key)"
42
- :class =" { active: sortKey == key }" >
43
- {{ key | capitalize }}
44
- <span class =" arrow" :class =" sortOrders[key] > 0 ? 'asc' : 'dsc'" >
45
- </span >
46
- </th >
47
- </tr >
48
- </thead >
49
- <tbody >
50
- <tr v-for =" entry in filteredData" >
51
- <td v-for =" key in columns" >
52
- {{entry[key]}}
53
- </td >
54
- </tr >
55
- </tbody >
45
+ <!-- -->
56
46
</table >
57
47
</template >
58
48
@@ -78,7 +68,7 @@ export default {
78
68
*/
79
69
msg: {
80
70
type: [String , Number ],
81
- default: ' Ejemplo '
71
+ default: text
82
72
},
83
73
/**
84
74
* describe data
@@ -158,12 +148,6 @@ export default {
158
148
}
159
149
}
160
150
</script >
161
-
162
- <style scoped >
163
- .grid {
164
- margin-bottom : 20px ;
165
- }
166
- </style >
167
151
```
168
152
169
153
we are getting this output:
@@ -235,15 +219,15 @@ we are getting this output:
235
219
}
236
220
}
237
221
],
238
- "displayName" : " Grid " ,
222
+ "displayName" : " grid " ,
239
223
"props" : {
240
224
"msg" : {
241
225
"type" : {
242
226
"name" : " string|number"
243
227
},
244
228
"required" : " " ,
245
229
"defaultValue" : {
246
- "value" : " \" Ejemplo \" " ,
230
+ "value" : " \" this is a secret \" " ,
247
231
"computed" : false
248
232
},
249
233
"tags" : {
@@ -286,6 +270,26 @@ we are getting this output:
286
270
"name" : " array"
287
271
},
288
272
"description" : " get columns list"
273
+ },
274
+ "filterKey" : {
275
+ "type" : {
276
+ "name" : " string"
277
+ },
278
+ "required" : " " ,
279
+ "defaultValue" : {
280
+ "value" : " \" example\" " ,
281
+ "computed" : false
282
+ },
283
+ "tags" : {
284
+ "ignore" : [
285
+ {
286
+ "title" : " ignore" ,
287
+ "description" : true
288
+ }
289
+ ]
290
+ },
291
+ "comment" : " /**\n * filter key\n * @ignore\n */" ,
292
+ "description" : " filter key"
289
293
}
290
294
},
291
295
"comment" : " /**\n * This is an example of creating a reusable grid component and using it with external data.\n * @version 1.0.5\n * @author [Rafael](https://github.com/rafaesc92)\n * @since Version 1.0.1\n */" ,
@@ -310,6 +314,60 @@ we are getting this output:
310
314
]
311
315
}
312
316
}
317
+
318
+ ```
319
+
320
+ ## Mixins
321
+ If you import a mixin, for it to be documented you need to add in the header the mixin tag ** @mixin ** , for example
322
+
323
+ ``` javascript
324
+ // src/mixins/colorMixin.js
325
+
326
+ /**
327
+ * @mixin
328
+ */
329
+ module .exports = {
330
+ props: {
331
+ /**
332
+ * The color for the button example
333
+ */
334
+ color: {
335
+ type: String ,
336
+ default: ' #333'
337
+ },
338
+ }
339
+ }
340
+ ```
341
+
342
+ ``` html
343
+ <template >
344
+ <!-- -->
345
+ </template >
346
+ <script >
347
+ // src/components/Button/Button.vue
348
+
349
+ import colorMixin from ' ../../mixins/colorMixin' ;
350
+ export default {
351
+ name: ' buttonComponent' ,
352
+ mixins: [colorMixin],
353
+ props: {
354
+ /**
355
+ * The size of the button
356
+ * `small, normal, large`
357
+ */
358
+ size: {
359
+ default: ' normal'
360
+ },
361
+ /**
362
+ * Add custom click actions.
363
+ **/
364
+ onCustomClick: {
365
+ default : () => () => null ,
366
+ },
367
+ },
368
+ /* ... */
369
+ }
370
+ </script >
313
371
```
314
372
315
373
## Change log
0 commit comments