Commit 7a1aa88c by Lin

style:文本域禁止空格换行

1 parent 0498b34b
...@@ -268,12 +268,16 @@ Page({ ...@@ -268,12 +268,16 @@ Page({
}, },
/** /**
* Textarea 输入处理(带字数统计) * Textarea 输入处理(带字数统计)- 禁止空格和换行
*/ */
handleTextareaInput(e) { handleTextareaInput(e) {
const { field } = e.currentTarget.dataset const { field } = e.currentTarget.dataset
const { value } = e.detail let value = e.detail.value
const { formData } = this.data const { formData } = this.data
// 过滤掉空格和换行符
value = value.replace(/[\s\r\n]/g, '')
formData[field] = value formData[field] = value
formData[field + 'Length'] = value.length // 统计字数 formData[field + 'Length'] = value.length // 统计字数
this.setData({ this.setData({
......
...@@ -236,11 +236,15 @@ Page({ ...@@ -236,11 +236,15 @@ Page({
formList formList
}); });
}, },
// textarea输入变化 // textarea输入变化,禁止空格和换行
onTextareaInput(e) { onTextareaInput(e) {
const index = e.currentTarget.dataset.index; const index = e.currentTarget.dataset.index;
const value = e.detail.value; let value = e.detail.value;
const formList = this.data.formList; const formList = this.data.formList;
// 过滤掉空格和换行符
value = value.replace(/[\s\r\n]/g, '');
// 更新对应项的值 // 更新对应项的值
formList[index].value = value; formList[index].value = value;
formList[index].displayValue = value; formList[index].displayValue = value;
......
...@@ -287,12 +287,3 @@ page { ...@@ -287,12 +287,3 @@ page {
background-color: #1989fa; background-color: #1989fa;
color: #fff; color: #fff;
} }
/* 自定义对话框样式 */
.custom-dialog {
height: 364px !important;
}
.custom-dialog .van-dialog {
height: 364px !important;
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!