Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[ + ] add new param enable-swipe for ep-slider
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed May 15, 2021
1 parent fd2455f commit 6ca3b14
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Change Log

## 0.8.6
- [+] [wxc-ep-slider](https://apache.github.io/incubator-weex-ui/#/packages/wxc-ep-slider/) add `enable-swipe` param

## 0.8.5
- [!] wxc-dialog: 文档上补充上 `show` 参数
- [!] wxc-mask: 修正了单击“关闭”按钮和单击“覆盖”之间不一致行为的错误
- [+] wxc-pan-item: 使用元素前添加判断
- [!] wxc-dialog: supplement missing parameters ` show` in document
- [!] wxc-mask: fix bug that inconsistent behavior between clicking close button and clicking overlay
- [+] wxc-pan-item: add judgment before using element


## 0.8.4
Expand Down
10 changes: 7 additions & 3 deletions CHANGELOG_cn.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# 升级日志

## 0.8.6
- [+] [wxc-ep-slider](https://apache.github.io/incubator-weex-ui/#/cn/packages/wxc-ep-slider/) 增加 `enable-swipe` 参数


## 0.8.5
- [!] wxc-dialog: supplement missing parameters ` show` in document
- [!] wxc-mask: fix bug that inconsistent behavior between clicking close button and clicking overlay
- [+] wxc-pan-item: add judgment before using element
- [!] wxc-dialog: 文档上补充上 `show` 参数
- [!] wxc-mask: 修正了单击“关闭”按钮和单击“覆盖”之间不一致行为的错误
- [+] wxc-pan-item: 使用元素前添加判断

## 0.8.4
- [+] [wxc-lightbox](https://apache.github.io/incubator-weex-ui/#/cn/packages/wxc-lightbox/) 增加 `show-indicator` 参数控制是否显示indicator
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weex-ui",
"version": "0.8.5",
"version": "0.8.6",
"description": "A rich interaction, lightweight, high performance UI library based on Weex",
"main": "index.js",
"lib": "vue",
Expand Down
7 changes: 4 additions & 3 deletions packages/wxc-ep-slider/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# wxc-ep-slider
# wxc-ep-slider

> Binding Slider
Expand Down Expand Up @@ -101,21 +101,22 @@ More details can be found in [here](https://github.com/apache/incubator-weex-ui/
| card-s | `Object` | `Y`|`{width: 360,height: 300,spacing: 0,scale: 0.75}` | card style|
| auto-play | `Boolean` | `N`|`false` |whether is auto-play|
| interval | `Number` | `N`|`1200` |interval of auto-play|
| enable-swipe | `Boolean` | `N`|`true` |which can swipe|

### More

### Manually setting page

```
// <wxc-ep-slider ref="wxc-ep-slider"></wxc-ep-slider
this.$refs['wxc-ep-slider'].manualSetPage(1);
this.$refs['wxc-ep-slider'].manualSetPage(1);
```

### Rebind

```
// <wxc-ep-slider ref="wxc-ep-slider"></wxc-ep-slider
this.$refs['wxc-ep-slider'].rebind();
this.$refs['wxc-ep-slider'].rebind();
```

### Event
Expand Down
11 changes: 6 additions & 5 deletions packages/wxc-ep-slider/README_cn.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# wxc-ep-slider
# wxc-ep-slider

!> 这个富交互体验组件依赖于 [BindingX](https://alibaba.github.io/bindingx/) 特性,使用前请确定你的App [是否安装](https://github.com/alibaba/bindingx#installation)

> Weex Binding 效果的 slider 组件
### 规则
- 用于丰富 slide,包括商品橱窗,图片列表等
- 用于丰富 slide,包括商品橱窗,图片列表等
- **假如子组件有点击事件,在 Android 由于 [此约束](http://weex-project.io/cn/references/gesture.html#约束),目前需要在子元素里面绑定对应事件,Weex Ui 提供了 [wxc-pan-cell](https://github.com/apache/incubator-weex-ui/tree/master/packages/wxc-pan-item) 包裹器来解决此情况,具体可参考 [demo](https://github.com/apache/incubator-weex-ui/tree/master/example/ep-slider)**
- 支持滑到最右时候显示加载更多和事件回调,需要传入 `pull-more` slot,详细可见 demo

Expand Down Expand Up @@ -103,12 +103,13 @@
| card-s | `Object` | `Y`|`{width: 360,height: 300,spacing: 0,scale: 0.75}` | item容器的样式|
| auto-play | `Boolean` | `N`|`false` |是否需要自动播放|
| interval | `Number` | `N`|`1200` |自动播放时候的间隔|
| enable-swipe | `Boolean` | `N`|`true` |是否支持滑动|

### 渲染滑到最右时候的加载更多
```
// 样式需要自己根据个数和长度计算,详细参考 [demo](https://github.com/apache/incubator-weex-ui/blob/master/example/ep-slider/index.vue) 代码
<div class="more-slider"
slot="pull-more"
<div class="more-slider"
slot="pull-more"
:style="{left: `${cardLength * (cardSize.width + cardSize.spacing)+60}px`,marginLeft:`${(750 - cardSize.width) / 2}px`}">
<text>加载更多</text>
</div>
Expand All @@ -121,7 +122,7 @@
```
// 直接在wxc-ep-slider组件上面绑定ref="wxc-ep-slider",然后调用即可
// 譬如设置第二张
this.$refs['wxc-ep-slider'].manualSetPage(1);
this.$refs['wxc-ep-slider'].manualSetPage(1);
```

### Rebind
Expand Down
8 changes: 4 additions & 4 deletions packages/wxc-ep-slider/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ under the License.
},
methods: {
onPanStart (e) {
if (BindEnv.supportsEB()) {
if (!this.enableSwipe || BindEnv.supportsEB()) {
return;
}
this.clearAutoPlay();
this.startX = e.changedTouches[0].clientX;
this.startTime = Date.now();
},
onPanMove (e) {
if (BindEnv.supportsEB()) {
if (!this.enableSwipe || BindEnv.supportsEB()) {
return;
}
const moveX = e.changedTouches[0].clientX - this.startX;
Expand Down Expand Up @@ -203,7 +203,7 @@ under the License.
}
},
onEpPanStart (e) {
if (BindEnv.supportsEB() && e.state === 'start') {
if (this.enableSwipe && BindEnv.supportsEB() && e.state === 'start') {
this.clearAutoPlay();
setTimeout(() => {
const sliderCtn = this.$refs[`sliderCtn_${this.sliderId}`];
Expand All @@ -212,7 +212,7 @@ under the License.
}
},
onPanEnd (e) {
if (BindEnv.supportsEB()) {
if (!this.enableSwipe || BindEnv.supportsEB()) {
return;
}
this.panEnd(e);
Expand Down

0 comments on commit 6ca3b14

Please sign in to comment.