{"id":13671958,"url":"https://github.com/oklai/itouch","last_synced_at":"2025-05-16T18:34:42.294Z","repository":{"id":3635031,"uuid":"4701732","full_name":"oklai/itouch","owner":"oklai","description":"让开发web app更简单！","archived":false,"fork":false,"pushed_at":"2014-03-23T03:25:08.000Z","size":814,"stargazers_count":21,"open_issues_count":1,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-11T09:44:22.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"oklai.github.com/itouch/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oklai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-18T14:20:02.000Z","updated_at":"2020-06-04T09:44:31.000Z","dependencies_parsed_at":"2022-09-07T03:10:29.447Z","dependency_job_id":null,"html_url":"https://github.com/oklai/itouch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklai%2Fitouch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklai%2Fitouch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklai%2Fitouch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklai%2Fitouch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oklai","download_url":"https://codeload.github.com/oklai/itouch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225444618,"owners_count":17475354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:22.895Z","updated_at":"2024-11-19T23:56:02.930Z","avatar_url":"https://github.com/oklai.png","language":"JavaScript","readme":"#如何使用itouch？\n\n###在页面上引用一下文件:\n```\n\u003clink rel=\"stylesheet\" href=\"your-path/itouch.css\" type=\"text/css\" /\u003e\n\u003cscript src=\"your-path/itouch.js\"\u003e\u003c/script\u003e\n```\n\n###面板页面HTML片段：\n```\n\u003cdiv class=\"panel\"\u003e\n\t\u003cdiv class=\"panel-head\"\u003e\n\t\t//head\n\t\u003c/div\u003e\n\t\u003cdiv class=\"panel-content\"\u003e\n\t\t\u003cdiv class=\"panel-content-inner\"\u003e\n\t\t\t//the main content here \n\t\t\u003c/div\u003e\n\t\u003c/div\u003e\n\t\u003cdiv class=\"panel-foot\"\u003e\n\t\t//footer\n\t\u003c/div\u003e\n\u003c/div\u003e\n```\n\n\n###创建一个App：\n```\nvar MyApp=new iTouch({\n\t\tindexPanel:$(\"#index\"), //设定首页\n\t\tdebug: true\n\t});\n  \n//创建页面\nvar page1=MyApp.Panel.extend({\n\telement:$('#page_1'),\n\tinit: function(panel){\n\t\t//TODO\n\t}\n})\n\nvar page2=MyApp.Panel.extend({\n\ttemplate:$('#page_2'),\n\turl:'http://oklai.name/m/json/view.php',\n\tdataType: 'jsonp',\n\tinit: function(ele, panelObj){\n\t\t//TODO\n\t}\n})\n\nvar page3=MyApp.Panel.extend({\n\turl:'/m/card.html',\n\tdataType: 'html'\n})\n\n//绑定路由\nMyApp.Router.extend({\n\t'/list':page1,\n\t'/view':page2,\n\t'/card':page3\n});\n```\n\n#文档说明\n##iTouch实例\n###new iTouch(settings)\nreturn: *[itouch object]*  \n\n```\n//创建iTouch实例\nvar MyApp=new iTouch({\n\tindexPanel:$(\"#index\"),\n\tdebug: true\n});\n```\n\n####settings属性说明：  \n\n**indexPanel**  \n*[zepto object]*   \nDefault: $(\"#content \u003e .current\")[0]  \n设定首页面  \n\n**animation**   \n*[Boolean]*  \nDefault: true   \n开启或关闭页面切换动画效果  \n\n**defaultAnimation**   \n*[String]*  \nDefault: 'slideleft'    \n默认动画效果  \n\n**animationDelay**   \n*[Int]*  \nDefault: 400     \n动画缓动时间  \n\n**loadingStart**     \n*[Function]*  \nDefault: 创建loader效果    \n页面开始载入时执行方法，可以在这里重置默认的loader效果  \n\n**loadingEnd**     \n*[Function]*  \nDefault: 移除loader效果    \n页面载入结束时执行方法  \n\n**debug**     \n*[Boolean]*  \nDefault: false    \n开启关闭调试信息，开启后可以使用MyApp.log(msg)输出调试信息  \n\n###itouch对象属性说明：  \n```\nvar MyApp=new iTouch()\nconsole.log(MyApp)\n//return \t\n//{\n//\tPanel: *[Function]*,\n//\tRouter: *[Object]*,\n//\tgetParames: *[Function]*,\n//\tgoHome: *[Function]*,\n//\tgoBack: *[Function]*,\n//\tlog: *[Function]*\n//}\n```\n\n**Panel**  \nMyApp.Panel.extend(options)  \nreturn: *[panel object]*  \n页面对象  \n\n**Router**  \nMyApp.Router.extend(collection)  \nMyApp.Router.add(url, panel)  \n路由集合\n\n**getParames**  \nMyApp.getParames()  \nreturn: *[parames object]*  \n获取当前url参数  \n\n**goHome**  \nMyApp.goHome()  \n返回首页  \n\n**goBack**  \nMyApp.goBack()  \n返回上一页  \n\n**log**  \nMyApp.log(msg)  \n直接在页面上输出msg，用于调试应用  \n\n##创建页面对象\n###MyApp.Panel.extend(options)\n```\n//创建页面对象\nvar listPage=MyApp.Panel.extend({\n\telement:$('#list'),\n\tinit: function(){\n\t\t//TODO\n\t}\n});\t\n\t\nvar detailPage=MyApp.Panel.extend({\n\ttemplate:$('#Temp_detail'),\n\turl:'/m/itouch/example/json/detail.json',\n\tdataType: 'json',\n\tinit: function(element, panelObj){\n\t\t//TODO\n\t}\n});\t\n```\noptions属性说明：  \n\n**element**  \n*[zepto object]*  \nDefault: none  \n指定某个DOM元素为页面对象  \n\n**template**  \n*[zepto object]*  \nDefault: none  \n指定某个DOM元素的内容为一个模板，在获取数据后将生成一个页面并插入至App中。  \n注意：element属性与template必须设定其中一个，使用template属性时必须指定数据源。  \n\n**url**  \n*[String]*  \nDefault: none  \n数据源地址。使用模板生成页面时必须设定url。  \n\n**dataType**  \n*[String]*  \nDefault: json  \n数据类型。可选值有：json、jsonp、html  \n当dataType为html时，可以不设定element属性或template属性，将会把Ajax载入的html内容设为一个页面对象。  \n\n**init**  \n*[Function]*  \nDefault: none  \n回调函数，将在页面完成切换后执行，拥有两个参数。  \n第一个参数：*[zepto object]*,当前页面DOM对象  \n第二个参数：*[Panel object]*,页面模型对象\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foklai%2Fitouch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foklai%2Fitouch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foklai%2Fitouch/lists"}