Swipeout - 图1

Swipeout Vue Component

Swipeout List is not a separate component, but just a particular case of using , 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 buttons
  • **f7-swipeout-button** - single swipeout button

Swipeout Properties

PropTypeDefaultDescription
<f7-swipeout-actions> Properties
sidestringrightSwipeout actions side
rightbooleanShortcut for side=”right” prop
leftbooleanShortcut for side=”left” prop
<f7-swipeout-button> Properties
deletebooleanfalseWill automatically delete swipeout list item on click
closebooleanfalseWill automatically close swipeout list item on click
overswipebooleanfalseWill be triggered click automatically if you swipe actions too much - overswipe
textstringSwipeout button text label
confirmTextstringThis text will be shown in dialog where user must agree before item delete

Swipeout Events

EventDescription
<f7-swipeout-button> events
clickEvent will be triggered on swipeout button click
<f7-list-item> events
The following events will be available on <f7-list-item> with swipeout enabled
swipeoutEvent will be triggered while you move swipeout element. event.detail.progress contains current opened progress percentage
swipeout:openEvent will be triggered when swipeout element starts its opening animation
swipeout:openedEvent will be triggered after swipeout element completes its opening animation
swipeout:closeEvent will be triggered when swipeout element starts its closing animation
swipeout:closedEvent will be triggered after swipeout element completes its closing animation
swipeout:deleteEvent will be triggered after swipeout element starts its delete animation
swipeout:deletedEvent will be triggered after swipeout element completes its delete animation right before it will be removed from DOM
swipeout:overswipeenterEvent will be triggered when overswipe enabled
swipeout:overswipeexitEvent will be triggered when overswipe disabled

Examples

  1. <template>
  2. <f7-page @page:init="onPageInit">
  3. <f7-navbar title="Swipeout"></f7-navbar>
  4. <f7-block-title>Swipe to delete with confirm modal</f7-block-title>
  5. <f7-list>
  6. <f7-list-item
  7. swipeout
  8. title="Swipe left on me please"
  9. >
  10. <f7-swipeout-actions right>
  11. <f7-swipeout-button delete confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
  12. </f7-swipeout-actions>
  13. </f7-list-item>
  14. <f7-list-item
  15. swipeout
  16. title="Swipe left on me too"
  17. >
  18. <f7-swipeout-actions right>
  19. <f7-swipeout-button delete confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
  20. </f7-swipeout-actions>
  21. </f7-list-item>
  22. <f7-list-item
  23. title="I am not removable"
  24. >
  25. </f7-list-item>
  26. </f7-list>
  27. <f7-block-title>Swipe to delete without confirm</f7-block-title>
  28. <f7-list>
  29. <f7-list-item
  30. swipeout
  31. title="Swipe left on me please"
  32. >
  33. <f7-swipeout-actions right>
  34. <f7-swipeout-button delete>Delete</f7-swipeout-button>
  35. </f7-swipeout-actions>
  36. </f7-list-item>
  37. <f7-list-item
  38. swipeout
  39. title="Swipe left on me too"
  40. >
  41. <f7-swipeout-actions right>
  42. <f7-swipeout-button delete>Delete</f7-swipeout-button>
  43. </f7-swipeout-actions>
  44. </f7-list-item>
  45. <f7-list-item title="I am not removable">
  46. </f7-list-item>
  47. </f7-list>
  48. <f7-block-title>Swipe for actions</f7-block-title>
  49. <f7-list>
  50. <f7-list-item
  51. swipeout
  52. title="Swipe left on me please"
  53. >
  54. <f7-swipeout-actions right>
  55. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  56. <f7-swipeout-button delete>Delete</f7-swipeout-button>
  57. </f7-swipeout-actions>
  58. </f7-list-item>
  59. <f7-list-item
  60. swipeout
  61. title="Swipe left on me too"
  62. >
  63. <f7-swipeout-actions right>
  64. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  65. <f7-swipeout-button delete>Delete</f7-swipeout-button>
  66. </f7-swipeout-actions>
  67. </f7-list-item>
  68. <f7-list-item
  69. swipeout
  70. title="You can't delete me"
  71. >
  72. <f7-swipeout-actions right>
  73. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  74. </f7-swipeout-actions>
  75. </f7-list-item>
  76. </f7-list>
  77. <f7-block-title>With callback on remove</f7-block-title>
  78. <f7-list>
  79. <f7-list-item
  80. swipeout
  81. @swipeout:deleted="onDeleted"
  82. title="Swipe left on me please"
  83. >
  84. <f7-swipeout-actions right>
  85. <f7-swipeout-button delete>Delete</f7-swipeout-button>
  86. </f7-swipeout-actions>
  87. </f7-list-item>
  88. <f7-list-item
  89. swipeout
  90. @swipeout:deleted="onDeleted"
  91. title="Swipe left on me too"
  92. >
  93. <f7-swipeout-actions right>
  94. <f7-swipeout-button delete>Delete</f7-swipeout-button>
  95. </f7-swipeout-actions>
  96. </f7-list-item>
  97. <f7-list-item title="I am not removable">
  98. </f7-list-item>
  99. </f7-list>
  100. <f7-block-title>With actions on left side (swipe to right)</f7-block-title>
  101. <f7-list>
  102. <f7-list-item
  103. swipeout
  104. title="Swipe right on me please"
  105. >
  106. <f7-swipeout-actions left>
  107. <f7-swipeout-button color="green" @click="reply">Reply</f7-swipeout-button>
  108. <f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
  109. </f7-swipeout-actions>
  110. </f7-list-item>
  111. <f7-list-item
  112. swipeout
  113. title="Swipe right on me too"
  114. >
  115. <f7-swipeout-actions left>
  116. <f7-swipeout-button color="green" @click="reply">Reply</f7-swipeout-button>
  117. <f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
  118. </f7-swipeout-actions>
  119. </f7-list-item>
  120. </f7-list>
  121. <f7-block-title>On both sides with overswipes</f7-block-title>
  122. <f7-list media-list>
  123. <f7-list-item
  124. swipeout
  125. title="Facebook"
  126. after="17:14"
  127. subtitle="New messages from John Doe"
  128. 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."
  129. >
  130. <f7-swipeout-actions left>
  131. <f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
  132. <f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
  133. </f7-swipeout-actions>
  134. <f7-swipeout-actions right>
  135. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  136. <f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
  137. <f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
  138. </f7-swipeout-actions>
  139. </f7-list-item>
  140. <f7-list-item
  141. swipeout
  142. title="John Doe (via Twitter)"
  143. after="17:11"
  144. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  145. 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."
  146. >
  147. <f7-swipeout-actions left>
  148. <f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
  149. <f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
  150. </f7-swipeout-actions>
  151. <f7-swipeout-actions right>
  152. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  153. <f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
  154. <f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
  155. </f7-swipeout-actions>
  156. </f7-list-item>
  157. <f7-list-item
  158. swipeout
  159. title="Facebook"
  160. after="16:48"
  161. subtitle="New messages from John Doe"
  162. 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."
  163. >
  164. <f7-swipeout-actions left>
  165. <f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
  166. <f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
  167. </f7-swipeout-actions>
  168. <f7-swipeout-actions right>
  169. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  170. <f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
  171. <f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
  172. </f7-swipeout-actions>
  173. </f7-list-item>
  174. <f7-list-item
  175. swipeout
  176. title="John Doe (via Twitter)"
  177. after="15:32"
  178. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  179. 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."
  180. >
  181. <f7-swipeout-actions left>
  182. <f7-swipeout-button overswipe color="green" @click="reply">Reply</f7-swipeout-button>
  183. <f7-swipeout-button color="blue" @click="forward">Forward</f7-swipeout-button>
  184. </f7-swipeout-actions>
  185. <f7-swipeout-actions right>
  186. <f7-swipeout-button @click="more">More</f7-swipeout-button>
  187. <f7-swipeout-button color="orange" @click="mark">Mark</f7-swipeout-button>
  188. <f7-swipeout-button delete overswipe confirm-text="Are you sure you want to delete this item?">Delete</f7-swipeout-button>
  189. </f7-swipeout-actions>
  190. </f7-list-item>
  191. </f7-list>
  192. </f7-page>
  193. </template>
  194. <script>
  195. export default {
  196. methods: {
  197. more() {
  198. const self = this;
  199. self.actions.open();
  200. },
  201. mark() {
  202. const app = this.$f7;
  203. app.dialog.alert('Mark');
  204. },
  205. reply() {
  206. const app = this.$f7;
  207. app.dialog.alert('Reply');
  208. },
  209. forward() {
  210. const app = this.$f7;
  211. app.dialog.alert('Forward');
  212. },
  213. onDeleted() {
  214. const app = this.$f7;
  215. app.dialog.alert('Thanks, item removed!');
  216. },
  217. onPageInit() {
  218. const self = this;
  219. const app = self.$f7;
  220. self.actions = app.actions.create({
  221. buttons: [
  222. [
  223. {
  224. text: 'Here comes some optional description or warning for actions below',
  225. label: true,
  226. },
  227. {
  228. text: 'Action 1',
  229. },
  230. {
  231. text: 'Action 2',
  232. },
  233. ],
  234. [
  235. {
  236. text: 'Cancel',
  237. bold: true,
  238. },
  239. ],
  240. ],
  241. });
  242. },
  243. },
  244. };
  245. </script>