{"action":"created","issue":{"url":"https://api.github.com/repos/ustbhuangyi/better-scroll/issues/473","repository_url":"https://api.github.com/repos/ustbhuangyi/better-scroll","labels_url":"https://api.github.com/repos/ustbhuangyi/better-scroll/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/ustbhuangyi/better-scroll/issues/473/comments","events_url":"https://api.github.com/repos/ustbhuangyi/better-scroll/issues/473/events","html_url":"https://github.com/ustbhuangyi/better-scroll/issues/473","id":301678274,"number":473,"title":"better-scroll 中点击触发2次事件","user":{"login":"wjryours","id":25095045,"avatar_url":"https://avatars0.githubusercontent.com/u/25095045?v=4","gravatar_id":"","url":"https://api.github.com/users/wjryours","html_url":"https://github.com/wjryours","followers_url":"https://api.github.com/users/wjryours/followers","following_url":"https://api.github.com/users/wjryours/following{/other_user}","gists_url":"https://api.github.com/users/wjryours/gists{/gist_id}","starred_url":"https://api.github.com/users/wjryours/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjryours/subscriptions","organizations_url":"https://api.github.com/users/wjryours/orgs","repos_url":"https://api.github.com/users/wjryours/repos","events_url":"https://api.github.com/users/wjryours/events{/privacy}","received_events_url":"https://api.github.com/users/wjryours/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-02T07:36:26Z","updated_at":"2018-03-02T09:33:48Z","closed_at":"2018-03-02T09:33:48Z","author_association":"NONE","body":"better-scroll 版本号1.8.2 \r\n代码简单的结构\r\n\r\n```\r\n<template>\r\n\t<div class=\"test\" ref=\"test\">\r\n\t\t<div class=\"wrapper\">\r\n\t\t\t<div class=\"text_item\" v-show=\"reload\">\r\n\t\t\t\t刷新中....\r\n\t\t\t</div>\r\n\t\t\t<div class=\"tabw\">\r\n\t\t\t\t<div class=\"tabwrapper\" ref=\"tabwrapper\">\r\n\t\t\t\t\t<div class=\"tab\" ref=\"tab\">\r\n\t\t\t\t\t\t<div class=\"tabitem\" ref=\"tabitem\" v-for=\"(item,index) in TabList\" @click=\"alert\"> \r\n\t\t\t\t\t\t\t{{item.name}}\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"icon\" @click=\"alert\">\r\n\t                  <span>图标</span>\r\n\t            </div>\r\n            \t<div class=\"adress\" @click=\"alert\">\r\n                    <span>位置</span>\r\n            \t</div>\t\r\n\t\t\t</div>\r\n\t\t\t\t\t\r\n\t\t\t<div class=\"text_item\" v-for=\"(item,index) in list\"  @click=\"ToLink\">\r\n\t\t\t\t{{index}}\r\n\t\t\t</div>\r\n\t\t\t<div class=\"text_item\" v-show=\"moreload\">\r\n\t\t\t\t加载中....\r\n\t\t\t</div>\r\n\t\t</div>\t\r\n\t</div>\r\n</template>\r\n```\r\n\r\n\r\n```\r\n<script>\r\nimport BScroll from 'better-scroll'\r\nexport default{\r\n\tdata(){\r\n\t\treturn{\r\n\t\t\tlist:[1,1,2,12,1,21,12,1,2,123,12,3],\r\n\t\t\treload:false,\r\n\t\t\tmoreload:false,\r\n\t\t\tTabList:[\r\n\t\t\t\t{\r\n                    name:'标题1',\r\n                    type:'redpack',\r\n                    id:0,\r\n                    hasRedpack:false\r\n                },\r\n                {\r\n                    name:'标题2',\r\n                    type:'article',\r\n                    id:0,\r\n                    hasRedpack:false\r\n                }\r\n\t\t\t]\r\n\t\t}\t\r\n\t},\r\n\tcreated(){\r\n\t\t\r\n\t},\r\n\tmounted(){\r\n\t\tthis.InitListScroll()\r\n\t\tthis.GetTab()\r\n\t\t\r\n\t},\r\n\tmethods:{\r\n\t\talert(event){\r\n\t\t\t\r\n\t\t\tconsole.log(event)\r\n\t\t\tconsole.log('123')\r\n\t\t},\r\n\t\tToLink(){\r\n\t\t\twindow.location='https://segmentfault.com/a/1190000013331105'\r\n\t\t},\r\n\t\tScrollToTab(index){\r\n\t\t\tthis.$nextTick(()=>{\r\n\t\t\t\tthis.scrollTab.scrollToElement(this.$refs.tabitem[index],500,-57)\r\n\t\t\t})\r\n\t\t},\r\n\t\tGetTab(){\r\n\t\t\tthis.$http({\r\n                method:'GET',\r\n                url:'./static/json/data.json'\r\n            }).then((res)=>{\r\n             \tthis.TabList=this.TabList.concat(res.data.data)\r\n             \t\r\n\t\t\t\tthis.$nextTick(()=>{\r\n\t\t\t\t\tlet width=0           \t\r\n\t\t\t\t\tfor (let i=0; i <this.TabList.length; i++) {\r\n\t\t\t\t\t\twidth+=this.$refs.tabitem[i].getBoundingClientRect().width\r\n\t\t\t\t\t}\r\n\t\t\t\t\twidth= width+102\r\n\t\t\t\t\tthis.$refs.tab.style.width=width+'px'\r\n\t\t\t\t\tif (!this.scrollTab) {\r\n\t\t\t\t\t\tthis.scrollTab=new BScroll(this.$refs.tabwrapper, {\r\n\t\t\t\t\t\t\tstartX:0,\r\n\t\t        \t\t\tclick:true,\r\n\t\t        \t\t\tscrollX:true,\r\n\t\t        \t\t\tscrollY:false,\r\n\t\t        \t\t\teventPassthrough:'vertical'\r\n        \t\t\t\t})\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tthis.scrollTab.refresh()\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n            })\r\n\t\t},\r\n\t\tInitListScroll(){\r\n\t\t\tthis.$nextTick(()=>{\r\n\t\t\t\tif (!this.scrollList) {\r\n\t\t\t\t\tthis.$refs.test.style.height=document.documentElement.clientHeight + 'px'\r\n\t\t\t\t\tthis.scrollList=new BScroll(this.$refs.test, {\r\n\t        \t\t\tclick:true,\r\n\t        \t\t\tscrollY:true,\r\n\t        \t\t\tstartY:0,\r\n\t        \t\t\tpullUpLoad:{\r\n                          threshold: -70, // 负值是当上拉到超过低部 70px；正值是距离底部距离 时，                    \r\n                      \t},\r\n                      \tpullDownRefresh: {\r\n\t\t\t\t\t\t  threshold: 50,\r\n\t\t\t\t\t\t  stop: 200\r\n\t\t\t\t\t\t}\r\n    \t\t\t\t})\r\n    \t\t\t\tthis.scrollList.on('pullingUp',(pos)=>{       \t\t\t\t\r\n    \t\t\t\t\tconsole.log('上拉加载')\r\n    \t\t\t\t\tthis.LoadMoreData()\r\n    \t\t\t\t})\r\n    \t\t\t\tthis.scrollList.on('pullingDown',(pos)=>{       \t\t\t\t\r\n    \t\t\t\t\tconsole.log('下拉刷新')\r\n    \t\t\t\t\tthis.RefreshData()\r\n    \t\t\t\t})\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthis.scrollList.refresh()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t},\r\n\t\tRefreshData(){\r\n\t\t\t\r\n\t\t},\r\n\t\tLoadMoreData(){\r\n\t\t\r\n\t\t},\r\n\t}\r\n}\t\r\n</script>\r\n```\r\n在手机和开发工具中点击触发alert（）事件也会重复触发2次\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ustbhuangyi/better-scroll/issues/comments/369870123","html_url":"https://github.com/ustbhuangyi/better-scroll/issues/473#issuecomment-369870123","issue_url":"https://api.github.com/repos/ustbhuangyi/better-scroll/issues/473","id":369870123,"user":{"login":"ustbhuangyi","id":5359011,"avatar_url":"https://avatars3.githubusercontent.com/u/5359011?v=4","gravatar_id":"","url":"https://api.github.com/users/ustbhuangyi","html_url":"https://github.com/ustbhuangyi","followers_url":"https://api.github.com/users/ustbhuangyi/followers","following_url":"https://api.github.com/users/ustbhuangyi/following{/other_user}","gists_url":"https://api.github.com/users/ustbhuangyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ustbhuangyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ustbhuangyi/subscriptions","organizations_url":"https://api.github.com/users/ustbhuangyi/orgs","repos_url":"https://api.github.com/users/ustbhuangyi/repos","events_url":"https://api.github.com/users/ustbhuangyi/events{/privacy}","received_events_url":"https://api.github.com/users/ustbhuangyi/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T09:33:48Z","updated_at":"2018-03-02T09:33:48Z","author_association":"OWNER","body":"请按 issue 规范提"}}
{"actor":{"display_login":"ustbhuangyi"}}