提交 cb6dfd0c 编写于 作者: Dcloud_UNI_yuhe's avatar Dcloud_UNI_yuhe

Update uni-swipe-action.md

上级 de3a0cad
::: tip 组件名:uni-swipe-action ::: tip 组件名:uni-swipe-action
> 代码块: `uSwipeAction`、`uSwipeActionItem` > 代码块: `uSwipeAction`、`uSwipeActionItem`
...@@ -31,7 +30,7 @@ ...@@ -31,7 +30,7 @@
<view><text>置顶</text></view> <view><text>置顶</text></view>
</template> </template>
<view> <view>
<text >使用插槽</text> <text>使用插槽</text>
</view> </view>
<template v-slot:right> <template v-slot:right>
<view><text>删除</text></view> <view><text>删除</text></view>
...@@ -55,25 +54,25 @@ ...@@ -55,25 +54,25 @@
<!-- 按组使用 --> <!-- 按组使用 -->
<uni-swipe-action> <uni-swipe-action>
<uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, index)"> <uni-swipe-action-item :right-options="options" @click="onClick" @change="swipeChange($event, 0)">
<view >item1</view> <view>item1</view>
</uni-swipe-action-item> </uni-swipe-action-item>
<uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, index)"> <uni-swipe-action-item :right-options="options" @click="onClick" @change="swipeChange($event, 1)">
<view>item2</view> <view>item2</view>
</uni-swipe-action-item> </uni-swipe-action-item>
<uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, index)"> <uni-swipe-action-item :right-options="options" @click="onClick" @change="swipeChange($event, 2)">
<view>item3</view> <view>item3</view>
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
``` ```
```javascript ```javascript
export default { export default {
data(){ data() {
return { return {
options:[ options: [{
{
text: '取消', text: '取消',
style: { style: {
backgroundColor: '#007aff' backgroundColor: '#007aff'
...@@ -83,20 +82,23 @@ export default { ...@@ -83,20 +82,23 @@ export default {
style: { style: {
backgroundColor: '#dd524d' backgroundColor: '#dd524d'
} }
}]
} }
]
}
}, },
methods:{ methods: {
onClick(e){ onClick(e) {
console.log('点击了'+(e.position === 'left' ? '左侧' : '右侧') + e.content.text + '按钮') console.log('点击了' + (e.position === 'left' ? '左侧' : '右侧') + e.content.text + '按钮')
},
change(event) {
console.log('改变事件', event);
}, },
swipeChange(e,index){ swipeChange(e, index) {
console.log('当前状态:'+ e +',下标:' + index) console.log('当前状态:' + e + ',下标:' + index)
} }
} }
} }
``` ```
## API ## API
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册