Skip to content

Commit 3597675

Browse files
committed
rename paramAttributes -> props
1 parent 3959b67 commit 3597675

File tree

9 files changed

+37
-37
lines changed

9 files changed

+37
-37
lines changed

examples/grid/grid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Vue.component('demo-grid', {
33
template: '#grid-template',
44
replace: true,
5-
paramAttributes: ['data', 'columns', 'filter-key'],
5+
props: ['data', 'columns', 'filter-key'],
66
data: function () {
77
return {
88
data: null,

src/compiler/compile.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function teardownDirs (vm, dirs, destroying) {
110110
* Compile the root element of a component. There are
111111
* 4 types of things to process here:
112112
*
113-
* 1. paramAttributes on parent container (child scope)
113+
* 1. props on parent container (child scope)
114114
* 2. v-with on parent container (child scope)
115115
* 3. other attrs on parent container (parent scope)
116116
* 4. attrs on the component template root node, if
@@ -128,11 +128,11 @@ function compileRoot (el, options) {
128128
var isBlock = el.nodeType === 11 // DocumentFragment
129129
var containerAttrs = options._containerAttrs
130130
var replacerAttrs = options._replacerAttrs
131-
var params = options.paramAttributes
132-
var paramsLinkFn, withLinkFn, parentLinkFn, replacerLinkFn
133-
// 1. paramAttributes
134-
paramsLinkFn = params
135-
? compileParamAttributes(el, containerAttrs, params, options)
131+
var props = options.props
132+
var propsLinkFn, withLinkFn, parentLinkFn, replacerLinkFn
133+
// 1. props
134+
propsLinkFn = props
135+
? compileProps(el, containerAttrs, props, options)
136136
: null
137137
// 2. v-with
138138
var withName = config.prefix + 'with'
@@ -156,9 +156,9 @@ function compileRoot (el, options) {
156156
}
157157
}
158158
return function rootLinkFn (vm, el, host) {
159-
// explicitly passing null to paramAttributes and v-with
159+
// explicitly passing null to props and v-with
160160
// linkers because they don't need a real element
161-
if (paramsLinkFn) paramsLinkFn(vm, null)
161+
if (propsLinkFn) propsLinkFn(vm, null)
162162
if (withLinkFn) withLinkFn(vm, null)
163163
if (parentLinkFn) parentLinkFn(vm.$parent, el, host)
164164
if (replacerLinkFn) replacerLinkFn(vm, el, host)
@@ -382,28 +382,28 @@ function makeChildLinkFn (linkFns) {
382382

383383
/**
384384
* Compile param attributes on a root element and return
385-
* a paramAttributes link function.
385+
* a props link function.
386386
*
387387
* @param {Element|DocumentFragment} el
388388
* @param {Object} attrs
389-
* @param {Array} paramNames
389+
* @param {Array} propNames
390390
* @param {Object} options
391-
* @return {Function} paramsLinkFn
391+
* @return {Function} propsLinkFn
392392
*/
393393

394-
function compileParamAttributes (el, attrs, paramNames, options) {
395-
var params = []
396-
var i = paramNames.length
394+
function compileProps (el, attrs, propNames, options) {
395+
var props = []
396+
var i = propNames.length
397397
var name, value, param
398398
while (i--) {
399-
name = paramNames[i]
399+
name = propNames[i]
400400
if (/[A-Z]/.test(name)) {
401401
_.warn(
402-
'You seem to be using camelCase for a paramAttribute, ' +
402+
'You seem to be using camelCase for a component prop, ' +
403403
'but HTML doesn\'t differentiate between upper and ' +
404404
'lower case. You should use hyphen-delimited ' +
405405
'attribute names. For more info see ' +
406-
'http://vuejs.org/api/options.html#paramAttributes'
406+
'http://vuejs.org/api/options.html#props'
407407
)
408408
}
409409
value = attrs[name]
@@ -422,30 +422,30 @@ function compileParamAttributes (el, attrs, paramNames, options) {
422422
param.value = textParser.tokensToExp(tokens)
423423
param.oneTime = tokens.length === 1 && tokens[0].oneTime
424424
}
425-
params.push(param)
425+
props.push(param)
426426
}
427427
}
428-
return makeParamsLinkFn(params, options)
428+
return makeParamsLinkFn(props, options)
429429
}
430430

431431
/**
432432
* Build a function that applies param attributes to a vm.
433433
*
434-
* @param {Array} params
434+
* @param {Array} props
435435
* @param {Object} options
436-
* @return {Function} paramsLinkFn
436+
* @return {Function} propsLinkFn
437437
*/
438438

439439
var dataAttrRE = /^data-/
440440

441-
function makeParamsLinkFn (params, options) {
441+
function makeParamsLinkFn (props, options) {
442442
var def = options.directives['with']
443-
return function paramsLinkFn (vm, el) {
444-
var i = params.length
443+
return function propsLinkFn (vm, el) {
444+
var i = props.length
445445
var param, path
446446
while (i--) {
447-
param = params[i]
448-
// params could contain dashes, which will be
447+
param = props[i]
448+
// props could contain dashes, which will be
449449
// interpreted as minus calculations by the parser
450450
// so we need to wrap the path here
451451
path = _.camelize(param.name.replace(dataAttrRE, ''))

src/instance/scope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ exports._initData = function () {
2525
// proxy data on instance
2626
var data = this._data
2727
var i, key
28-
// make sure all paramAttributes properties are observed
29-
var params = this.$options.paramAttributes
28+
// make sure all props properties are observed
29+
var params = this.$options.props
3030
if (params) {
3131
i = params.length
3232
while (i--) {

src/util/merge-option.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ strats.beforeCompile =
113113
strats.compiled =
114114
strats.beforeDestroy =
115115
strats.destroyed =
116-
strats.paramAttributes = function (parentVal, childVal) {
116+
strats.props = function (parentVal, childVal) {
117117
return childVal
118118
? parentVal
119119
? parentVal.concat(childVal)

test/unit/specs/compiler/compile_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ if (_.inBrowser) {
157157
it('param attributes', function () {
158158
var options = merge(Vue.options, {
159159
_asComponent: true,
160-
paramAttributes: [
160+
props: [
161161
'a',
162162
'data-some-attr',
163163
'some-other-attr',

test/unit/specs/directives/component_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ if (_.inBrowser) {
224224
})
225225
})
226226

227-
it('paramAttributes', function () {
227+
it('props', function () {
228228
var vm = new Vue({
229229
el: el,
230230
data: {
@@ -234,7 +234,7 @@ if (_.inBrowser) {
234234
components: {
235235
test: {
236236
template: '<li v-repeat="collection">{{a}}</li>',
237-
paramAttributes: ['collection']
237+
props: ['collection']
238238
}
239239
}
240240
})

test/unit/specs/directives/if_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ if (_.inBrowser) {
190190
template: '<div v-component="test" show="{{show}}">{{a}}</div>',
191191
components: {
192192
test: {
193-
paramAttributes: ['show'],
193+
props: ['show'],
194194
template: '<div v-if="show"><content></cotent></div>'
195195
}
196196
}

test/unit/specs/directives/with_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ if (_.inBrowser) {
143143
},
144144
components: {
145145
test: {
146-
paramAttributes: ['c'],
146+
props: ['c'],
147147
template: '<p>{{b}}</p><p>{{c}}</p>',
148148
replace: true
149149
}

test/unit/specs/util/merge-option_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Util - Option merging', function () {
1313
expect(res).toBe(false)
1414
})
1515

16-
it('hooks & paramAttributes', function () {
16+
it('hooks & props', function () {
1717
var fn1 = function () {}
1818
var fn2 = function () {}
1919
var res
@@ -34,7 +34,7 @@ describe('Util - Option merging', function () {
3434
expect(res[0]).toBe(fn1)
3535
expect(res[1]).toBe(fn2)
3636
// both arrays
37-
res = merge({paramAttributes: [1]}, {paramAttributes: [2]}).paramAttributes
37+
res = merge({props: [1]}, {props: [2]}).props
3838
expect(Array.isArray(res)).toBe(true)
3939
expect(res.length).toBe(2)
4040
expect(res[0]).toBe(1)

0 commit comments

Comments
 (0)