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

Update uni-swipe-action.md

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