カード Vue コンポーネント
リストビューと同様に、カードは情報を格納して整理するための優れた方法です。カードには、写真、テキスト、リンクなど、単一の主題に関する関連データが含まれています。カードは通常、より複雑で詳細な情報のエントリポイントです。
Card Vue コンポーネントは、カードコンポーネントを表します。
カードコンポーネント
以下のコンポーネントが含まれています。
f7-card
f7-card-header
f7-card-content
f7-card-footer
カードプロパティ
プロパティ | 型 | デフォルト | 説明 |
---|---|---|---|
<f7-card> プロパティ | |||
title | 文字列 | カードヘッダーコンテンツ | |
content | 文字列 | カードコンテンツ | |
footer | 文字列 | カードフッターコンテンツ | |
padding | ブール値 | true | カードコンテンツに追加の内部パディングを追加します。 |
outline | ブール値 | false | カードのアウトライン(ボーダー付き)を作成します。 |
outlineIos | ブール値 | false | iOSテーマでカードのアウトラインを作成します。 |
outlineMd | ブール値 | false | MDテーマでカードのアウトラインを作成します。 |
raised | ブール値 | false | カードを影付きで立体的にします。 |
header-divider | ブール値 | false | カードヘッダーに区切り線(ボーダー)を追加します。 |
footer-divider | ブール値 | false | カードフッターに区切り線(ボーダー)を追加します。 |
expandable | ブール値 | false | 展開可能なカードを有効にします。 |
expandable-animate-width | ブール値 | false | カードコンテンツの幅もアニメーションとレスポンシブにすることができますが、パフォーマンスに影響を与える可能性があります。 |
expandable-opened | ブール値 | false | 展開可能なカードが開いているかどうかを示すブール型のプロパティです。 |
animate | ブール値 | true | 展開可能なカードをアニメーション付きで開くかどうかを指定します。 |
hide-navbar-on-open | ブール値 | 展開可能なカードを開くとナビゲーションバーを非表示にします。デフォルトでは、同じアプリカードパラメーターを継承します。 | |
hide-toolbar-on-open | ブール値 | 展開可能なカードを開くとツールバーを非表示にします。デフォルトでは、同じアプリカードパラメーターを継承します。 | |
swipe-to-close | ブール値 | スワイプで展開可能なカードを閉じることができます。デフォルトでは、同じアプリカードパラメーターを継承します。 | |
backdrop | ブール値 | 展開可能なカードのバックドロップレイヤーを有効にします。デフォルトでは、同じアプリカードパラメーターを継承します。 | |
backdrop-el | 文字列 | カスタムの展開可能なカードバックドロップ要素を指定できます。これは、バックドロップ要素のCSSセレクターである必要があります(例:.card-backdrop.custom-backdrop ) | |
close-by-backdrop-click | ブール値 | 有効にすると、バックドロップをクリックすると展開可能なカードが閉じられます。デフォルトでは、同じアプリカードパラメーターを継承します。 | |
<f7-card-content> プロパティ | |||
padding | ブール値 | true | 追加の内部パディングを追加します。 |
カードイベント
イベント | 説明 |
---|---|
<f7-card> イベント | |
card:beforeopen | 展開可能なカードが開きアニメーションを開始する直前にトリガーされるイベントです。event.detail.prevent には、呼び出されるとカードが開くのを防ぐ関数が含まれています。 |
card:open | 展開可能なカードが開きアニメーションを開始したときにトリガーされるイベントです。 |
card:opened | 展開可能なカードが開きアニメーションを完了したときにトリガーされるイベントです。 |
card:close | 展開可能なカードが閉じアニメーションを開始したときにトリガーされるイベントです。 |
card:closed | 展開可能なカードが閉じアニメーションを完了したときにトリガーされるイベントです。 |
カードスロット
<f7-card>
コンポーネントには、次のスロットがあります。
default
- 要素はカードコンテンツ要素の子として挿入されます。content
-default
と同じです。header
- 要素はカードヘッダー要素の子として挿入されます。footer
- 要素はカードフッター要素の子として挿入されます。
<f7-card>
<span slot="header">Header</span>
<span slot="content">Content</span>
<span slot="footer">Footer</span>
</f7-card>
レンダリング先
<div class="card">
<div class="card-header">
<span>Header</span>
</div>
<div class="card-content">
<span>Content</span>
</div>
<div class="card-footer">
<span>Footer</span>
</div>
</div>
カード v-model
展開可能なカードコンポーネントは、expandable-opened
プロパティでv-model
をサポートしています。
<template>
<f7-page>
<f7-card expandable v-model:expandable-opened="isOpened">
...
</f7-card>
<p>Card is opened: {{ isOpened }}</p>
</f7-page>
</template>
<script>
export default {
data() {
return {
isOpened: false,
};
}
};
</script>
例
cards.vue
<template>
<f7-page>
<f7-navbar title="Cards"></f7-navbar>
<f7-block>
<p>
Cards are a great way to contain and organize your information, especially when combined
with List Views. Cards can contain unique related data, like for example photos, text or
links about a particular subject. Cards are typically an entry point to more complex and
detailed information.
</p>
</f7-block>
<f7-block-title>Simple Cards</f7-block-title>
<f7-card
content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
></f7-card>
<f7-card
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
></f7-card>
<f7-card
content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
></f7-card>
<f7-block-title>Outline Cards</f7-block-title>
<f7-card
outline
content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
></f7-card>
<f7-card
outline
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
></f7-card>
<f7-card
outline
content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
></f7-card>
<f7-block-title>Outline With Dividers</f7-block-title>
<f7-card
outline
header-divider
footer-divider
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
></f7-card>
<f7-block-title>Raised Cards</f7-block-title>
<f7-card
raised
content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
></f7-card>
<f7-card
raised
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
></f7-card>
<f7-card
raised
content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
></f7-card>
<f7-block-title>Styled Cards</f7-block-title>
<f7-card outline-md class="demo-card-header-pic">
<f7-card-header
valign="bottom"
style="background-image: url(https://cdn.framework7.io/placeholder/nature-1000x600-3.jpg)"
>Journey To Mountains</f7-card-header
>
<f7-card-content>
<p class="date">Posted on January 21, 2015</p>
<p>
Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies efficitur vitae non
felis. Phasellus quis nibh hendrerit...
</p>
</f7-card-content>
<f7-card-footer>
<f7-link>Like</f7-link>
<f7-link>Read more</f7-link>
</f7-card-footer>
</f7-card>
<f7-card class="demo-card-header-pic">
<f7-card-header
valign="bottom"
style="background-image: url(https://cdn.framework7.io/placeholder/people-1000x600-6.jpg)"
>Journey To Mountains</f7-card-header
>
<f7-card-content>
<p class="date">Posted on January 21, 2015</p>
<p>
Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies efficitur vitae non
felis. Phasellus quis nibh hendrerit...
</p>
</f7-card-content>
<f7-card-footer>
<f7-link>Like</f7-link>
<f7-link>Read more</f7-link>
</f7-card-footer>
</f7-card>
<f7-block-title>Cards With List View</f7-block-title>
<f7-card>
<f7-card-content :padding="false">
<f7-list>
<f7-list-item link="#">Link 1</f7-list-item>
<f7-list-item link="#">Link 2</f7-list-item>
<f7-list-item link="#">Link 3</f7-list-item>
<f7-list-item link="#">Link 4</f7-list-item>
<f7-list-item link="#">Link 5</f7-list-item>
</f7-list>
</f7-card-content>
</f7-card>
<f7-card title="New Releases:">
<f7-card-content :padding="false">
<f7-list medial-list>
<f7-list-item title="Yellow Submarine" subtitle="Beatles">
<template #media>
<img src="https://cdn.framework7.io/placeholder/fashion-88x88-4.jpg" width="44" />
</template>
</f7-list-item>
<f7-list-item title="Don't Stop Me Now" subtitle="Queen">
<template #media>
<img src="https://cdn.framework7.io/placeholder/fashion-88x88-5.jpg" width="44" />
</template>
</f7-list-item>
<f7-list-item title="Billie Jean" subtitle="Michael Jackson">
<template #media>
<img src="https://cdn.framework7.io/placeholder/fashion-88x88-6.jpg" width="44" />
</template>
</f7-list-item>
</f7-list>
</f7-card-content>
<f7-card-footer>
<span>January 20, 2015</span>
<span>5 comments</span>
</f7-card-footer>
</f7-card>
</f7-page>
</template>
<script>
import {
f7Navbar,
f7Page,
f7Block,
f7BlockTitle,
f7Card,
f7CardHeader,
f7CardContent,
f7CardFooter,
f7List,
f7ListItem,
f7Link,
} from 'framework7-vue';
export default {
components: {
f7Navbar,
f7Page,
f7Block,
f7BlockTitle,
f7Card,
f7CardHeader,
f7CardContent,
f7CardFooter,
f7List,
f7ListItem,
f7Link,
},
};
</script>