Skip to content
本页导读

Card 卡片

组件类型:UxCardComponentPublicInstance

支持图标、标题、副标题及样式自定义,支持内边距和外边距设置,可显示阴影和边框

平台兼容性

AndroidiOSweb鸿蒙 Next小程序
xx

Props

属性名类型默认值说明
directionString'row'布局方向
titleString-标题
sizeNumber$ux.Conf.fontSize标题大小
colorString$ux.Conf.fontColor标题颜色
darkColorString-深色
boldBooleanfalse标题加粗
titleStyleString-标题样式
subtitleString-副标题
subtitleColorString$ux.Conf.secondaryColor副标题颜色
subtitleSizeNumber$ux.Conf.fontColor.small副标题大小
subtitleStyleString-副标题样式
iconString-标题图标
iconColorString$ux.Conf.fontColor标题图标颜色
iconSizeNumber$ux.Conf.fontSize标题图标大小
iconStyleString-标题图标样式
customFontString-自定义字体路径
customFamilyString-自定义字体family
backgroundString$ux.Conf.backgroundColor背景色
backgroundDarkString-深色
shadowBooleanfalse显示阴影
borderBooleanfalse显示边框
borderColorString$ux.Conf.borderColor边框颜色
borderDarkColorString-深色
paddingNumber0内部水平边距
marginNumber15边距

direction

说明
row水平
column垂直

darkColor

说明
none不显示
auto自动适配深色模式
color其他颜色

示例代码

html
<template>
	<ux-page>
		<ux-navbar :title="title" :border="false"></ux-navbar>
		
		<ux-scroll>
			<ux-card direction="column" icon="flag" title="卡片" :bold="true">
				<ux-text text="支持图标、标题、副标题及样式自定义,支持内边距和外边距设置,可显示阴影和边框"></ux-text>
				<ux-row :flex="true" align="top" :mt="5" style="width: 100%;">
					<ux-text text="详细文档:"></ux-text>
					<ux-text style="flex: 1" name="卡片" text="https://www.uxframe.cn/component/layout/card.html" mode="link"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="标题" subtitle="副标题" subtitle-color="green" :bold="true">
				<ux-text text="可设置标题、副标题及样式" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="边距" :bold="true" :margin="30">
				<ux-text text="支持内边距和外边距设置" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="边框" :bold="true" :border="true">
				<ux-text text="支持显示边框" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="阴影" :bold="true" :shadow="true">
				<ux-text text="支持显示阴影" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="wink" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
	</ux-page>
</template>
<template>
	<ux-page>
		<ux-navbar :title="title" :border="false"></ux-navbar>
		
		<ux-scroll>
			<ux-card direction="column" icon="flag" title="卡片" :bold="true">
				<ux-text text="支持图标、标题、副标题及样式自定义,支持内边距和外边距设置,可显示阴影和边框"></ux-text>
				<ux-row :flex="true" align="top" :mt="5" style="width: 100%;">
					<ux-text text="详细文档:"></ux-text>
					<ux-text style="flex: 1" name="卡片" text="https://www.uxframe.cn/component/layout/card.html" mode="link"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="标题" subtitle="副标题" subtitle-color="green" :bold="true">
				<ux-text text="可设置标题、副标题及样式" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="边距" :bold="true" :margin="30">
				<ux-text text="支持内边距和外边距设置" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="边框" :bold="true" :border="true">
				<ux-text text="支持显示边框" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="阴影" :bold="true" :shadow="true">
				<ux-text text="支持显示阴影" :mb="15"></ux-text>
				<ux-row>
					<view class="b"></view>
					<view class="b"></view>
					<view class="b"></view>
				</ux-row>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="wink" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
	</ux-page>
</template>
ts
<script setup>
	let title = ''
	
	onLoad((e: OnLoadOptions) => {
		title = e['title'] ?? ''
	})
</script>
<script setup>
	let title = ''
	
	onLoad((e: OnLoadOptions) => {
		title = e['title'] ?? ''
	})
</script>
css
<style lang="scss">
	.b {
		margin-right: 10px;
		width: 50px;
		height: 40px;
		border-radius: 5px;
		background-color: #285655;
	}
</style>
<style lang="scss">
	.b {
		margin-right: 10px;
		width: 50px;
		height: 40px;
		border-radius: 5px;
		background-color: #285655;
	}
</style>