Banner
QBanner 组件创建一个 banner 元素用于展示一些醒目的信息和一些可选的按钮。
根据 Material Design 的设计规范,banner 应该显示在应用程序的顶部,当然您可以把它放在任何有意义的地方,甚至是 QDialog 组件中。
QBanner API
QBanner API
props
4
slots
3
content
1
style
3
inline-actions
: Boolean
说明
在与内容所在的相同行上显示操作按钮
用法
基础用法
Template
<template>
<div class="q-pa-md q-gutter-sm">
<q-banner class="bg-primary text-white">
Unfortunately, the credit card did not go through, please try again.
<template v-slot:action>
<q-btn flat color="white" label="Dismiss" />
<q-btn flat color="white" label="Update Credit Card" />
</template>
</q-banner>
<q-banner class="bg-grey-3">
<template v-slot:avatar>
<q-icon name="signal_wifi_off" color="primary" />
</template>
You have lost connection to the internet. This app is offline.
<template v-slot:action>
<q-btn flat color="primary" label="Turn on Wifi" />
</template>
</q-banner>
<q-banner inline-actions class="text-white bg-red">
You have lost connection to the internet. This app is offline.
<template v-slot:action>
<q-btn flat color="white" label="Turn ON Wifi" />
</template>
</q-banner>
</div>
</template>
Copied to clipboard
Unfortunately, the credit card did not go through, please try again.
signal_wifi_off
You have lost connection to the internet. This app is offline.
You have lost connection to the internet. This app is offline.
圆角边框
Template
<template>
<div class="q-pa-md q-gutter-sm">
<q-banner rounded class="bg-purple-8 text-white">
We can't find your saved recipes until you sign in.
<template v-slot:action>
<q-btn flat color="white" label="Continue as a Guest" />
<q-btn flat color="white" label="Sign in" />
</template>
</q-banner>
</div>
</template>
Copied to clipboard
We can't find your saved recipes until you sign in.
带有图片
Template
<template>
<div class="q-pa-md q-gutter-sm">
<q-banner rounded class="bg-grey-3">
<template v-slot:avatar>
<img
src="https://cdn.quasar.dev/img/mountains.jpg"
style="width: 100px; height: 64px"
>
</template>
Could not retrieve travel data.
<template v-slot:action>
<q-btn flat label="Retry" />
</template>
</q-banner>
</div>
</template>
Copied to clipboard

Could not retrieve travel data.
内联的操作按钮
Template
<template>
<div class="q-pa-md q-gutter-sm">
<q-banner inline-actions rounded class="bg-orange text-white">
You have lost connection to the internet. This app is offline.
<template v-slot:action>
<q-btn flat label="Turn ON Wifi" />
<q-btn flat label="Dismiss" />
</template>
</q-banner>
</div>
</template>
Copied to clipboard
You have lost connection to the internet. This app is offline.
紧凑的
Template
<template>
<div class="q-pa-md q-gutter-sm">
<q-banner dense class="bg-primary text-white">
Unfortunately, the credit card did not go through, please try again.
<template v-slot:action>
<q-btn flat color="white" label="Dismiss" />
<q-btn flat color="white" label="Update Credit Card" />
</template>
</q-banner>
<q-banner dense class="bg-grey-3">
<template v-slot:avatar>
<q-icon name="signal_wifi_off" color="primary" />
</template>
You have lost connection to the internet. This app is offline.
<template v-slot:action>
<q-btn flat color="primary" label="Turn on Wifi" />
</template>
</q-banner>
<q-banner dense inline-actions class="text-white bg-red">
You have lost connection to the internet. This app is offline.
<template v-slot:action>
<q-btn flat color="white" label="Turn ON Wifi" />
</template>
</q-banner>
</div>
</template>
Copied to clipboard
Unfortunately, the credit card did not go through, please try again.
signal_wifi_off
You have lost connection to the internet. This app is offline.
You have lost connection to the internet. This app is offline.
版权声明 本中文文档内容版权为站长个人所有,保留所有权利。
免责声明 本站点所包含的任何跳转链接均为第三方广告内容,站点对这些广告内容的准确性、合法性、真实性不承担任何责任。用户点击跳转链接进入第三方网站后,应自行判断广告内容的真实性和合法性,并自行承担因使用广告内容而产生的风险和责任。任何因使用第三方广告内容而导致的损失或损害,本站点概不负责。