Skip to content
本页导读

Signature

组件类型:UxSignatureComponentPublicInstance

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

平台兼容性

UniApp X

AndroidiOSweb鸿蒙 Next小程序
x

UniApp Vue Nvue

AndroidiOSweb鸿蒙 Next小程序
xxxx

Props

属性名类型默认值说明
textString签名区背景文字
sizeNumber2笔触大小
themeStringinfo主题
colorString$ux.Conf.infoColor笔触颜色
backgroundString$ux.Conf.backgroundColor背景颜色
confirmString确定确定文字
confirmColorString$ux.Conf.primaryColor确定文字颜色
minWidthNumber2最小宽度
maxWidthNumber6最大宽度
minSpeedNumber1.5最小速度
maxHistoryNumber20最大可撤销记录
fullScreenBooleanfalse全屏
formatStringpng图片格式
showBtnsBooleantrue显示操作按钮
disableScrollBooleantrue禁止屏幕滚动
disabledBooleanfalse是否禁用
marginArray边距[上右下左][上下左右][上下左右]
mtNumber距上单位px
mrNumber距右单位px
mbNumber距下单位px
mlNumber距左单位px
paddingArray填充[上右下左][上下左右][上下左右]
ptNumber上内边距单位px
prNumber右内边距单位px
pbNumber下内边距单位px
plNumber左内边距单位px
xstyleArray自定义样式

theme

说明
text文字
info默认
primary主要
success成功
warning警告
error错误

fullScreen

说明
true
false

format

说明
png
jpg

showBtns

说明
true
false

disableScroll

说明
true
false

disabled

说明
true
false

Events

事件名说明参数
change生成签名时触发

示例代码

html
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :border="false">
			<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>
			<ux-card direction="column" icon="flag-filled" title="手写板签名" :bold="true">
				<ux-text text="支持横竖屏切换、支持背景色、笔触大小、笔触颜色、背景颜色配置"></ux-text>
			</ux-card>
			
			<ux-signature ref="signature" :fullScreen="false" :color="color" :size="5" :mt="30" @change="onChange"></ux-signature>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
	</ux-page>
</template>
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :border="false">
			<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>
			<ux-card direction="column" icon="flag-filled" title="手写板签名" :bold="true">
				<ux-text text="支持横竖屏切换、支持背景色、笔触大小、笔触颜色、背景颜色配置"></ux-text>
			</ux-card>
			
			<ux-signature ref="signature" :fullScreen="false" :color="color" :size="5" :mt="30" @change="onChange"></ux-signature>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
	</ux-page>
</template>
ts
<script setup>
	
	
	import * as plus from '@/uni_modules/ux-plus'
	
	const title = ref('')
	const color = ref('red')
	
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/signature.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	onLoad((e) => {
		title.value = e['title'] ?? ''
	})
	
	function onChange(path: string) {
		uni.previewImage({
			urls: [path]
		})
	}
</script>
<script setup>
	
	
	import * as plus from '@/uni_modules/ux-plus'
	
	const title = ref('')
	const color = ref('red')
	
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/signature.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	onLoad((e) => {
		title.value = e['title'] ?? ''
	})
	
	function onChange(path: string) {
		uni.previewImage({
			urls: [path]
		})
	}
</script>
css
<style lang="scss">
	
</style>
<style lang="scss">
	
</style>