输入框弹框 $prompt的inputValidator用法

<script>
const promptRes = await this.$prompt('请输入原因', '提示', {
    
    
	confirmButtonText: '确定',
	cancelButtonText: '取消',
	inputValidator: (value) => {
    
    
		if (!value.trim()) {
    
    
			return '内容不能为空';
		}
		if (value.length > 40) {
    
    
			return '内容不能超过40个字符';
		}
		return true;
	},
});
</script>

猜你喜欢

转载自blog.csdn.net/weixin_44696269/article/details/132382507