{"action":"closed","issue":{"url":"https://api.github.com/repos/tobeapro/self/issues/2","repository_url":"https://api.github.com/repos/tobeapro/self","labels_url":"https://api.github.com/repos/tobeapro/self/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/tobeapro/self/issues/2/comments","events_url":"https://api.github.com/repos/tobeapro/self/issues/2/events","html_url":"https://github.com/tobeapro/self/issues/2","id":278377387,"number":2,"title":"jQuery的插件封装","user":{"login":"tobeapro","id":17215880,"avatar_url":"https://avatars0.githubusercontent.com/u/17215880?v=4","gravatar_id":"","url":"https://api.github.com/users/tobeapro","html_url":"https://github.com/tobeapro","followers_url":"https://api.github.com/users/tobeapro/followers","following_url":"https://api.github.com/users/tobeapro/following{/other_user}","gists_url":"https://api.github.com/users/tobeapro/gists{/gist_id}","starred_url":"https://api.github.com/users/tobeapro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobeapro/subscriptions","organizations_url":"https://api.github.com/users/tobeapro/orgs","repos_url":"https://api.github.com/users/tobeapro/repos","events_url":"https://api.github.com/users/tobeapro/events{/privacy}","received_events_url":"https://api.github.com/users/tobeapro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-01T07:11:50Z","updated_at":"2017-12-01T07:15:55Z","closed_at":"2017-12-01T07:15:55Z","author_association":"OWNER","body":"都知道$符号就是jQuery的别名，jq源码中，jQuery.fn=jQuery.prototype。所以我们可以使用$.fn来封装jq的方法。\r\n首先在项目中引入jq框架，而后再进行方法封装\r\n``` javacript\r\n$.fn.myFun=function(){\r\n   //方法内容\r\n}\r\n```\r\n这时就能在使用jq的对象下myFun方法了\r\n为了防止$符号被其他库或者代码覆盖,将封装的方法放在自执行函数中\r\n修改为：\r\n``` javascript\r\n(function($){\r\n  $.fn.myFun=function(){\r\n }\r\n})(jQuery)\r\n```"}}
{"actor":{"display_login":"tobeapro"}}