Skip to content

Commit 47e700d

Browse files
committed
support bind-ref
1 parent 088fec3 commit 47e700d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/directive.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,15 @@ Directive.prototype._checkStatement = function () {
184184

185185
Directive.prototype.param = function (name) {
186186
var param = this.el.getAttribute(name)
187-
if (param !== null) {
187+
if (param != null) {
188188
this.el.removeAttribute(name)
189189
param = (this._scope || this.vm).$interpolate(param)
190+
} else {
191+
param = this.el.getAttribute('bind-' + name)
192+
if (param != null) {
193+
this.el.removeAttribute('bind-' + name)
194+
param = (this._scope || this.vm).$eval(param)
195+
}
190196
}
191197
return param
192198
}

test/unit/specs/directives/for/for_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,9 @@ if (_.inBrowser) {
664664
var vm = new Vue({
665665
el: el,
666666
template:
667-
'<div v-for="item in list" track-by="id" v-ref="outer">' +
667+
'<div v-for="item in list" track-by="id" ref="outer">' +
668668
'{{item.msg}}' +
669-
'<div v-for="subItem in item.list" track-by="id" v-ref="inner{{$index}}">' +
669+
'<div v-for="subItem in item.list" track-by="id" bind-ref="\'inner\' + $index">' +
670670
'{{subItem.msg}}' +
671671
'</div>' +
672672
'</div>',

0 commit comments

Comments
 (0)