Skip to content

Commit f80fa6b

Browse files
feature: add example type Function to props (#114)
* feature: add example type Function to props * Apply suggestions from code review Co-authored-by: Natalia Tepluhina <tarya.se@gmail.com> Co-authored-by: Natalia Tepluhina <tarya.se@gmail.com>
1 parent 189453f commit f80fa6b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/guide/component-props.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,15 @@ app.component('my-component', {
193193
// The value must match one of these strings
194194
return ['success', 'warning', 'danger'].indexOf(value) !== -1
195195
}
196-
}
196+
},
197+
// Function with a default value
198+
propG: {
199+
type: Function,
200+
// Unlike object or array default, this is not a factory function - this is a function to serve as a default value
201+
default: function () {
202+
return 'Default function'
203+
},
204+
},
197205
}
198206
})
199207
```

0 commit comments

Comments
 (0)