Skip to content
本页导读

Icon

组件类型:UxIconComponentPublicInstance

常用字体图标集,包含了大多数常见场景的图标

平台兼容性

UniApp X

AndroidiOSweb鸿蒙 Next小程序
x

UniApp Vue Nvue

AndroidiOSweb鸿蒙 Next小程序
xxxx

Props

属性名类型默认值说明
typeString字体类型
colorString$ux.Conf.fontColor字体颜色
darkColorString深色none-不显示,auto-自动适配深色模式,其他-颜色
sizeAny$ux.Conf.fontSize字体大小
customBoolean需配合全局配置中的customFontcustomFamily使用
customFontString网络字体路径或自定义字体路径
customFamilyString自定义字体family
globalBoolean任意地方加载一次,全局生效
marginArray边距[上右下左][上下左右][上下左右]
mtAny距上单位px
mrAny距右单位px
mbAny距下单位px
mlAny距左单位px
paddingArray填充[上右下左][上下左右][上下左右]
ptAny上内边距单位px
prAny右内边距单位px
pbAny下内边距单位px
plAny左内边距单位px
xstyleArray自定义样式

type

说明
addcircle-filled
addcircle-outline
addimg-outline
addsquare-filled
addsquare-outline
adduser-outline
apple-filled
apple-outline"
application-filled
application-outline
arrow2down
arrow2left
arrow2right
arrow2up
arrowdown
arrowleft
arrowright
arrowup
article-outline
attention-filled
attention-outline
bankcard-filled
bankcard-outline
battery-full-filled
batteryempty-filled
batteryempty-outline
batteryfull-outline
batterywork-filled
batterywork-outline
bezier-filled
bezier-outline
bookmark-filled
bookmark-outline
bookopen-filled"
bookopen-outline
branch-filled
branch-outline
branchdown-filled
branchdown-outline
brightness-outline
bug-filled
bug-outline
calculator-filled
calculator-outline
call-filled
call-outline
camera-filled
camera-outline
cancel-outline
cartadd-filled
cartadd-outline
cartdel-filled
cartdel-outline
chat-filled
chat-outline
check-filled
check-outline
click-filled
click-outline
closecircle-filled
closecircle-outline
close
comment-filled
comment-outline
concern-filled
concern-outline
coupon-filled
coupon-outline
delete-filled
delete-outline
down
download-outline
edit-outline
editarticle-outline
editpassword-outline
effects-filled
effects-outline
equalizer-filled
equalizer-outline
eyeopen-filled
eyeopen-outline
facebook-filled
facebook-outline
female-filled
female-outline
financing-filled
financing-outline
flag-filled
flag-outline
flipcamera-filled
flipcamera-outline
focus-filled
focus-outline
folderclose-filled
folderclose-outline
folderopen-filled
folderopen-outline
framework-filled
framework-outline
friends-filled
friends-outline
fullscreen-outline
func-filled
gift-filled
gift-outline
goods-filled
goods-outline
google-filled
google-outline
guideboard-filled
guideboard-outline
harm-filled
harm-outline
headset-filled
headset-outline
heart-filled
heart-outline
help-filled
help-outline
history-outline
homestay-filled
homestay-outline
hourglass-filled
hourglass-outline
img-outline
info-filled
info-outline
keyboard-filled
keyboard-outline
label-filled
label-outline
left
lightning-filled
lightning-outline
like-outline
local-filled
local-outline
localpin-filled
localpin-outline
lock-outline
luggage-filled
luggage-outline
magic-filled
magic-outline
male-filled
male-outline
mallbag-filled
mallbag-outline
menu-filled
menu-outline
message-filled
message-outline
microphone-filled
microphone-outline
monitor-filled
monitor-outline
more-filled
more-outline
morethen-filled
morethen-outline
movie-filled
movie-outline
music-filled
music-outline
navigation-filled
navigation-outline
pause-filled
pause-outline
pennant-filled
pennant-outline
pic-filled
pic-outline
platte-filled
platte-outline
play-filled
play-outline
playwrong-filled
playwrong-outline
plus
ppt-filled
ppt-outline
print-filled
print-outline
protect-filled
protect-outline
percentage
redo-outline
reducecircle-outline
reducesquare-outline
refresh-outline
replay-filled
replay-outline
right
ring-filled
ring-outline
roadsign-filled
roadsign-outline
rotate-filled
rotate-outline
save-filled
save-outline
scale-filled
scale-outline
scan-outline
screenshot-outline
search-filled
search-outline
setting-filled
setting-outline
share-outline
sharing-filled
sharing-outline
shop-filled
shop-outline
shutdown-outline
soapbubble-filled
soapbubble-outline
sort-filled
sort-outline
star-filld
starhalf-filld
success-filled
success-outline
system-outline
tag-filled
tag-outline
time-outline
tips-filled
tips-outline
tool-filled
tool-outline
trademark-filled
trademark-outline
tree-filled
tree-outline
trigondown-filled
trigondown-outline
trigonleft-filled
trigonleft-outline
trigonright-filled
trigonright-outline
trigonup-filled
trigonup-outline
turndown-filled
turndown-outline
turnleft-filled
turnleft-outline
turnright-filled
turnright-outline
turnup-filled
turnup-outline
unfullscreen-outline
unlock-outline
up
upload-outlin
users-outline
voice-filled
voice-outline
volume-fille
volume-outline
volumedown-filled
volumedown-outline
volumemute-filled
volumemute-outline
volumenotice-filled
volumenotice-outline
volumeup-filled
volumeup-outline
wallet-filled
wallet-outline
wifi-outline
workbench-filled
workbench-outline
zoomin-filled
zoomin-outline
zoomout-fille
zoomout-outline
keyhole-filled
keyhole-outline
headphone-filled
headphone-outline
iphone-filled
iphone-outline
code-input

darkColor

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

Events

事件名说明参数
click文字被点击时触发

示例代码

html
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :bold="true">
			<template v-slot:right>
				<!-- #ifndef MP -->
				<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
				<!-- #endif -->
			</template>
		</ux-navbar>
		
		<ux-scroll ref="uxScrollRef" :backtop="true" :loadmore-enabled="true" @loadmore="load">
			<ux-card direction="column" icon="flag-filled" title="图标" :bold="true">
				<ux-text text="常用字体图标集,包含了大多数常见场景的图标"></ux-text>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="300+图标" :bold="true">
				<view class="grid">
					<view class="icon" v-for="(icon, i) in iconList" :key="i" @click="onCopy(icon.name)">
						<ux-icon :type="icon.icon" :size="24"></ux-icon>
						<ux-text :text="icon.name" :lines="1" :mt="5"></ux-text>
					</view>
				</view>
			</ux-card>
			
		</ux-scroll>
	</ux-page>
</template>
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :bold="true">
			<template v-slot:right>
				<!-- #ifndef MP -->
				<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
				<!-- #endif -->
			</template>
		</ux-navbar>
		
		<ux-scroll ref="uxScrollRef" :backtop="true" :loadmore-enabled="true" @loadmore="load">
			<ux-card direction="column" icon="flag-filled" title="图标" :bold="true">
				<ux-text text="常用字体图标集,包含了大多数常见场景的图标"></ux-text>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="300+图标" :bold="true">
				<view class="grid">
					<view class="icon" v-for="(icon, i) in iconList" :key="i" @click="onCopy(icon.name)">
						<ux-icon :type="icon.icon" :size="24"></ux-icon>
						<ux-text :text="icon.name" :lines="1" :mt="5"></ux-text>
					</view>
				</view>
			</ux-card>
			
		</ux-scroll>
	</ux-page>
</template>
ts
<script setup>
	import * as plus from '@/uni_modules/ux-plus'
	import { iconfont } from "@/static/iconfont"

	type Icon = {
		name : string,
		icon : string
	}
	
	const title = ref('')
	let data = [] as Icon[]
	let iconList = ref<Icon[]>([] as Icon[])
	let pageNum = 1
	let pageSize = 30
	
	const uxScrollRef = ref<UxScrollComponentPublicInstance | null>(null)
	
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/icon.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	function getList() : Icon[] {
		const startIndex = (pageNum - 1) * pageSize;
		const endIndex = startIndex + pageSize;
		return data.slice(startIndex, endIndex);
	}
	
	function load() {
		pageNum++
		iconList.value = iconList.value.concat(getList())
		uxScrollRef.value!.loadSuccess(data.length == iconList.value.length)
	}
	
	function onCopy(icon: string) {
		plus.setClipboardData(icon)
		uni.showToast({
			title: icon,
			icon: 'none'
		})
	}
	
	onLoad((e) => {
		title.value = e['title'] ?? ''
		
		let icons = iconfont as UTSJSONObject
		icons.toMap().forEach((v : any | null, k : string) => {
			data.push({
				name: k,
				icon: v! as string,
			} as Icon)
		})
		
		setTimeout(() => {
			iconList.value = getList()
		}, 300);
	})
</script>
<script setup>
	import * as plus from '@/uni_modules/ux-plus'
	import { iconfont } from "@/static/iconfont"

	type Icon = {
		name : string,
		icon : string
	}
	
	const title = ref('')
	let data = [] as Icon[]
	let iconList = ref<Icon[]>([] as Icon[])
	let pageNum = 1
	let pageSize = 30
	
	const uxScrollRef = ref<UxScrollComponentPublicInstance | null>(null)
	
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/icon.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	function getList() : Icon[] {
		const startIndex = (pageNum - 1) * pageSize;
		const endIndex = startIndex + pageSize;
		return data.slice(startIndex, endIndex);
	}
	
	function load() {
		pageNum++
		iconList.value = iconList.value.concat(getList())
		uxScrollRef.value!.loadSuccess(data.length == iconList.value.length)
	}
	
	function onCopy(icon: string) {
		plus.setClipboardData(icon)
		uni.showToast({
			title: icon,
			icon: 'none'
		})
	}
	
	onLoad((e) => {
		title.value = e['title'] ?? ''
		
		let icons = iconfont as UTSJSONObject
		icons.toMap().forEach((v : any | null, k : string) => {
			data.push({
				name: k,
				icon: v! as string,
			} as Icon)
		})
		
		setTimeout(() => {
			iconList.value = getList()
		}, 300);
	})
</script>
css
<style lang="scss">
	.grid {
		width: 100%;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;

		.icon {
			width: 33.3%;
			height: 70px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			border: 0.5px solid #e5e5e5;
			box-sizing: border-box;
		}
	}
</style>
<style lang="scss">
	.grid {
		width: 100%;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;

		.icon {
			width: 33.3%;
			height: 70px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			border: 0.5px solid #e5e5e5;
			box-sizing: border-box;
		}
	}
</style>