{"name":"rax-slider","version":"3.1.3","description":"Slider component for Rax.","license":"BSD-3-Clause","main":"lib/index.js","module":"es/index.js","types":"lib/index.d.ts","exports":{".":{"web":"./es/web/index.js","weex":"./es/weex/index.js","miniapp":"./es/miniapp-runtime/index.js","wechat-miniprogram":"./es/miniapp-runtime/index.js","bytedance-microapp":"./es/miniapp-runtime/index.js","baidu-smartprogram":"./es/miniapp-runtime/index.js","kuaishou-miniprogram":"./es/miniapp-runtime/index.js","default":"./es/index.js"},"./*":"./*"},"miniprogram":".","miniappConfig":{"main":"lib/miniapp-native/ali-miniapp/index","main:wechat":"lib/miniapp-native/wechat-miniprogram/index","main:bytedance":"lib/miniapp-native/bytedance-microapp/index","subComponents":{"Item":{"tagNameMap":"swiper-item"}},"main:quickapp":"lib/miniapp-native/quickapp/index"},"scripts":{"build":"../../node_modules/.bin/build-scripts build --config ../../build.json --skip-demo","start":"../../node_modules/.bin/build-scripts start --config ../../build.json","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/raxjs/rax-components.git"},"bugs":{"url":"https://github.com/raxjs/rax-components/issues"},"homepage":"https://github.com/raxjs/rax-components#readme","keywords":["Rax","rax-component","react-component"],"dependencies":{"classnames":"^2.2.6","prop-types":"^15.7.2","rax-children":"^1.0.0","rax-clone-element":"^1.0.0","rax-find-dom-node":"^1.0.0","rax-view":"^2.0.0","universal-env":"^3.2.0","universal-panresponder":"^0.6.5"},"peerDependencies":{"rax":"^1.1.0"},"devDependencies":{"@types/rax":"^1.0.0","driver-universal":"^3.1.0","rax":"^1.1.0","rax-image":"^2.2.0","rax-test-renderer":"^1.0.0","typescript":"^3.7.5"},"_id":"rax-slider@3.1.3","_nodeVersion":"10.24.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-ERZVy34NrlMksYCz6l//CL6hjkZ/ISrSDG6GHnOnspyk7myzUvqFG9jJPVO7r+CQ5YO92kToXCS0HT2qaVU1OQ==","shasum":"e692c95fd1e40fdff0b5841cd9f574a112349fdf","tarball":"http://registry-npm.ywwl.com/rax-slider/download/rax-slider-3.1.3.tgz","fileCount":110,"unpackedSize":189683,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg98RJCRA9TVsSAnZWagAAHawQAJXJ2YnAXZumv3cVzKrn\noDeQWn4VUrinirzmsB1nIxiGd4l7Xcrr42VGbhWneDL2yHBWIM+gJKzP0hRX\nkV8eeFw/4E1Z5MEUKkPPMe9hhGGsCJ8H691TwwgclRp3YtC64AnP+KRT+Heu\nObw5WpZcLzRGnKrf4AH1PfgHfdRoU7uXWR4z4vTv1L4KTzgzfTjpztKf3xX5\nFfAu4qp3U4Mf4WOeSfhntxDdOU9R5BTiMYk+K5yWYcxd3QCZLo+LSNPiDfZU\nrmF5Q551BY9niGzqWj4gMmeSfTf6Fp8HNq/V0PtViGqGzuT8SN9lNorgZfIQ\nCfM+RwGfxHajpXEVP3BcPDU4DdRTgxVmsQKi23jZeyII59qROzDOCpFsZCUs\nvrZfb4Qc9iyA5wO6n9M3rxCzfGduuPMWkCZ9yh5ZDwFxiHsEVS0W2g5AAyho\nxQoH7RfCBIRlOosNzo/JJYr/wXTwwmjZ/+uDOzN8GTDewxcOFsP9Icdr9ozb\nsqk7hxva9El13RMImnQ1MKUr1L07fn3Rjs75hSeLucK1rRJqxYuHyjCCTSbS\n5ZLYyoCWRTJdyiItvLEPx1KQUu+4g2X0iAnz4enh9xCTnJrQqhjorY6ywh5t\n3T/KHz8geQyV7SwM9SuNxsX9AUKlM+hcHMV5EL+ayRxEvd9TLGA+IGTnlXgz\no6oU\r\n=E3nc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIELh6LCR1+kDwSF5Bkqr/KyejAZU4pWMcPFjAy8/vBrWAiANuboI8Z/viEljLq4jyCfh9hFexI7zidSVmPWmhT9bgA=="}],"size":33213,"noattachment":false,"key":"/rax-slider/-/rax-slider-3.1.3.tgz"},"_npmUser":{"name":"rax-publisher","email":"rax-public@alibaba-inc.com"},"directories":{},"maintainers":[{"name":"rax-publisher","email":"rax-public@alibaba-inc.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rax-slider_3.1.3_1626850377411_0.785124472968167"},"_hasShrinkwrap":false,"readme":"# rax-slider\n\n[![npm](https://img.shields.io/npm/v/rax-slider.svg)](https://www.npmjs.com/package/rax-slider)\n\n> Web 场景推荐使用 [rax-swiper](https://github.com/raxjs/rax-components/blob/master/packages/rax-swiper/README.md)\n>\n> rax-slider 由于历史原因，可能存在一些问题，非内联样式场景强烈推荐使用 [rax-swiper](https://github.com/raxjs/rax-components/blob/master/packages/rax-swiper/README.md)！\n\n## 支持\n\nWeb / Weex / 阿里小程序 / 微信小程序 / 字节跳动小程序\n\n## 描述\n\n轮播组件，就是以幻灯片的方式，在页面中横向展示诸多内容的组件。 轮播内容相互独立，前后在内容以及数据上都不存在逻辑关系。\n\n## 安装\n\n```bash\n$ npm install rax-slider --save\n```\n\n## 属性\n\n1. Web 环境中 slider 内部默认做了节点的懒加载渲染，不再需要使用 picture 的`lazyload`做懒加载\n2. `paginationStyle`中`itemColor` 用来定义分页原点的颜色，`itemSelectedColor` 用来定义分页原点激活时的颜色，`itemSize`用来定义分页圆点的大小，小程序只支持设置 `itemColor` `用来定义分页原点的颜色，itemSelectedColor`。快应用只支持`itemColor`、`itemSelectedColor`、`itemSize`三个用来定义分页圆点的样式。默认样式如下：\n\n```js\n{\n  position: 'absolute',\n  width: '40rpx',\n  height: '40rpx',\n  bottom: '20rem',\n  left: 0,\n  itemColor: 'rgba(255, 255, 255, 0.5)',\n  itemSelectedColor: 'rgb(255, 80, 0)',\n  itemSize: '8rpx'\n}\n```\n\n| **属性**         | **类型**   | **默认值** | **必填** | **描述**                                    | **支持**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| ---------------- | ---------- | ---------- | -------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| width            | `string`   | -          | 是       | Slider 的宽度                               | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" /><img alt=\"quickApp\" src=\"https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg\" width=\"25px\" height=\"25px\">  |\n| height           | `string`   | -          | 是       | Slider 的高度                               | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" /><img alt=\"quickApp\" src=\"https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg\" width=\"25px\" height=\"25px\">  |\n| autoPlay         | `boolean`  | false      | 否       | 是否自动播放                                | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" /><img alt=\"quickApp\" src=\"https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg\" width=\"25px\" height=\"25px\">  |\n| showsPagination  | `boolean`  | true       | 否       | 是否显示指示点                              | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" />                                                                                                                         |\n| paginationStyle  | `object`   | -          | 否       | 自己定义指示点的样式，否则默认样式居中      | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" />                                                                                                                         |\n| loop             | `boolean`  | true       | 否       | 是否是循环播放                              | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"quickApp\" src=\"https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg\" width=\"25px\" height=\"25px\"> |\n| index            | `number`   | 0          | 否       | 指定默认初始化第几页                        | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" />                                                                                                                         |\n| autoPlayInterval | `number`   | 3000       | 否       | 自动播放的间隔时间                          | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" />                                                                                                                         |\n| onChange         | `function` | -          | 否       | `index` 改变时会触发                        | <img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"weex\" src=\"https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"quickApp\" src=\"https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg\" width=\"25px\" height=\"25px\"> |\n| direction        | `string`   | horizontal | 否       | Slider 滚动方向 (`horizontal` / `vertical`) | <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\"><img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" /> <img alt=\"quickApp\" src=\"https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg\" width=\"25px\" height=\"25px\">                                                                                                                                                                                                                                                |\n\n## 方法\n\n### `Slider.slideTo(index: number)`\n\n#### 参数\n\n| **属性** | **类型** | **默认值** | **必填** | **描述**              |\n| -------- | -------- | ---------- | -------- | --------------------- |\n| index    | `number` | -          | 是       | 滚动到指定索引的 View |\n\n## Slider.Item\n\n每一个需要被轮播的子元素需要被包裹在 `Slider.Item` 组件中，在 Weex 和 Web 该组件是 `Fragment` 空节点，在小程序该组件是 `swiper-item`。由于该节点没有实际意义，所以不要在该组件上设置样式和绑定事件。 如果只在 Web 和 Weex 中使用，每一个需要轮播的子项**无需**包裹 `Slider.Item` 组件。\n\n## 示例\n\n```jsx\nimport { createElement, Component, render, createRef } from 'rax';\nimport View from 'rax-view';\nimport Image from 'rax-image';\nimport Slider from 'rax-slider';\nimport DriverUniversal from 'driver-universal';\n\nclass App extends Component {\n  constructor(props) {\n    super(props);\n\n    this.inputRef = createRef();\n  }\n\n  onchange = (index) => {\n    console.log('change', index);\n  };\n\n  onClick = () => {\n    this.inputRef.current.slideTo(0);\n  };\n\n  render() {\n    return (\n      <View>\n        <Slider\n          className=\"slider\"\n          width=\"750\"\n          height=\"500\"\n          style={styles.slider}\n          autoPlay={true}\n          loop={true}\n          showsPagination={true}\n          paginationStyle={styles.paginationStyle}\n          autoplayTimeout={3000}\n          onChange={this.onchange}\n          ref={this.inputRef}\n        >\n          <Slider.Item>\n            <View style={styles.itemWrap}>\n              <Image\n                style={styles.image}\n                source={{\n                  height: 500,\n                  width: 375,\n                  uri: '//gw.alicdn.com/tfs/TB19NbqKFXXXXXLXVXXXXXXXXXX-750-500.png',\n                }}\n              />\n            </View>\n          </Slider.Item>\n          <Slider.Item>\n            <View style={styles.itemWrap}>\n              <Image\n                style={styles.image}\n                source={{\n                  height: 500,\n                  width: 375,\n                  uri: '//gw.alicdn.com/tfs/TB1tWYBKFXXXXatXpXXXXXXXXXX-750-500.png',\n                }}\n              />\n            </View>\n          </Slider.Item>\n          <Slider.Item>\n            <View style={styles.itemWrap}>\n              <Image\n                style={styles.image}\n                source={{\n                  height: 500,\n                  width: 375,\n                  uri: '//gw.alicdn.com/tfs/TB1SX_vKFXXXXbyXFXXXXXXXXXX-750-500.png',\n                }}\n              />\n            </View>\n          </Slider.Item>\n        </Slider>\n\n        <View onClick={this.onClick}>Click</View>\n      </View>\n    );\n  }\n}\n\nconst styles = {\n  slider: {\n    width: 750,\n    position: 'relative',\n    overflow: 'hidden',\n    height: 500,\n    backgroundColor: '#cccccc',\n  },\n  itemWrap: {\n    width: 750,\n    height: 500,\n  },\n  image: {\n    width: 750,\n    height: 500,\n  },\n  button: {\n    marginTop: 20,\n    width: 340,\n    height: 80,\n  },\n  paginationStyle: {\n    position: 'absolute',\n    width: 750,\n    height: 40,\n    bottom: 20,\n    left: 0,\n    itemColor: 'rgba(255, 255, 255, 0.5)',\n    itemSelectedColor: 'rgb(255, 80, 0)',\n    itemSize: 16,\n  },\n};\n\nrender(<App />, document.body, { driver: DriverUniversal });\n```\n","publish_time":1626850377604,"_cnpm_publish_time":1626850377604,"dist-tags":{"beta":"3.1.6-beta.1","latest":"3.1.6"}}