{"action":"created","comment":{"url":"https://api.github.com/repos/ElemeFE/element/pulls/comments/93721887","pull_request_review_id":14253400,"id":93721887,"diff_hunk":"@@ -1,9 +1,198 @@\n <template>\n-  <div class=\"el-carousel\"></div>\n+  <div\n+    class=\"el-carousel\"\n+    :class=\"{ 'is-card': card }\"\n+    @mouseenter.stop=\"handleMouseEnter\"\n+    @mouseleave.stop=\"handleMouseLeave\">\n+    <div\n+      class=\"el-carousel__container\"\n+      :style=\"{ height: height }\">\n+      <transition name=\"carousel-arrow-left\">\n+        <button\n+          v-if=\"showArrow !== 'never'\"\n+          v-show=\"showArrow === 'always' || hover\"\n+          :style=\"{\n+            height: `${ arrowSize }px`,\n+            width: `${ arrowSize }px`\n+          }\"\n+          @click.stop=\"throttledArrowClick(activeIndex - 1)\"\n+          class=\"el-carousel__arrow is-left\">\n+          <i class=\"el-icon-arrow-left\"></i>\n+        </button>\n+      </transition>\n+      <transition name=\"carousel-arrow-right\">\n+        <button\n+          v-if=\"showArrow !== 'never'\"\n+          v-show=\"showArrow === 'always' || hover\"\n+          :style=\"{\n+            height: `${ arrowSize }px`,\n+            width: `${ arrowSize }px`\n+          }\"\n+          @click.stop=\"throttledArrowClick(activeIndex + 1)\"\n+          class=\"el-carousel__arrow is-right\">\n+          <i class=\"el-icon-arrow-right\"></i>\n+        </button>\n+      </transition>\n+      <slot></slot>\n+    </div>\n+    <ul\n+      class=\"el-carousel__indicators\"\n+      v-if=\"showIndicator\"\n+      :class=\"{ 'is-out': indicatorPosition === 'out' || card }\">\n+      <li\n+        v-for=\"(item, index) in items\"\n+        class=\"el-carousel__indicator\"\n+        :class=\"{ 'is-active': index === activeIndex }\"\n+        @mouseenter=\"throttledIndicatorHover(index)\"\n+        @click.stop=\"handleIndicatorClick(index)\">\n+        <button class=\"el-carousel__button\"></button>\n+      </li>\n+    </ul>\n+  </div>\n </template>\n \n <script>\n+import throttle from 'throttle-debounce/throttle';\n+\n export default {\n-  name: 'ElCarousel'\n+  name: 'ElCarousel',\n+\n+  props: {\n+    initialIndex: {\n+      type: Number,\n+      default: 0\n+    },\n+    height: String,\n+    trigger: {\n+      type: String,\n+      default: 'hover'\n+    },\n+    arrowSize: {\n+      type: Number,\n+      default: 36\n+    },\n+    interval: {\n+      type: Number,\n+      default: 3000\n+    },\n+    indicatorPosition: String,\n+    showIndicator: {\n+      type: Boolean,\n+      default: true\n+    },\n+    showArrow: String,\n+    card: Boolean\n+  },\n+\n+  data() {\n+    return {\n+      items: [],\n+      activeIndex: -1,\n+      containerWidth: 0,\n+      reInitTimer: null,\n+      timer: null,\n+      hover: false\n+    };\n+  },\n+\n+  watch: {\n+    activeIndex(val, oldVal) {\n+      this.resetItemPosition();\n+      this.$emit('index-change', val, oldVal);\n+    }\n+  },\n+\n+  methods: {\n+    handleMouseEnter() {\n+      this.hover = true;\n+      this.pauseTimer();\n+    },\n+\n+    handleMouseLeave() {\n+      this.hover = false;\n+      this.startTimer();\n+    },\n+\n+    handleItemChange() {\n+      clearTimeout(this.reInitTimer);\n+      this.reInitTimer = setTimeout(() => {\n+        this.setItems();\n+      }, 100);\n+    },\n+\n+    setItems() {\n+      this.items = this.$children.filter(child => child.$options.name === 'ElCarouselItem');\n+    },\n+\n+    resetItemPosition() {\n+      this.items.forEach((item, index) => {\n+        item.translateItem(index, this.activeIndex);\n+      });\n+    },\n+\n+    autoPlay() {\n+      if (this.activeIndex < this.items.length - 1) {\n+        this.activeIndex++;\n+      } else {\n+        this.activeIndex = 0;\n+      }\n+    },\n+\n+    pauseTimer() {\n+      clearInterval(this.timer);\n+    },\n+\n+    startTimer() {\n+      if (this.interval <= 0) return;\n+      this.timer = setInterval(this.autoPlay, this.interval);\n+    },\n+\n+    setActiveIndex(index) {\n+      index = Number(index);\n+      if (isNaN(index)) return;","path":"packages/carousel/src/main.vue","position":154,"original_position":154,"commit_id":"533a14f066ca74c1d9bf35db7fc34cf466bc3b8c","original_commit_id":"533a14f066ca74c1d9bf35db7fc34cf466bc3b8c","user":{"login":"baiyaaaaa","id":3655403,"avatar_url":"https://avatars.githubusercontent.com/u/3655403?v=3","gravatar_id":"","url":"https://api.github.com/users/baiyaaaaa","html_url":"https://github.com/baiyaaaaa","followers_url":"https://api.github.com/users/baiyaaaaa/followers","following_url":"https://api.github.com/users/baiyaaaaa/following{/other_user}","gists_url":"https://api.github.com/users/baiyaaaaa/gists{/gist_id}","starred_url":"https://api.github.com/users/baiyaaaaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baiyaaaaa/subscriptions","organizations_url":"https://api.github.com/users/baiyaaaaa/orgs","repos_url":"https://api.github.com/users/baiyaaaaa/repos","events_url":"https://api.github.com/users/baiyaaaaa/events{/privacy}","received_events_url":"https://api.github.com/users/baiyaaaaa/received_events","type":"User","site_admin":false},"body":"8. 给个console.warn提示下应该用整形么","created_at":"2016-12-23T01:25:28Z","updated_at":"2016-12-23T01:28:00Z","html_url":"https://github.com/ElemeFE/element/pull/1931#discussion_r93721887","pull_request_url":"https://api.github.com/repos/ElemeFE/element/pulls/1931","_links":{"self":{"href":"https://api.github.com/repos/ElemeFE/element/pulls/comments/93721887"},"html":{"href":"https://github.com/ElemeFE/element/pull/1931#discussion_r93721887"},"pull_request":{"href":"https://api.github.com/repos/ElemeFE/element/pulls/1931"}}},"pull_request":{"url":"https://api.github.com/repos/ElemeFE/element/pulls/1931","id":99063764,"html_url":"https://github.com/ElemeFE/element/pull/1931","diff_url":"https://github.com/ElemeFE/element/pull/1931.diff","patch_url":"https://github.com/ElemeFE/element/pull/1931.patch","issue_url":"https://api.github.com/repos/ElemeFE/element/issues/1931","number":1931,"state":"open","locked":false,"title":"add carousel","user":{"login":"Leopoldthecoder","id":10095631,"avatar_url":"https://avatars.githubusercontent.com/u/10095631?v=3","gravatar_id":"","url":"https://api.github.com/users/Leopoldthecoder","html_url":"https://github.com/Leopoldthecoder","followers_url":"https://api.github.com/users/Leopoldthecoder/followers","following_url":"https://api.github.com/users/Leopoldthecoder/following{/other_user}","gists_url":"https://api.github.com/users/Leopoldthecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/Leopoldthecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leopoldthecoder/subscriptions","organizations_url":"https://api.github.com/users/Leopoldthecoder/orgs","repos_url":"https://api.github.com/users/Leopoldthecoder/repos","events_url":"https://api.github.com/users/Leopoldthecoder/events{/privacy}","received_events_url":"https://api.github.com/users/Leopoldthecoder/received_events","type":"User","site_admin":false},"body":"Please makes sure these boxes are checked before submitting your PR, thank you!\r\n\r\n* [ ] Make sure you follow Element's [Contributing Guide](https://github.com/ElemeFE/element/blob/master/.github/CONTRIBUTING.md).\r\n* [ ] Make sure you are merging your commits to `dev` branch.\r\n* [ ] Rebase before creating a PR to keep commit history clear.\r\n* [ ] Add some descriptions and refer relative issues for you PR.\r\n","created_at":"2016-12-22T08:12:19Z","updated_at":"2016-12-23T01:28:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b30e6bbfd595c71d8e88067fe306b2c2be46f458","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ElemeFE/element/pulls/1931/commits","review_comments_url":"https://api.github.com/repos/ElemeFE/element/pulls/1931/comments","review_comment_url":"https://api.github.com/repos/ElemeFE/element/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ElemeFE/element/issues/1931/comments","statuses_url":"https://api.github.com/repos/ElemeFE/element/statuses/533a14f066ca74c1d9bf35db7fc34cf466bc3b8c","head":{"label":"Leopoldthecoder:carousel","ref":"carousel","sha":"533a14f066ca74c1d9bf35db7fc34cf466bc3b8c","user":{"login":"Leopoldthecoder","id":10095631,"avatar_url":"https://avatars.githubusercontent.com/u/10095631?v=3","gravatar_id":"","url":"https://api.github.com/users/Leopoldthecoder","html_url":"https://github.com/Leopoldthecoder","followers_url":"https://api.github.com/users/Leopoldthecoder/followers","following_url":"https://api.github.com/users/Leopoldthecoder/following{/other_user}","gists_url":"https://api.github.com/users/Leopoldthecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/Leopoldthecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leopoldthecoder/subscriptions","organizations_url":"https://api.github.com/users/Leopoldthecoder/orgs","repos_url":"https://api.github.com/users/Leopoldthecoder/repos","events_url":"https://api.github.com/users/Leopoldthecoder/events{/privacy}","received_events_url":"https://api.github.com/users/Leopoldthecoder/received_events","type":"User","site_admin":false},"repo":{"id":67381051,"name":"element-1","full_name":"Leopoldthecoder/element-1","owner":{"login":"Leopoldthecoder","id":10095631,"avatar_url":"https://avatars.githubusercontent.com/u/10095631?v=3","gravatar_id":"","url":"https://api.github.com/users/Leopoldthecoder","html_url":"https://github.com/Leopoldthecoder","followers_url":"https://api.github.com/users/Leopoldthecoder/followers","following_url":"https://api.github.com/users/Leopoldthecoder/following{/other_user}","gists_url":"https://api.github.com/users/Leopoldthecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/Leopoldthecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leopoldthecoder/subscriptions","organizations_url":"https://api.github.com/users/Leopoldthecoder/orgs","repos_url":"https://api.github.com/users/Leopoldthecoder/repos","events_url":"https://api.github.com/users/Leopoldthecoder/events{/privacy}","received_events_url":"https://api.github.com/users/Leopoldthecoder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Leopoldthecoder/element-1","description":"Desktop UI elements for Vue.js 2.0","fork":true,"url":"https://api.github.com/repos/Leopoldthecoder/element-1","forks_url":"https://api.github.com/repos/Leopoldthecoder/element-1/forks","keys_url":"https://api.github.com/repos/Leopoldthecoder/element-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Leopoldthecoder/element-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Leopoldthecoder/element-1/teams","hooks_url":"https://api.github.com/repos/Leopoldthecoder/element-1/hooks","issue_events_url":"https://api.github.com/repos/Leopoldthecoder/element-1/issues/events{/number}","events_url":"https://api.github.com/repos/Leopoldthecoder/element-1/events","assignees_url":"https://api.github.com/repos/Leopoldthecoder/element-1/assignees{/user}","branches_url":"https://api.github.com/repos/Leopoldthecoder/element-1/branches{/branch}","tags_url":"https://api.github.com/repos/Leopoldthecoder/element-1/tags","blobs_url":"https://api.github.com/repos/Leopoldthecoder/element-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Leopoldthecoder/element-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Leopoldthecoder/element-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Leopoldthecoder/element-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Leopoldthecoder/element-1/statuses/{sha}","languages_url":"https://api.github.com/repos/Leopoldthecoder/element-1/languages","stargazers_url":"https://api.github.com/repos/Leopoldthecoder/element-1/stargazers","contributors_url":"https://api.github.com/repos/Leopoldthecoder/element-1/contributors","subscribers_url":"https://api.github.com/repos/Leopoldthecoder/element-1/subscribers","subscription_url":"https://api.github.com/repos/Leopoldthecoder/element-1/subscription","commits_url":"https://api.github.com/repos/Leopoldthecoder/element-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Leopoldthecoder/element-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Leopoldthecoder/element-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Leopoldthecoder/element-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Leopoldthecoder/element-1/contents/{+path}","compare_url":"https://api.github.com/repos/Leopoldthecoder/element-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Leopoldthecoder/element-1/merges","archive_url":"https://api.github.com/repos/Leopoldthecoder/element-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Leopoldthecoder/element-1/downloads","issues_url":"https://api.github.com/repos/Leopoldthecoder/element-1/issues{/number}","pulls_url":"https://api.github.com/repos/Leopoldthecoder/element-1/pulls{/number}","milestones_url":"https://api.github.com/repos/Leopoldthecoder/element-1/milestones{/number}","notifications_url":"https://api.github.com/repos/Leopoldthecoder/element-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Leopoldthecoder/element-1/labels{/name}","releases_url":"https://api.github.com/repos/Leopoldthecoder/element-1/releases{/id}","deployments_url":"https://api.github.com/repos/Leopoldthecoder/element-1/deployments","created_at":"2016-09-05T02:22:38Z","updated_at":"2016-10-24T03:12:33Z","pushed_at":"2016-12-22T11:30:15Z","git_url":"git://github.com/Leopoldthecoder/element-1.git","ssh_url":"git@github.com:Leopoldthecoder/element-1.git","clone_url":"https://github.com/Leopoldthecoder/element-1.git","svn_url":"https://github.com/Leopoldthecoder/element-1","homepage":"","size":2990,"stargazers_count":0,"watchers_count":0,"language":"Vue","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ElemeFE:1.1","ref":"1.1","sha":"c20f5e944283d1c0927ebf9daccafb325dd86b63","user":{"login":"ElemeFE","id":12810740,"avatar_url":"https://avatars.githubusercontent.com/u/12810740?v=3","gravatar_id":"","url":"https://api.github.com/users/ElemeFE","html_url":"https://github.com/ElemeFE","followers_url":"https://api.github.com/users/ElemeFE/followers","following_url":"https://api.github.com/users/ElemeFE/following{/other_user}","gists_url":"https://api.github.com/users/ElemeFE/gists{/gist_id}","starred_url":"https://api.github.com/users/ElemeFE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElemeFE/subscriptions","organizations_url":"https://api.github.com/users/ElemeFE/orgs","repos_url":"https://api.github.com/users/ElemeFE/repos","events_url":"https://api.github.com/users/ElemeFE/events{/privacy}","received_events_url":"https://api.github.com/users/ElemeFE/received_events","type":"Organization","site_admin":false},"repo":{"id":67274736,"name":"element","full_name":"ElemeFE/element","owner":{"login":"ElemeFE","id":12810740,"avatar_url":"https://avatars.githubusercontent.com/u/12810740?v=3","gravatar_id":"","url":"https://api.github.com/users/ElemeFE","html_url":"https://github.com/ElemeFE","followers_url":"https://api.github.com/users/ElemeFE/followers","following_url":"https://api.github.com/users/ElemeFE/following{/other_user}","gists_url":"https://api.github.com/users/ElemeFE/gists{/gist_id}","starred_url":"https://api.github.com/users/ElemeFE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElemeFE/subscriptions","organizations_url":"https://api.github.com/users/ElemeFE/orgs","repos_url":"https://api.github.com/users/ElemeFE/repos","events_url":"https://api.github.com/users/ElemeFE/events{/privacy}","received_events_url":"https://api.github.com/users/ElemeFE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ElemeFE/element","description":"A Vue.js 2.0 UI Toolkit for Web","fork":false,"url":"https://api.github.com/repos/ElemeFE/element","forks_url":"https://api.github.com/repos/ElemeFE/element/forks","keys_url":"https://api.github.com/repos/ElemeFE/element/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ElemeFE/element/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ElemeFE/element/teams","hooks_url":"https://api.github.com/repos/ElemeFE/element/hooks","issue_events_url":"https://api.github.com/repos/ElemeFE/element/issues/events{/number}","events_url":"https://api.github.com/repos/ElemeFE/element/events","assignees_url":"https://api.github.com/repos/ElemeFE/element/assignees{/user}","branches_url":"https://api.github.com/repos/ElemeFE/element/branches{/branch}","tags_url":"https://api.github.com/repos/ElemeFE/element/tags","blobs_url":"https://api.github.com/repos/ElemeFE/element/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ElemeFE/element/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ElemeFE/element/git/refs{/sha}","trees_url":"https://api.github.com/repos/ElemeFE/element/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ElemeFE/element/statuses/{sha}","languages_url":"https://api.github.com/repos/ElemeFE/element/languages","stargazers_url":"https://api.github.com/repos/ElemeFE/element/stargazers","contributors_url":"https://api.github.com/repos/ElemeFE/element/contributors","subscribers_url":"https://api.github.com/repos/ElemeFE/element/subscribers","subscription_url":"https://api.github.com/repos/ElemeFE/element/subscription","commits_url":"https://api.github.com/repos/ElemeFE/element/commits{/sha}","git_commits_url":"https://api.github.com/repos/ElemeFE/element/git/commits{/sha}","comments_url":"https://api.github.com/repos/ElemeFE/element/comments{/number}","issue_comment_url":"https://api.github.com/repos/ElemeFE/element/issues/comments{/number}","contents_url":"https://api.github.com/repos/ElemeFE/element/contents/{+path}","compare_url":"https://api.github.com/repos/ElemeFE/element/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ElemeFE/element/merges","archive_url":"https://api.github.com/repos/ElemeFE/element/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ElemeFE/element/downloads","issues_url":"https://api.github.com/repos/ElemeFE/element/issues{/number}","pulls_url":"https://api.github.com/repos/ElemeFE/element/pulls{/number}","milestones_url":"https://api.github.com/repos/ElemeFE/element/milestones{/number}","notifications_url":"https://api.github.com/repos/ElemeFE/element/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ElemeFE/element/labels{/name}","releases_url":"https://api.github.com/repos/ElemeFE/element/releases{/id}","deployments_url":"https://api.github.com/repos/ElemeFE/element/deployments","created_at":"2016-09-03T06:19:26Z","updated_at":"2016-12-23T01:11:55Z","pushed_at":"2016-12-22T16:55:25Z","git_url":"git://github.com/ElemeFE/element.git","ssh_url":"git@github.com:ElemeFE/element.git","clone_url":"https://github.com/ElemeFE/element.git","svn_url":"https://github.com/ElemeFE/element","homepage":"http://element.eleme.io/","size":8331,"stargazers_count":6262,"watchers_count":6262,"language":"Vue","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":855,"mirror_url":null,"open_issues_count":88,"forks":855,"open_issues":88,"watchers":6262,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/ElemeFE/element/pulls/1931"},"html":{"href":"https://github.com/ElemeFE/element/pull/1931"},"issue":{"href":"https://api.github.com/repos/ElemeFE/element/issues/1931"},"comments":{"href":"https://api.github.com/repos/ElemeFE/element/issues/1931/comments"},"review_comments":{"href":"https://api.github.com/repos/ElemeFE/element/pulls/1931/comments"},"review_comment":{"href":"https://api.github.com/repos/ElemeFE/element/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ElemeFE/element/pulls/1931/commits"},"statuses":{"href":"https://api.github.com/repos/ElemeFE/element/statuses/533a14f066ca74c1d9bf35db7fc34cf466bc3b8c"}}}}
{"actor":{"display_login":"baiyaaaaa"}}