From 9982482e310b3bb1b9d41e78b809210afc6175f2 Mon Sep 17 00:00:00 2001 From: Carlos Rodrigues Date: Fri, 12 Jun 2020 14:44:35 +0100 Subject: [PATCH 1/2] feature: add example type Function to props --- src/guide/component-props.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/guide/component-props.md b/src/guide/component-props.md index 7505d2a819..01cd6bec8d 100644 --- a/src/guide/component-props.md +++ b/src/guide/component-props.md @@ -193,7 +193,14 @@ app.component('my-component', { // The value must match one of these strings return ['success', 'warning', 'danger'].indexOf(value) !== -1 } - } + }, + // Type function, the default will be the default function + propG: { + type: Function, + default: function () { + return 'Default function' + }, + }, } }) ``` From 82f1adcc451f80c57c92363b0a9b2742e585c47a Mon Sep 17 00:00:00 2001 From: Carlos Rodrigues Date: Fri, 12 Jun 2020 16:23:36 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Natalia Tepluhina --- src/guide/component-props.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/guide/component-props.md b/src/guide/component-props.md index 01cd6bec8d..a8a245d80b 100644 --- a/src/guide/component-props.md +++ b/src/guide/component-props.md @@ -194,9 +194,10 @@ app.component('my-component', { return ['success', 'warning', 'danger'].indexOf(value) !== -1 } }, - // Type function, the default will be the default function + // Function with a default value propG: { type: Function, + // Unlike object or array default, this is not a factory function - this is a function to serve as a default value default: function () { return 'Default function' },