avalon2操作dom后绑定失败的疑问

<div class="test2" ms-controller="test2"></div><div id="kk">click</div><script type="text/javascript">
    $(".test").append("<p>{{@sex}}</p>");        var s=avalon.define({              $id: "test2",    
              age: 23,              card: "aaaa"
          });
          $(".test2").append("<p>{{@age}}</p>");
        $("#kk").click(function(){
            $(".test2").append("<p>{{@card}}</p>");
                      s.age++;
            avalon.scan(document.body);
        });</script>

//事件前的的操作是可以的,为何事件中添加的p绑定是失败的


GCT1015
浏览 667回答 1
1回答

红颜莎娜

<div class="test2" ms-controller="test2" ms-html="@html"></div>var s=avalon.define({&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $id: "test2",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; age: 23,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html: '<p>{{@sex}}</p>',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card: "aaaa"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript