Skip to content

Commit ad60e93

Browse files
committed
Props reviewed
1 parent e7acfb3 commit ad60e93

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/api/index.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,37 @@ type: api
339339
```
340340

341341
- **See also:** [Reactivity in Depth](/guide/reactivity.html).
342+
343+
### props
344+
345+
- **Type:** `Array | Object`
346+
347+
- **Details:**
348+
349+
A list/hash of attributes that are exposed to accept data from the parent component. It has a simple Array-based syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values.
350+
351+
- **Example:**
352+
353+
``` js
354+
// simple syntax
355+
Vue.component('props-demo-simple', {
356+
props: ['size', 'myMessage']
357+
})
358+
359+
// object syntax with validation
360+
Vue.component('props-demo-advanced', {
361+
props: {
362+
// just type check
363+
size: Number,
364+
// type check plus other validations
365+
name: {
366+
type: String,
367+
required: true,
368+
// warn if not two way bound
369+
twoWay: true
370+
}
371+
}
372+
})
373+
```
374+
375+
- **See also:** [Props](/guide/components.html#Props)

0 commit comments

Comments
 (0)