@@ -523,10 +523,24 @@ CompilerProto.compileElement = function (node, root) {
523523 node . vue_effect = this . eval ( utils . attr ( node , 'effect' ) )
524524
525525 var prefix = config . prefix + '-' ,
526- attrs = slice . call ( node . attributes ) ,
527526 params = this . options . paramAttributes ,
528527 attr , attrname , isDirective , exp , directives , directive , dirname
529528
529+ // v-with has special priority among the rest
530+ // it needs to pull in the value from the parent before
531+ // computed properties are evaluated, because at this stage
532+ // the computed properties have not set up their dependencies yet.
533+ if ( root ) {
534+ var withExp = utils . attr ( node , 'with' )
535+ if ( withExp ) {
536+ directives = this . parseDirective ( 'with' , withExp , node , true )
537+ for ( j = 0 , k = directives . length ; j < k ; j ++ ) {
538+ this . bindDirective ( directives [ j ] , this . parent )
539+ }
540+ }
541+ }
542+
543+ var attrs = slice . call ( node . attributes )
530544 for ( i = 0 , l = attrs . length ; i < l ; i ++ ) {
531545
532546 attr = attrs [ i ]
@@ -542,12 +556,7 @@ CompilerProto.compileElement = function (node, root) {
542556 // loop through clauses (separated by ",")
543557 // inside each attribute
544558 for ( j = 0 , k = directives . length ; j < k ; j ++ ) {
545- directive = directives [ j ]
546- if ( dirname === 'with' ) {
547- this . bindDirective ( directive , this . parent )
548- } else {
549- this . bindDirective ( directive )
550- }
559+ this . bindDirective ( directives [ j ] )
551560 }
552561 } else if ( config . interpolate ) {
553562 // non directive attribute, check interpolation tags
0 commit comments