Skip to content
本页导读

Signature 签名

组件类型:UxSignatureComponentPublicInstance

支持横竖屏切换、支持背景色、笔触大小、笔触颜色、背景颜色配置

平台兼容性

AndroidiOSweb鸿蒙 Next小程序
xx

Props

属性名类型默认值说明
textString'签名区'背景文字
sizeNumber2笔触大小
themeStringprimary主题颜色
colorstring$ux.Conf.infoColor笔触颜色
backgroundString$ux.Conf.backgroundColor背景颜色
confirmString'确定'确定文字
confirmColorString$ux.Conf.primaryColor确定文字颜色
minWidthNumber2最小宽度
maxWidthNumber6最大宽度
minSpeedNumber1.5最小速度
maxHistoryNumber20最大可撤销记录
fullScreenBooleanfalse全屏
formatString'png'图片格式
showBtnsBooleantrue显示操作按钮
disableScrollBooleantrue禁止屏幕滚动
disabledBooleanfalse是否禁用

theme

说明
primary主色
warning警告
success成功
error错误
info文本

darkColor

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

format

说明
pngpng格式
jpgjpg格式

Events

事件名说明参数
change调用 make 生成签名事件event: Function(tempFilePath: string)

API

方法名说明参数
undo撤销-
redo重做-
clear清空-
make生成签名-

示例代码

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/func/signature.html" mode="link"></ux-text>
				</ux-row>
			</ux-card>
			
			<!-- #ifdef APP -->
			<ux-signature ref="signature" :fullScreen="false" :color="color" :size="5" :mt="30" @change="onChange"></ux-signature>
			<!-- #endif -->
			<!-- #ifdef WEB -->
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="cry" text="官方bug,暂不支持Web"></ux-text>
				</ux-row>
			</ux-placeholder>
			<!-- #endif -->
		</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/func/signature.html" mode="link"></ux-text>
				</ux-row>
			</ux-card>
			
			<!-- #ifdef APP -->
			<ux-signature ref="signature" :fullScreen="false" :color="color" :size="5" :mt="30" @change="onChange"></ux-signature>
			<!-- #endif -->
			<!-- #ifdef WEB -->
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="cry" text="官方bug,暂不支持Web"></ux-text>
				</ux-row>
			</ux-placeholder>
			<!-- #endif -->
		</ux-scroll>
	</ux-page>
</template>
ts
<script setup>
	let title = ''
	const color = ref('red')
	
	onLoad((e: OnLoadOptions) => {
		title = e['title'] ?? ''
	})
	
	function onChange(path: string) {
		uni.previewImage({
			urls: [path]
		})
	}
</script>
<script setup>
	let title = ''
	const color = ref('red')
	
	onLoad((e: OnLoadOptions) => {
		title = e['title'] ?? ''
	})
	
	function onChange(path: string) {
		uni.previewImage({
			urls: [path]
		})
	}
</script>
css
<style lang="scss">
	
</style>
<style lang="scss">
	
</style>