diff --git a/example/pages/swipe-cell/index.js b/example/pages/swipe-cell/index.js index d6add432..2bce6e75 100644 --- a/example/pages/swipe-cell/index.js +++ b/example/pages/swipe-cell/index.js @@ -1,5 +1,6 @@ import Page from '../../common/page'; import Dialog from '../../dist/dialog/dialog'; +import Notify from '../../dist/notify/notify'; Page({ onClose(event) { @@ -17,5 +18,22 @@ Page({ }); break; } + }, + onOpen(event) { + const { position, name } = event.detail; + switch (position) { + case 'left': + Notify({ + type: 'primary', + message: `${name}${position}部分展示open事件被触发` + }); + break; + case 'right': + Notify({ + type: 'primary', + message: `${name}${position}部分展示open事件被触发` + }); + break; + } } }); diff --git a/example/pages/swipe-cell/index.wxml b/example/pages/swipe-cell/index.wxml index 30aece28..eab0b46a 100644 --- a/example/pages/swipe-cell/index.wxml +++ b/example/pages/swipe-cell/index.wxml @@ -18,4 +18,15 @@ + + + 选择 + + + + 删除 + + + + diff --git a/packages/swipe-cell/README.md b/packages/swipe-cell/README.md index d883d995..c92af5ae 100644 --- a/packages/swipe-cell/README.md +++ b/packages/swipe-cell/README.md @@ -57,6 +57,42 @@ Page({ }); ``` +### 主动打开 + +```html + + 选择 + + + + 删除 + +``` + +```js +Page({ + onOpen(event) { + const { position, name } = event.detail; + switch (position) { + case 'left': + Notify({ + type: 'primary', + message: `${name}${position}部分展示open事件被触发` + }); + break; + case 'right': + Notify({ + type: 'primary', + message: `${name}${position}部分展示open事件被触发` + }); + break; + } + } +}); +``` + + + ## API ### Props