{"action":"created","issue":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1577","repository_url":"https://api.github.com/repos/RubyLouvre/avalon","labels_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1577/labels{/name}","comments_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1577/comments","events_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1577/events","html_url":"https://github.com/RubyLouvre/avalon/issues/1577","id":164455079,"number":1577,"title":"含有ms-if的组件动态插入bug","user":{"login":"shanzhongke","id":18737791,"avatar_url":"https://avatars.githubusercontent.com/u/18737791?v=3","gravatar_id":"","url":"https://api.github.com/users/shanzhongke","html_url":"https://github.com/shanzhongke","followers_url":"https://api.github.com/users/shanzhongke/followers","following_url":"https://api.github.com/users/shanzhongke/following{/other_user}","gists_url":"https://api.github.com/users/shanzhongke/gists{/gist_id}","starred_url":"https://api.github.com/users/shanzhongke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanzhongke/subscriptions","organizations_url":"https://api.github.com/users/shanzhongke/orgs","repos_url":"https://api.github.com/users/shanzhongke/repos","events_url":"https://api.github.com/users/shanzhongke/events{/privacy}","received_events_url":"https://api.github.com/users/shanzhongke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-08T04:02:03Z","updated_at":"2016-07-10T17:35:56Z","closed_at":null,"body":"组件template中含有ms-if时第一次插入显示正常，而第二次以后失效，不含有ms-if则一切正常\r\n built in 2016-7-7:3 version 2.10 by 司徒正美\r\n\r\n````\r\n<body>\r\n\t\t<div ms-controller=\"test\">\r\n\t\t\t<div ms-html=\"@tpl\"></div>\r\n\t\t\t<button ms-click=\"@click\">插入</button>\r\n\t\t\t<button ms-click=\"@click2\">插入</button>\r\n\t\t</div>\r\n\t\t<script>\r\n\t\t\trequire.config({ //依赖配置\r\n\t\t\t\tpaths: {\r\n\t\t\t\t\ttext: 'vendor/require/text.min'\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tvar vm = avalon.define({\r\n\t\t\t\t$id: 'test',\r\n\t\t\t\ttpl: \"\",\r\n\t\t\t\tclick: function() {\r\n\t\t\t\t\trequire(['1'], function(module) {\r\n\t\t\t\t\t\tmodule.load();\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tclick2: function() {\r\n\t\t\t\t\tthis.tpl = \"\";\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tavalon.define({\r\n\t\t\t\t$id: 'test2',\r\n\t\t\t\tter: ['呵呵哒1', '呵呵哒2', '呵呵哒3']\r\n\t\t\t});\r\n\r\n\t\t\tavalon.component('ms-span', {\r\n\t\t\t\ttemplate: \"<div><span ms-if='@show'>呵呵哒</span><span ms-for='el in @ter'>{{el}}</span></div>\",//不含有ms-if则一切正常\r\n\t\t\t\tdefaults: {\r\n\t\t\t\t\tshow: false,\r\n\t\t\t\t\tter: []\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t</script>\r\n\t</body>\r\n````\r\n1.js\r\n````\r\ndefine(['text!./123.html'], function(tpl) {\r\n\treturn {\r\n\t\tload: function() {\r\n\t\t\tavalon.vmodels.test.tpl = tpl;\r\n\t\t}\r\n\t}\r\n});\r\n````\r\n\r\n123.html\r\n````\r\n<div ms-controller=\"test2\">\r\n\t<xmp cached='true' ms-widget=\"{is:'ms-span',$id:'xxx'}\"></xmp>\r\n</div>\r\n````"},"comment":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/comments/231600882","html_url":"https://github.com/RubyLouvre/avalon/issues/1577#issuecomment-231600882","issue_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1577","id":231600882,"user":{"login":"RubyLouvre","id":190846,"avatar_url":"https://avatars.githubusercontent.com/u/190846?v=3","gravatar_id":"","url":"https://api.github.com/users/RubyLouvre","html_url":"https://github.com/RubyLouvre","followers_url":"https://api.github.com/users/RubyLouvre/followers","following_url":"https://api.github.com/users/RubyLouvre/following{/other_user}","gists_url":"https://api.github.com/users/RubyLouvre/gists{/gist_id}","starred_url":"https://api.github.com/users/RubyLouvre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RubyLouvre/subscriptions","organizations_url":"https://api.github.com/users/RubyLouvre/orgs","repos_url":"https://api.github.com/users/RubyLouvre/repos","events_url":"https://api.github.com/users/RubyLouvre/events{/privacy}","received_events_url":"https://api.github.com/users/RubyLouvre/received_events","type":"User","site_admin":false},"created_at":"2016-07-10T17:35:56Z","updated_at":"2016-07-10T17:35:56Z","body":"```html\r\n<!doctype html>\r\n<html>\r\n    <head>\r\n        <meta charset=\"UTF-8\">\r\n        <script src=\"../dist/avalon.js\"></script>\r\n\r\n    </head>\r\n    <body>\r\n        <div ms-controller=\"test\">\r\n            <div ms-html=\"@tpl\"></div>\r\n            <button ms-click=\"@click\">插入</button>\r\n            <button ms-click=\"@click2\">插入</button>\r\n        </div>\r\n        <script>\r\n            function heredoc(fn) {\r\n                return fn.toString().replace(/^[^\\/]+\\/\\*!?\\s?/, '').\r\n                        replace(/\\*\\/[^\\/]+$/, '').trim().replace(/>\\s*</g, '><')\r\n            }\r\n             var html = heredoc(function () {\r\n                /*\r\n                 <div ms-controller=\"test2\">\r\n                 <xmp cached='true' ms-widget=\"{is:'ms-span',$id:'xxx'}\"></xmp>\r\n                 </div>\r\n                 */\r\n            })\r\n            var vm = avalon.define({\r\n                $id: 'test',\r\n                tpl: \"\",\r\n                click: function () {\r\n                    setTimeout(function () {\r\n                        vm.tpl = html\r\n                    })\r\n                },\r\n                click2: function () {\r\n                    this.tpl = \"\";\r\n                }\r\n            });\r\n\r\n            avalon.define({\r\n                $id: 'test2',\r\n                ter: ['呵呵哒1', '呵呵哒2', '呵呵哒3']\r\n            });\r\n\r\n            avalon.component('ms-span', {\r\n                template: \"<blockquote><span  ms-if='@show'>AAA</span>|<span ms-for='el in @ter'>{{el}}</span></blockquote>\", //不含有ms-if则一切正常\r\n                defaults: {\r\n                    show: false,\r\n                    ter: []\r\n                }\r\n            });\r\n        </script>\r\n    </body>\r\n</html>\r\n\r\n\r\n```"}}
{"actor":{"display_login":"RubyLouvre"}}