File tree Expand file tree Collapse file tree 4 files changed +53
-4
lines changed Expand file tree Collapse file tree 4 files changed +53
-4
lines changed Original file line number Diff line number Diff line change @@ -530,9 +530,7 @@ CompilerProto.markComputed = function (binding) {
530
530
vm = this . vm
531
531
binding . isComputed = true
532
532
// bind the accessors to the vm
533
- if ( binding . isFn ) {
534
- binding . value = utils . bind ( value , vm )
535
- } else {
533
+ if ( ! binding . isFn ) {
536
534
value . $get = utils . bind ( value . $get , vm )
537
535
if ( value . $set ) {
538
536
value . $set = utils . bind ( value . $set , vm )
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ module.exports = {
29
29
30
30
var compiler = this . compiler ,
31
31
event = this . arg ,
32
+ isExp = this . binding . isExp ,
32
33
ownerVM = this . binding . compiler . vm
33
34
34
35
if ( compiler . repeat &&
@@ -51,7 +52,7 @@ module.exports = {
51
52
if ( target ) {
52
53
e . el = target
53
54
e . targetVM = target . vue_viewmodel
54
- handler . call ( ownerVM , e )
55
+ handler . call ( isExp ? e . targetVM : ownerVM , e )
55
56
}
56
57
}
57
58
dHandler . event = event
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < title > Repeated Expressions</ title >
5
+ < meta charset ="utf-8 ">
6
+ < script src ="../../../dist/vue.js "> </ script >
7
+ </ head >
8
+ < body >
9
+ < ul id ="test ">
10
+ < li
11
+ v-repeat ="items "
12
+ v-on ="click:n++ "
13
+ class ="item-{{$index}} "
14
+ >
15
+ {{n}}
16
+ </ li >
17
+ </ ul >
18
+ < script >
19
+ var app = new Vue ( {
20
+ el : '#test' ,
21
+ data : {
22
+ items : [
23
+ { n : 1 } ,
24
+ { n : 2 } ,
25
+ { n : 3 }
26
+ ]
27
+ }
28
+ } )
29
+ </ script >
30
+ </ body >
31
+ </ html >
Original file line number Diff line number Diff line change
1
+ casper . test . begin ( 'Repeated Expressions' , 3 , function ( test ) {
2
+
3
+ casper
4
+ . start ( './fixtures/repeated-exp.html' )
5
+ . then ( function ( ) {
6
+ this . click ( '.item-0' )
7
+ this . click ( '.item-1' )
8
+ this . click ( '.item-2' )
9
+ } )
10
+ . then ( function ( ) {
11
+ test . assertSelectorHasText ( '.item-0' , '2' )
12
+ test . assertSelectorHasText ( '.item-1' , '3' )
13
+ test . assertSelectorHasText ( '.item-2' , '4' )
14
+ } )
15
+ . run ( function ( ) {
16
+ test . done ( )
17
+ } )
18
+
19
+ } )
You can’t perform that action at this time.
0 commit comments