{"id":20698809,"url":"https://github.com/rwson/swipe-left","last_synced_at":"2026-04-02T02:20:41.384Z","repository":{"id":87105741,"uuid":"81827840","full_name":"rwson/swipe-left","owner":"rwson","description":"左滑菜单组件","archived":false,"fork":false,"pushed_at":"2017-02-14T01:27:44.000Z","size":223,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T19:11:24.278Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rwson.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-13T13:26:39.000Z","updated_at":"2019-07-01T06:27:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd20bef4-1d26-48d0-9f2b-ba278c66b69b","html_url":"https://github.com/rwson/swipe-left","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/rwson%2Fswipe-left","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2Fswipe-left/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2Fswipe-left/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2Fswipe-left/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwson","download_url":"https://codeload.github.com/rwson/swipe-left/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250331053,"owners_count":21413092,"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-11-17T00:27:00.588Z","updated_at":"2026-04-02T02:20:41.300Z","avatar_url":"https://github.com/rwson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swipe-left\n左滑菜单组件\n\n\n![效果](screen.gif)\n\n### Usage\n\n    import SwipeLeft from \"./SwipeLeft\";\n    \n    const sl = new SwipeLeft();\n    \n    sl.init(selector(String), Array.\u003cObject\u003e);\n\n    demo:\n    \n    import SwipeLeft from \"./SwipeLeft\";\n\n    //  实例化一个SwipeLeft对象\n    const sl = new SwipeLeft();\n    \n    //  配置参数, menus\n    sl.init(\".menus\", {\n        menus: [{\n            \"text\": \"删除\",\n            \"classes\": [\"on\", \"test\"],\n            \"css\": {\n            \t\"font-size\": \"14px\",\n            \t\"width\": \"100px\",\n            \t\"background-color\": \"red\"\n            },\n            handler: (e) =\u003e {\n            \tif(confirm(\"你确定删除此项吗?\")) {\n            \t\te.el.parentNode.parentNode.removeChild(e.el.parentNode);\n            \t}\n            }\n        }, {\n            \"text\": \"新增\",\n            \"classes\": \"text-calss\",\n            \"css\": {\n            \t\"font-size\": \"14px\",\n            \t\"background-color\": \"green\"\n            },\n            handler: (e) =\u003e {\n            \talert(\"即将新增一项\");\n            }\n        }]\n    });\n\n\n### 参数解释\n\n属性名 | 参数类型 | 默认值 | 意义\n---|---|---|---\ntext | String | N/A | 显示在菜单按钮上的文字\nclasses | Array.\u003cString\u003e/String | N/A | 自定义样式类, 当为数组时,表示同时添加多个样式类\ncss | Object | {} | 自定义样式\nhandler | Function | function() {} | 菜单项被轻击之后的函数响应\n\n\n####  注:\n\n本项目中的事件依赖于本人的另一项目([Toucher](https://github.com/rwson/Toucher))实现\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwson%2Fswipe-left","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwson%2Fswipe-left","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwson%2Fswipe-left/lists"}