From 98b21a64ecdeeaeffea70038e31c3091465ad9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Wed, 26 Dec 2018 16:59:04 +0800 Subject: [PATCH] update --- src/06-vm.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/06-vm.js b/src/06-vm.js index dbcc288..1142b3e 100644 --- a/src/06-vm.js +++ b/src/06-vm.js @@ -307,7 +307,6 @@ function observeObject(source, options) { $vmodel[name] = source[name] }) - /* jshint ignore:start */ // hideProperty($vmodel, '$ups', null) hideProperty($vmodel, '$id', 'anonymous') hideProperty($vmodel, '$up', old ? old.$up : null) @@ -343,9 +342,7 @@ function observeObject(source, options) { } }) } - /* jshint ignore:end */ - //必须设置了$active,$events simple.forEach(function(name) { var oldVal = old && old[name] var val = ($vmodel[name] = state[name]) @@ -373,8 +370,10 @@ function observeObject(source, options) { $vmodel.$active = true - if (old && old.$up && old.$up.$children) { - old.$up.$children.push($vmodel) + if ($vmodel.$id !== 'anonymous') { + if (old && old.$up && old.$up.$children) { + old.$up.$children.push($vmodel) + } } return $vmodel