{"action":"created","issue":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1867","repository_url":"https://api.github.com/repos/RubyLouvre/avalon","labels_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1867/labels{/name}","comments_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1867/comments","events_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1867/events","html_url":"https://github.com/RubyLouvre/avalon/issues/1867","id":195455216,"number":1867,"title":"添加组件继承功能","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},"labels":[{"id":42797427,"url":"https://api.github.com/repos/RubyLouvre/avalon/labels/%E5%8A%9F%E8%83%BD%E5%A2%9E%E5%BC%BA","name":"功能增强","color":"a9ea00","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-14T07:00:49Z","updated_at":"2016-12-20T03:26:50Z","closed_at":null,"body":"现在avalon.component能返回一个对象，这个对象带有一个extend方法\r\n\r\n\r\n这个方法要求传入一个带defaults与displayName的对象，当然也能带soleSlot与template，因为它是这样实现继承的\r\n\r\n```javascript\r\nfunction componentExtend(child){\r\n    var name = child.displayName\r\n    delete child.displayName\r\n    var obj = {defaults: avalon.mix(true, {}, this.defaults, child.defaults)}\r\n    if( child.soleSlot){\r\n        obj.soleSlot = child.soleSlot\r\n    }\r\n    if( child.template){\r\n        obj.template = child.template\r\n    }\r\n    return avalon.component(name, obj)\r\n}\r\n```\r\n\r\n看例子：\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n\r\n<head>\r\n    <meta charset=\"UTF-8\" />\r\n    <title>Document</title>\r\n    <script type=\"text/javascript\" src=\"./dist/avalon.js\"></script>\r\n</head>\r\n\r\n<body>\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 aaa = avalon.component('aaa', {\r\n            defaults: {\r\n                aaa: 11,\r\n                bbb: 22\r\n            },\r\n            template: '<strong>{{@aaa}}</strong>'\r\n        })\r\n        var bbb = aaa.extend({\r\n            displayName: 'bbb',\r\n            template: '<div><strong>{{@aaa}}</strong></div>'\r\n        })\r\n        vm = avalon.define({\r\n            $id: 'test',\r\n            a: true,\r\n            b: true\r\n        })\r\n    </script>\r\n    <div id=\"aaa\" ms-controller=\"test\">\r\n        <wbr is=\"aaa\" />\r\n        <wbr is=\"bbb\" />\r\n    </div>\r\n\r\n\r\n</body>\r\n\r\n</html>\r\n```"},"comment":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/comments/268144811","html_url":"https://github.com/RubyLouvre/avalon/issues/1867#issuecomment-268144811","issue_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1867","id":268144811,"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-12-20T03:26:50Z","updated_at":"2016-12-20T03:26:50Z","body":"https://github.com/calefy/babel-plugin-transform-es2015-ie8-classes"}}
{"actor":{"display_login":"RubyLouvre"}}