Swipeout Vue Component
Swipeout List is not a separate component, but just a particular case of using <f7-list>, <f7-list-item swipeout> Vue components and additional Swipeout components.
Swipeout Vue component represents Framework7's Swipeout component.
Swipeout Components
There are following components included:
f7-swipeout-actions
- wrapper for swipeout buttonsf7-swipeout-button
- single swipeout button
Swipeout Properties
Prop | Type | Default | Description |
---|---|---|---|
<f7-swipeout-actions> Properties | |||
side | string | right | Swipeout actions side |
right | boolean | Shortcut for side="right" prop | |
left | boolean | Shortcut for side="left" prop | |
<f7-swipeout-button> Properties | |||
delete | boolean | false | Will automatically delete swipeout list item on click |
close | boolean | false | Will automatically close swipeout list item on click |
overswipe | boolean | false | Will be triggered click automatically if you swipe actions too much - overswipe |
text | string | Swipeout button text label | |
confirm-text | string | This text will be shown in dialog where user must agree before item delete | |
confirm-title | string | This text will be shown as dialog title where user must agree before item delete |
Swipeout Events
Event | Description |
---|---|
<f7-swipeout-button> events | |
click | Event will be triggered on swipeout button click |
<f7-list-item> events The following events will be available on <f7-list-item> with swipeout enabled | |
swipeout | Event will be triggered while you move swipeout element. event.detail.progress contains current opened progress percentage |
swipeout:open | Event will be triggered when swipeout element starts its opening animation |
swipeout:opened | Event will be triggered after swipeout element completes its opening animation |
swipeout:close | Event will be triggered when swipeout element starts its closing animation |
swipeout:closed | Event will be triggered after swipeout element completes its closing animation |
swipeout:delete | Event will be triggered after swipeout element starts its delete animation |
swipeout:deleted | Event will be triggered after swipeout element completes its delete animation right before it will be removed from DOM |
swipeout:overswipeenter | Event will be triggered when overswipe enabled |
swipeout:overswipeexit | Event will be triggered when overswipe disabled |
Examples
<template>
<f7-page @page:init="onPageInit">
<f7-navbar title="Swipeout"></f7-navbar>
<f7-block-title>Swipe to delete with confirm modal</f7-block-title>
<f7-list>
<f7-list-item
swipeout
title="Swipe left on me please"
>
<f7-swipeout-actions right>
<f7-swipeout-button delete confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="Swipe left on me too"
>
<f7-swipeout-actions right>
<f7-swipeout-button delete confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
title="I am not removable"
>
</f7-list-item>
</f7-list>
<f7-block-title>Swipe to delete without confirm</f7-block-title>
<f7-list>
<f7-list-item
swipeout
title="Swipe left on me please"
>
<f7-swipeout-actions right>
<f7-swipeout-button delete>Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="Swipe left on me too"
>
<f7-swipeout-actions right>
<f7-swipeout-button delete>Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item title="I am not removable">
</f7-list-item>
</f7-list>
<f7-block-title>Swipe for actions</f7-block-title>
<f7-list>
<f7-list-item
swipeout
title="Swipe left on me please"
>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
<f7-swipeout-button delete>Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="Swipe left on me too"
>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
<f7-swipeout-button delete>Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="You can't delete me"
>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
</f7-list>
<f7-block-title>With callback on remove</f7-block-title>
<f7-list>
<f7-list-item
swipeout
@swipeout:deleted="onDeleted"
title="Swipe left on me please"
>
<f7-swipeout-actions right>
<f7-swipeout-button delete>Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
@swipeout:deleted="onDeleted"
title="Swipe left on me too"
>
<f7-swipeout-actions right>
<f7-swipeout-button delete>Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item title="I am not removable">
</f7-list-item>
</f7-list>
<f7-block-title>With actions on left side (swipe to right)</f7-block-title>
<f7-list>
<f7-list-item
swipeout
title="Swipe right on me please"
>
<f7-swipeout-actions left>
<f7-swipeout-button color="green" @click="reply">Reply</f7-swipeout-button>
<f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="Swipe right on me too"
>
<f7-swipeout-actions left>
<f7-swipeout-button color="green" @click="reply">Reply</f7-swipeout-button>
<f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
</f7-list>
<f7-block-title>On both sides with overswipes</f7-block-title>
<f7-list media-list>
<f7-list-item
swipeout
title="Facebook"
after="17:14"
subtitle="New messages from John Doe"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
>
<f7-swipeout-actions left>
<f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
<f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
</f7-swipeout-actions>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
<f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
<f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="John Doe (via Twitter)"
after="17:11"
subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
>
<f7-swipeout-actions left>
<f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
<f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
</f7-swipeout-actions>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
<f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
<f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="Facebook"
after="16:48"
subtitle="New messages from John Doe"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
>
<f7-swipeout-actions left>
<f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
<f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
</f7-swipeout-actions>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
<f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
<f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
<f7-list-item
swipeout
title="John Doe (via Twitter)"
after="15:32"
subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
>
<f7-swipeout-actions left>
<f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
<f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
</f7-swipeout-actions>
<f7-swipeout-actions right>
<f7-swipeout-button @click="more">More</f7-swipeout-button>
<f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
<f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
</f7-swipeout-actions>
</f7-list-item>
</f7-list>
</f7-page>
</template>
<script>
export default {
methods: {
more() {
const self = this;
self.actions.open();
},
mark() {
const app = this.$f7;
app.dialog.alert('Mark');
},
reply() {
const app = this.$f7;
app.dialog.alert('Reply');
},
forward() {
const app = this.$f7;
app.dialog.alert('Forward');
},
onDeleted() {
const app = this.$f7;
app.dialog.alert('Thanks, item removed!');
},
onPageInit() {
const self = this;
const app = self.$f7;
self.actions = app.actions.create({
buttons: [
[
{
text: 'Here comes some optional description or warning for actions below',
label: true,
},
{
text: 'Action 1',
},
{
text: 'Action 2',
},
],
[
{
text: 'Cancel',
bold: true,
},
],
],
});
},
},
};
</script>