Skip to content

Fix api options #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions source/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ vm.a // -> 2
vm.aDouble // -> 4
```

### paramAttributes
### props

- **Type:** `Array`

Expand All @@ -113,7 +113,7 @@ An array of attribute names to be set on the Vue instance as initial data. Usefu

``` js
Vue.component('param-demo', {
paramAttributes: ['size', 'message'],
props: ['size', 'message'],
compiled: function () {
console.log(this.size) // -> 100
console.log(this.message) // -> 'hello!'
Expand All @@ -125,15 +125,14 @@ Vue.component('param-demo', {
<param-demo size="100" message="hello!"></param-demo>
```

Param attributes can also contain interpolation tags. The interpolation will be evaluated against the parent, and under the hood they will be compiled as [`v-with`](/api/directives.html#v-with), which means when the value of the interpolated expression changes, the component's corresponding property will also be updated:
For passing data more details see the following:

``` html
<param-demo message="{{parentMessage}}"></param-demo>
```
- [Prop Binding Types](/guide/components.html#Prop_Binding_Types)
- [Passing Callbacks as Props](/guide/components.html#Passing_Callbacks_as_Props)

#### Notes on hyphened attributes

HTML attribute names ignore upper and lower case differences, so we usually use hyphened attributes instead of camel case. There are some special cases when using `paramAttributes` with attributes that contains hyphens:
HTML attribute names ignore upper and lower case differences, so we usually use hyphened attributes instead of camel case. There are some special cases when using `props` with attributes that contains hyphens:

1. If the attribute is a data attribute, the `data-` prefix will be auto stripped;

Expand Down Expand Up @@ -377,4 +376,4 @@ var Ctor = Vue.extend({
})
var vm = new Ctor()
console.log(vm) // -> CoolStuff {$el: null, ...}
```
```