Swipeout Vue Component(スワイプアウト・ビュー・コンポーネント

    Swipeout Listは独立したコンポーネントではなく、<f7-list><f7-list-item swipeout>のVueコンポーネントと、追加のSwipeoutコンポーネントを使用した特殊なケースである。

    Swipeout Vueコンポーネントは、Framework7のSwipeoutコンポーネントを表しています。

    Swipeoutコンポーネント

    以下のコンポーネントが含まれています。

    • f7-swipeout-actions - スワイプアウトボタンのラッパー
    • f7-swipeout-button - 単一のスワイプアウトボタン

    スワイプアウトのプロパティ

    PropTypeDefaultDescription
    <f7-swipeout-actions> Properties
    sidestringrightスワイプアウト・アクションのサイド
    rightbooleanside="right"` のショートカットです。
    leftbooleanside="left"` のショートカットです。
    <f7-swipeout-button> Properties
    deletebooleanfalseクリックするとスワイプアウトリストのアイテムを自動的に削除します。
    closebooleanfalseクリックすると自動的にスワイプアウトリストのアイテムを閉じます
    overswipebooleanfalseスワイプ操作をしすぎると自動的にクリックされるようになる - overswipe
    textstringスワイプアウトボタンのテキストラベル
    confirm-textstringこのテキストは、アイテムを削除する前にユーザーが同意しなければならないダイアログに表示されます。
    confirm-titlestringこのテキストは、アイテムを削除する前にユーザーが同意しなければならないダイアログのタイトルとして表示されます。

    スワイプアウトイベント

    EventDescription
    <f7-swipeout-button> events
    clickスワイプアウトボタンがクリックされるとイベントが発生します。
    <f7-list-item> events
    The following events will be available on <f7-list-item> with swipeout enabled
    swipeoutスワイプアウト要素を移動するとイベントが発生します。event.detail.progressには、現在の開いた状態の進捗率が表示されます。
    swipeout:openイベントは、スワイプアウト要素が開くアニメーションを開始するときにトリガされます。
    swipeout:openedイベントは、スワイプアウト要素がオープニングアニメーションを完了した後に発生します。
    swipeout:closeイベントは、スワイプアウト要素が閉じるアニメーションを開始したときにトリガされます。
    swipeout:closedイベントはスワイプアウト要素が閉じるアニメーションを完了した後にトリガされます。
    swipeout:deleteスワイプアウト要素が削除アニメーションを開始すると、イベントが発生します。
    swipeout:deletedイベントは、swipeout 要素が DOM から削除される直前に削除アニメーションを完了した後に発生します。
    swipeout:overswipeenterオーバーワイプが有効になるとイベントが発生する
    swipeout:overswipeexitオーバースワイプが無効の時にイベントが発生する

    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>
      import { f7 } from 'framework7-vue';
    
      export default {
        methods: {
          more() {
            const self = this;
            self.actions.open();
          },
          mark() {
            f7.dialog.alert('Mark');
          },
          reply() {
            f7.dialog.alert('Reply');
          },
          forward() {
            f7.dialog.alert('Forward');
          },
          onDeleted() {
            f7.dialog.alert('Thanks, item removed!');
          },
          onPageInit() {
            const self = this;
            self.actions = f7.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>