列表和列表项
QList 和 QItem 是一组组件,它们可以一起工作,将多个行项目垂直显示为单个连续元素。它们最适合显示与信息行类似的数据类型,例如联系人列表、播放列表或菜单。每行称为一个项目。QItem 也可以在 QList 之外使用。
列表还可以封住,类似于列表项的组件,例如 QExpansionItem 或 QSlideItem。如果需要,还可以使用 QSeparator 组件来进行区域分割。
列表项具有以下预设子组件:
- QItemSection - 一个列表项部分可以针对特定内容有多种不同的用法,通过
avatar
,thumbnail
和side
属性来控制。如果未使用上述属性,它将作为 QItem 的主要部分渲染(会占用最大的可用空间)。 - QItemLabel - 一个标签对于类似标题的内容很有用。
QList API
QList API
props
6
slots
1
content
3
style
3
separator
: Boolean
说明
在包含的项目之间应用分隔符
padding
: Boolean
说明
在顶部和底部应用类似于 Material Design 的内边距
tag
: String
v2.10.1+
说明
要使用的 HTML 标签
QItem API
QItem API
props
17
slots
1
events
1
content
2
general
1
navigation
7
state
5
style
2
inset-level
: Number
说明
应用一个内嵌效果;当头像/左侧缺失但您希望将内容与其他具有左侧的项目对齐,或者在构建菜单时使用。
tag
: String
说明
渲染的 HTML 标签;建议:当封装 QCheckbox/QRadio/QToggle 时使用 'label',这样用户在点击/触摸整个项目时会触发所提到组件的 model 数据更改。
QItemSection API
QItemSection API
props
5
slots
1
avatar
: Boolean
说明
渲染一个侧边的头像项(不需要设置 'side' 属性)
thumbnail
: Boolean
说明
渲染一个缩略图项的侧边(不需要设置 'side' 属性)
side
: Boolean
说明
渲染为项目的一侧
top
: Boolean
说明
将内容对齐到顶部(适用于多行项目)
no-wrap
: Boolean
说明
不要包裹文本(适用于项目的主要内容)
QItemLabel API
QItemLabel API
props
5
slots
1
behavior
1
content
4
lines
: Number | String
说明
当没有足够的空间来渲染指定行数时,应用省略号;
用法
基础
基础
Template
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list bordered separator>
<q-item clickable v-ripple>
<q-item-section>Single line item</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
<q-item-label>Item with caption</q-item-label>
<q-item-label caption>Caption</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
<q-item-label overline>OVERLINE</q-item-label>
<q-item-label>Item with caption</q-item-label>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Single line item
Item with caption
Caption
OVERLINE
Item with caption
在黑色背景上
Template
<template>
<div class="q-pa-md bg-grey-10 text-white">
<q-list dark bordered separator style="max-width: 318px">
<q-item clickable v-ripple>
<q-item-section>Single line item</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
<q-item-label>Item with caption</q-item-label>
<q-item-label caption>Caption</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
<q-item-label overline>OVERLINE</q-item-label>
<q-item-label>Item with caption</q-item-label>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Single line item
Item with caption
Caption
OVERLINE
Item with caption
紧凑
Template
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list dense bordered padding class="rounded-borders">
<q-item clickable v-ripple>
<q-item-section>
Item
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
Item
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
Item
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Item
Item
Item
QItemSection
左边的头像/略缩图 QItemSection
Template
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list bordered>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon color="primary" name="bluetooth" />
</q-item-section>
<q-item-section>Icon as avatar</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar color="teal" text-color="white" icon="bluetooth" />
</q-item-section>
<q-item-section>Avatar-type icon</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar rounded color="purple" text-color="white" icon="bluetooth" />
</q-item-section>
<q-item-section>Rounded avatar-type icon</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar color="primary" text-color="white">
R
</q-avatar>
</q-item-section>
<q-item-section>Letter avatar-type</q-item-section>
</q-item>
<q-separator />
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
<q-item-section>Image avatar</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar square>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
<q-item-section>Image square avatar</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar rounded>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
<q-item-section>Image rounded avatar</q-item-section>
</q-item>
<q-separator />
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar rounded>
<img src="https://cdn.quasar.dev/img/mountains.jpg">
</q-avatar>
</q-item-section>
<q-item-section>List item</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section thumbnail>
<img src="https://cdn.quasar.dev/img/mountains.jpg">
</q-item-section>
<q-item-section>List item</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
bluetooth
Icon as avatar
bluetooth
Avatar-type icon
bluetooth
Rounded avatar-type icon
R
Letter avatar-type

Image avatar

Image square avatar

Image rounded avatar

List item

List item
右边的头像/略缩图 QItemSection
Template
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list bordered>
<q-item clickable v-ripple>
<q-item-section>Icon as avatar</q-item-section>
<q-item-section avatar>
<q-icon color="primary" name="bluetooth" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>Avatar-type icon</q-item-section>
<q-item-section avatar>
<q-avatar color="teal" text-color="white" icon="bluetooth" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>Rounded avatar-type icon</q-item-section>
<q-item-section avatar>
<q-avatar rounded color="purple" text-color="white" icon="bluetooth" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>Letter avatar-type</q-item-section>
<q-item-section avatar>
<q-avatar color="primary" text-color="white">
R
</q-avatar>
</q-item-section>
</q-item>
<q-separator />
<q-item clickable v-ripple>
<q-item-section>Image avatar</q-item-section>
<q-item-section avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>Image square avatar</q-item-section>
<q-item-section avatar>
<q-avatar square>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>Image rounded avatar</q-item-section>
<q-item-section avatar>
<q-avatar rounded>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
</q-item>
<q-separator />
<q-item clickable v-ripple>
<q-item-section>List item</q-item-section>
<q-item-section avatar>
<q-avatar rounded>
<img src="https://cdn.quasar.dev/img/mountains.jpg">
</q-avatar>
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>List item</q-item-section>
<q-item-section thumbnail>
<img src="https://cdn.quasar.dev/img/mountains.jpg">
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Icon as avatar
bluetooth
Avatar-type icon
bluetooth
Rounded avatar-type icon
bluetooth
Letter avatar-type
R
Image avatar

Image square avatar

Image rounded avatar

List item

List item

TIP
当您有多行项目时,可以使用 QItemSection 的 top
属性将各部分与顶部对齐,从而覆盖默认的中间对齐方式。
Side QItemSection
Template
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list>
<q-item>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption lines="2">Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>5 min ago</q-item-label>
<q-icon name="star" color="yellow" />
</q-item-section>
</q-item>
<q-separator spaced inset />
<q-item>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>Voted!</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced inset />
<q-item>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-badge color="teal" label="10k" />
</q-item-section>
</q-item>
<q-separator spaced inset />
<q-item>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>2 min ago</q-item-label>
<div class="text-orange">
<q-icon name="star" />
<q-icon name="star" />
<q-icon name="star" />
</div>
</q-item-section>
</q-item>
<q-separator spaced inset />
<q-item>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>meta</q-item-label>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
5 min ago
starSingle line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
Voted!
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
10k
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
2 min ago
starstarstar
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
meta
Active state
Active prop
Template
Script
All
<template>
<div class="q-pa-md q-gutter-md" style="max-width: 350px">
<q-toggle v-model="active" label="Active" />
<q-list bordered separator>
<q-item clickable v-ripple :active="active">
<q-item-section avatar>
<q-icon name="signal_wifi_off" />
</q-item-section>
<q-item-section>Active</q-item-section>
<q-item-section side>Side</q-item-section>
</q-item>
<q-item clickable v-ripple :active="active" active-class="text-orange">
<q-item-section avatar>
<q-icon name="signal_wifi_off" />
</q-item-section>
<q-item-section>Active, Active class</q-item-section>
<q-item-section side>Side</q-item-section>
</q-item>
<q-item clickable v-ripple :active="active" active-class="bg-teal-1 text-grey-8">
<q-item-section avatar>
<q-icon name="signal_wifi_off" />
</q-item-section>
<q-item-section>Active, Active class</q-item-section>
<q-item-section side>Side</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Active
signal_wifi_off
Active
Side
signal_wifi_off
Active, Active class
Side
signal_wifi_off
Active, Active class
Side
QItemLabel
WARNING
注意,您可以使用 lines
属性处理标签溢出,告诉它可以占用多少行。但是,此功能使用依赖于 Webkit 的 CSS,因此无法在 IE/老版本 Edge 中使用。
项标签
Template
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list bordered padding>
<q-item>
<q-item-section>
<q-item-label overline>OVERLINE</q-item-label>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>5 min ago</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced />
<q-item-label header>List Header</q-item-label>
<q-item>
<q-item-section avatar>
<q-icon color="primary" name="bluetooth" />
</q-item-section>
<q-item-section>List item</q-item-section>
<q-item-section side>
<q-item-label caption>meta</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced inset="item" />
<q-item>
<q-item-section top avatar>
<q-avatar color="primary" text-color="white" icon="bluetooth" />
</q-item-section>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption lines="2">Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>5 min ago</q-item-label>
<q-icon name="star" color="yellow" />
</q-item-section>
</q-item>
<q-separator spaced inset="item" />
<q-item>
<q-item-section top avatar>
<q-avatar color="primary" text-color="white" square icon="bluetooth" />
</q-item-section>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>meta</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced inset="item" />
<q-item>
<q-item-section top avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-badge label="10k" />
</q-item-section>
</q-item>
<q-separator spaced inset="item" />
<q-item>
<q-item-section top avatar>
<q-avatar rounded>
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>meta</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced />
<q-item>
<q-item-section top thumbnail class="q-ml-none">
<img src="https://cdn.quasar.dev/img/mountains.jpg">
</q-item-section>
<q-item-section>
<q-item-label>Single line item</q-item-label>
<q-item-label caption>Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label caption>meta</q-item-label>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
OVERLINE
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
5 min ago
List Header
bluetooth
List item
meta
bluetooth
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
5 min ago
starbluetooth
Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
meta

Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
10k

Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
meta

Single line item
Secondary line text. Lorem ipsum dolor sit amet, consectetur adipiscit elit.
meta
更多示例
联系人列表
Template
Script
All
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-toolbar class="bg-primary text-white shadow-2">
<q-toolbar-title>Contacts</q-toolbar-title>
</q-toolbar>
<q-list bordered>
<q-item v-for="contact in contacts" :key="contact.id" class="q-my-sm" clickable v-ripple>
<q-item-section avatar>
<q-avatar color="primary" text-color="white">
{{ contact.letter }}
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>{{ contact.name }}</q-item-label>
<q-item-label caption lines="1">{{ contact.email }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="chat_bubble" color="green" />
</q-item-section>
</q-item>
<q-separator />
<q-item-label header>Offline</q-item-label>
<q-item v-for="contact in offline" :key="contact.id" class="q-mb-sm" clickable v-ripple>
<q-item-section avatar>
<q-avatar>
<img :src="`https://cdn.quasar.dev/img/${contact.avatar}`">
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>{{ contact.name }}</q-item-label>
<q-item-label caption lines="1">{{ contact.email }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="chat_bubble" color="grey" />
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Contacts
R
Ruddy Jedrzej
rjedrzej0@discuz.net
chat_bubble
M
Mallorie Alessandrini
malessandrini1@marketwatch.com
chat_bubble
E
Elisabetta Wicklen
ewicklen2@microsoft.com
chat_bubble
S
Seka Fawdrey
sfawdrey3@wired.com
chat_bubble
Offline

Brunhilde Panswick
bpanswick4@csmonitor.com
chat_bubble

Winfield Stapforth
wstapforth5@pcworld.com
chat_bubble
设置
Template
Script
All
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list bordered padding>
<q-item-label header>User Controls</q-item-label>
<q-item clickable v-ripple>
<q-item-section>
<q-item-label>Content filtering</q-item-label>
<q-item-label caption>
Set the content filtering level to restrict
apps that can be downloaded
</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section>
<q-item-label>Password</q-item-label>
<q-item-label caption>
Require password for purchase or use
password to restrict purchase
</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced />
<q-item-label header>General</q-item-label>
<q-item tag="label" v-ripple>
<q-item-section side top>
<q-checkbox v-model="check1" />
</q-item-section>
<q-item-section>
<q-item-label>Notifications</q-item-label>
<q-item-label caption>
Notify me about updates to apps or games that I downloaded
</q-item-label>
</q-item-section>
</q-item>
<q-item tag="label" v-ripple>
<q-item-section side top>
<q-checkbox v-model="check2" />
</q-item-section>
<q-item-section>
<q-item-label>Sound</q-item-label>
<q-item-label caption>
Auto-update apps at anytime. Data charges may apply
</q-item-label>
</q-item-section>
</q-item>
<q-item tag="label" v-ripple>
<q-item-section side top>
<q-checkbox v-model="check3" />
</q-item-section>
<q-item-section>
<q-item-label>Auto-add widgets</q-item-label>
<q-item-label caption>
Automatically add home screen widgets
</q-item-label>
</q-item-section>
</q-item>
<q-separator spaced />
<q-item-label header>Notifications</q-item-label>
<q-item tag="label" v-ripple>
<q-item-section>
<q-item-label>Battery too low</q-item-label>
</q-item-section>
<q-item-section side >
<q-toggle color="blue" v-model="notif1" val="battery" />
</q-item-section>
</q-item>
<q-item tag="label" v-ripple>
<q-item-section>
<q-item-label>Friend request</q-item-label>
<q-item-label caption>Allow notification</q-item-label>
</q-item-section>
<q-item-section side top>
<q-toggle color="green" v-model="notif2" val="friend" />
</q-item-section>
</q-item>
<q-item tag="label" v-ripple>
<q-item-section>
<q-item-label>Picture uploaded</q-item-label>
<q-item-label caption>Allow notification when uploading images</q-item-label>
</q-item-section>
<q-item-section side top>
<q-toggle color="red" v-model="notif3" val="picture" />
</q-item-section>
</q-item>
<q-separator spaced />
<q-item-label header>Other settings</q-item-label>
<q-item>
<q-item-section side>
<q-icon color="teal" name="volume_down" />
</q-item-section>
<q-item-section>
<q-slider
v-model="volume"
:min="0"
:max="10"
label
color="teal"
/>
</q-item-section>
<q-item-section side>
<q-icon color="teal" name="volume_up" />
</q-item-section>
</q-item>
<q-item>
<q-item-section side>
<q-icon color="deep-orange" name="brightness_medium" />
</q-item-section>
<q-item-section>
<q-slider
v-model="brightness"
:min="0"
:max="10"
label
color="deep-orange"
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section side>
<q-icon color="primary" name="mic" />
</q-item-section>
<q-item-section>
<q-slider
v-model="mic"
:min="0"
:max="50"
label
/>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
User Controls
Content filtering
Set the content filtering level to restrict apps that can be downloaded
Password
Require password for purchase or use password to restrict purchase
General
Notifications
Other settings
volume_down
6
volume_up
brightness_medium
3
mic
8
邮件
Template
<template>
<div class="q-pa-md q-gutter-md">
<q-list bordered class="rounded-borders" style="max-width: 350px">
<q-item-label header>Friends</q-item-label>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/avatar2.jpg">
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label lines="1">Brunch this weekend?</q-item-label>
<q-item-label caption lines="2">
<span class="text-weight-bold">Janet</span>
-- I'll be in your neighborhood doing errands this
weekend. Do you want to grab brunch?
</q-item-label>
</q-item-section>
<q-item-section side top>
1 min ago
</q-item-section>
</q-item>
<q-separator inset="item" />
<q-item clickable v-ripple>
<q-item-section avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/avatar4.jpg">
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label lines="1">Linear Project</q-item-label>
<q-item-label caption lines="2">
<span class="text-weight-bold">John</span>
-- Can we schedule a call for tomorrow?
</q-item-label>
</q-item-section>
<q-item-section side top>
1 min ago
</q-item-section>
</q-item>
</q-list>
<q-list bordered class="rounded-borders" style="max-width: 600px">
<q-item-label header>Google Inbox style</q-item-label>
<q-item>
<q-item-section avatar top>
<q-icon name="account_tree" color="black" size="34px" />
</q-item-section>
<q-item-section top class="col-2 gt-sm">
<q-item-label class="q-mt-sm">GitHub</q-item-label>
</q-item-section>
<q-item-section top>
<q-item-label lines="1">
<span class="text-weight-medium">[quasarframework/quasar]</span>
<span class="text-grey-8"> - GitHub repository</span>
</q-item-label>
<q-item-label caption lines="1">
@rstoenescu in #3: > Generic type parameter for props
</q-item-label>
<q-item-label lines="1" class="q-mt-xs text-body2 text-weight-bold text-primary text-uppercase">
<span class="cursor-pointer">Open in GitHub</span>
</q-item-label>
</q-item-section>
<q-item-section top side>
<div class="text-grey-8 q-gutter-xs">
<q-btn class="gt-xs" size="12px" flat dense round icon="delete" />
<q-btn class="gt-xs" size="12px" flat dense round icon="done" />
<q-btn size="12px" flat dense round icon="more_vert" />
</div>
</q-item-section>
</q-item>
<q-separator spaced />
<q-item>
<q-item-section avatar top>
<q-icon name="account_tree" color="black" size="34px" />
</q-item-section>
<q-item-section top class="col-2 gt-sm">
<q-item-label class="q-mt-sm">GitHub</q-item-label>
</q-item-section>
<q-item-section top>
<q-item-label lines="1">
<span class="text-weight-medium">[quasarframework/quasar]</span>
<span class="text-grey-8"> - GitHub repository</span>
</q-item-label>
<q-item-label caption lines="1">
@rstoenescu in #1: > The build system
</q-item-label>
<q-item-label lines="1" class="q-mt-xs text-body2 text-weight-bold text-primary text-uppercase">
<span class="cursor-pointer">Open in GitHub</span>
</q-item-label>
</q-item-section>
<q-item-section top side>
<div class="text-grey-8 q-gutter-xs">
<q-btn class="gt-xs" size="12px" flat dense round icon="delete" />
<q-btn class="gt-xs" size="12px" flat dense round icon="done" />
<q-btn size="12px" flat dense round icon="more_vert" />
</div>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Friends

Brunch this weekend?
Janet -- I'll be in your neighborhood doing errands this weekend. Do you want to grab brunch?
1 min ago

Linear Project
John -- Can we schedule a call for tomorrow?
1 min ago
Google Inbox style
account_tree
GitHub
[quasarframework/quasar] - GitHub repository
@rstoenescu in #3: > Generic type parameter for props
Open in GitHub
account_tree
GitHub
[quasarframework/quasar] - GitHub repository
@rstoenescu in #1: > The build system
Open in GitHub
文件夹列表
Template
<template>
<div class="q-pa-md q-gutter-md">
<q-list bordered padding class="rounded-borders" style="max-width: 350px">
<q-item-label header>Folders</q-item-label>
<q-item clickable v-ripple>
<q-item-section avatar top>
<q-avatar icon="folder" color="primary" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">Photos</q-item-label>
<q-item-label caption>February 22nd, 2019</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="info" color="green" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar top>
<q-avatar icon="folder" color="orange" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">Movies</q-item-label>
<q-item-label caption>March 1st, 2019</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="info" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar top>
<q-avatar icon="folder" color="teal" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">Photos</q-item-label>
<q-item-label caption>January 15th, 2019</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="info" />
</q-item-section>
</q-item>
<q-separator spaced />
<q-item-label header>Files</q-item-label>
<q-item clickable v-ripple>
<q-item-section avatar top>
<q-avatar icon="assignment" color="grey" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">Expenses spreadsheet</q-item-label>
<q-item-label caption>March 2nd, 2019</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="info" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar top>
<q-avatar icon="place" color="grey" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">Places to visit</q-item-label>
<q-item-label caption>February 22, 2019</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="info" color="amber" />
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar top>
<q-avatar icon="library_music" color="grey" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label lines="1">My favorite song</q-item-label>
<q-item-label caption>Singing it all day</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="info" />
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
Folders
folder
Photos
February 22nd, 2019
info
folder
Movies
March 1st, 2019
info
folder
Photos
January 15th, 2019
info
Files
assignment
Expenses spreadsheet
March 2nd, 2019
info
place
Places to visit
February 22, 2019
info
library_music
My favorite song
Singing it all day
info
在下面的示例中,出于演示目的,我们使用 active
属性代替 QItem 的 路由管理器属性(to
, exact
)。 UMD 没有 Vue Router,因此您将无法在 Codepen/jsFiddle 中使用它。
菜单
Template
Script
Style
All
<template>
<div class="q-pa-md" style="max-width: 250px">
<q-list bordered padding class="rounded-borders text-primary">
<q-item
clickable
v-ripple
:active="link === 'inbox'"
@click="link = 'inbox'"
active-class="my-menu-link"
>
<q-item-section avatar>
<q-icon name="inbox" />
</q-item-section>
<q-item-section>Inbox</q-item-section>
</q-item>
<q-item
clickable
v-ripple
:active="link === 'outbox'"
@click="link = 'outbox'"
active-class="my-menu-link"
>
<q-item-section avatar>
<q-icon name="send" />
</q-item-section>
<q-item-section>Outbox</q-item-section>
</q-item>
<q-item
clickable
v-ripple
:active="link === 'trash'"
@click="link = 'trash'"
active-class="my-menu-link"
>
<q-item-section avatar>
<q-icon name="delete" />
</q-item-section>
<q-item-section>Trash</q-item-section>
</q-item>
<q-separator spaced />
<q-item
clickable
v-ripple
:active="link === 'settings'"
@click="link = 'settings'"
active-class="my-menu-link"
>
<q-item-section avatar>
<q-icon name="settings" />
</q-item-section>
<q-item-section>Settings</q-item-section>
</q-item>
<q-item
clickable
v-ripple
:active="link === 'help'"
@click="link = 'help'"
active-class="my-menu-link"
>
<q-item-section avatar>
<q-icon name="help" />
</q-item-section>
<q-item-section>Help</q-item-section>
</q-item>
</q-list>
</div>
</template>
Copied to clipboard
inbox
Inbox
send
Outbox
delete
Trash
settings
Settings
help
Help
TIP
对于更复杂的菜单,请考虑同时使用 QExpansionItem。
连接到 Vue Router
您可以在 QItems 上使用 <router-link>
拥有的属性来将 QItems 与 Vue Router 联系在一起。这允许监听当前的应用路由,并在点击时触发路由。
<q-item to="/inbox" exact>
<q-item-section avatar>
<q-icon name="inbox" />
</q-item-section>
<q-item-section>
Inbox
</q-item-section>
</q-item>
您也可以延迟、取消或重定向导航,如下所示。关于下面使用的 @click
事件的更深入描述,请参考页面顶部的 QItem API 卡。
延迟、取消或重定向导航 (v2.9+)
Template
Script
All
<template>
<div class="q-pa-md q-gutter-sm">
<q-item to="/" @click="onDelayedClick" dense>
<q-item-section>延迟跳转</q-item-section>
</q-item>
<q-item to="/" @click="onCancelledClick" dense>
<q-item-section>取消导航</q-item-section>
</q-item>
<q-item to="/" @click="onRedirectedClick" dense>
<q-item-section>重定向导航</q-item-section>
</q-item>
</div>
</template>
Copied to clipboard
版权声明 本中文文档内容版权为站长个人所有,保留所有权利。
免责声明 本站点所包含的任何跳转链接均为第三方广告内容,站点对这些广告内容的准确性、合法性、真实性不承担任何责任。用户点击跳转链接进入第三方网站后,应自行判断广告内容的真实性和合法性,并自行承担因使用广告内容而产生的风险和责任。任何因使用第三方广告内容而导致的损失或损害,本站点概不负责。