diff --git a/addons/docs/src/lib/docgen/createPropDef.ts b/addons/docs/src/lib/docgen/createPropDef.ts
index 08baf92b7bc8..645cc1a454dc 100644
--- a/addons/docs/src/lib/docgen/createPropDef.ts
+++ b/addons/docs/src/lib/docgen/createPropDef.ts
@@ -23,12 +23,17 @@ function createDefaultValue(
type: DocgenType
): PropDefaultValue {
if (defaultValue != null) {
- const { value, computed } = defaultValue;
+ const { value, computed, func } = defaultValue;
+
if (!isDefaultValueBlacklisted(value)) {
// Work around a bug in `react-docgen-typescript-loader`, which returns 'string' for a string
// default, instead of "'string'" -- which is incorrect (PR to RDT to follow)
- if (typeof computed === 'undefined' && type.name === 'string') {
+ if (
+ typeof computed === 'undefined' &&
+ typeof func === 'undefined' &&
+ type.name === 'string'
+ ) {
return createSummaryValue(JSON.stringify(value));
}
diff --git a/addons/docs/src/lib/docgen/extractDocgenProps.test.ts b/addons/docs/src/lib/docgen/extractDocgenProps.test.ts
index cd47f290068d..8d76693dabb2 100644
--- a/addons/docs/src/lib/docgen/extractDocgenProps.test.ts
+++ b/addons/docs/src/lib/docgen/extractDocgenProps.test.ts
@@ -93,6 +93,25 @@ TypeSystems.forEach((x) => {
expect(propDef.required).toBe(false);
expect(propDef.defaultValue.summary).toBe('"Default"');
});
+
+ it('should map defaults docgen info properly, vue', () => {
+ const component = createComponent({
+ ...createStringType(x),
+ description: 'Hey! Hey!',
+ defaultValue: {
+ value: "'Default'",
+ func: false,
+ },
+ });
+
+ const { propDef } = extractComponentProps(component, DOCGEN_SECTION)[0];
+
+ expect(propDef.name).toBe(PROP_NAME);
+ expect(propDef.type.summary).toBe('string');
+ expect(propDef.description).toBe('Hey! Hey!');
+ expect(propDef.required).toBe(false);
+ expect(propDef.defaultValue.summary).toBe("'Default'");
+ });
}
it('should remove JSDoc tags from the description', () => {
diff --git a/addons/docs/src/lib/docgen/types.ts b/addons/docs/src/lib/docgen/types.ts
index bfddccd66425..0a46b8376ba3 100644
--- a/addons/docs/src/lib/docgen/types.ts
+++ b/addons/docs/src/lib/docgen/types.ts
@@ -33,6 +33,7 @@ export interface DocgenTypeScriptType extends DocgenType {}
export interface DocgenPropDefaultValue {
value: string;
computed?: boolean;
+ func?: boolean;
}
export interface DocgenInfo {
diff --git a/examples/vue-3-cli/src/stories/Button.vue b/examples/vue-3-cli/src/stories/Button.vue
index 9f844977c19e..bb795d041af9 100644
--- a/examples/vue-3-cli/src/stories/Button.vue
+++ b/examples/vue-3-cli/src/stories/Button.vue
@@ -1,5 +1,7 @@
-
+