HTML:

<el-form ref="newTermDetail" :model="newTermDetail" class="auto_form">
<div :style="operation =='new' ? 'margin-left: 50px' : 'margin-left: 20px'">
<el-form-item
v-for="(domain, index) in newTermDetail.questions"
:label="operation == 'new' ? ' ' : '' + domain.id"
:key="'term' + index"
:prop="'questions.' + index + '.s_question'"
:style="index == 0 ? 'margin-top: 0; margin-bottom: 20px;' : 'margin: 20px auto;'"
:rules="[{ required: true, validator: checkInputValid, message: '请输入中英文', trigger: ['blur','change'] }]">
<el-input style="width: 300px;" type="textarea" autosize v-model="domain.s_question"></el-input>
<el-button @click.prevent="removeTermDomain(domain, index)">删除</el-button>
</el-form-item>
</div>
</el-form>

js data:

  data() {
let checkInput = (rules, value, callback) => {
const regex = new RegExp("^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z ]|[,、?。!,?.!])+$");
if(!regex.test(value) || !value) {
callback(new Error('请输入中英文语句'));
}else {
callback();
}
  }
return {
checkInputValid: checkInput,
newTermDetail: {
questions: [
{ s_question: ''},
{ s_question: ''}
]
}
};
},

推荐网址:https://blog.csdn.net/uncle_long/article/details/80257389

最新文章

  1. LinkedList详细分析
  2. SQLserver2008如何把表格变量传递到存储过程中
  3. Effective C++ 2.构造 析构 赋值运算
  4. JavaScript对象(document对象 图片轮播)
  5. VBS基础篇 - wscript 对象
  6. java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file Server/Request
  7. repeater灵活运用、repeater的commmand用法、如何不用repeater展示数据
  8. MySql 取一天的开始时间和结束时间
  9. iOS 将系统文字设置为中文
  10. Java之数字处理类浅析
  11. OpenCV1.0在VC ++6.0下的配置
  12. 简单Spring+Struts2+Hibernate框架搭建
  13. CCF系列之矩阵(201512-5)
  14. disptch_after 自递归
  15. Linux系统内存占用90%以上——解决方法
  16. 手把手用Monkey写一个压测脚本
  17. 1091 N-自守数
  18. Hexo+Github搭建博客问题
  19. ThreadPoolExecutor简单学习
  20. spark shell学习笔记

热门文章

  1. 33 Python 详解命令解析 - argparse--更加详细--转载
  2. 获取IP及判断IP是否在区间
  3. 将.db文件导入SQLServer2008数据库
  4. [转]fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突
  5. Android JNI 传递对象
  6. java web 方面
  7. cyberduck的SSH登录
  8. Lua --- 输入一个数字,输出阶乘
  9. 第 3 章 镜像 - 020 - 搭建本地 Registry
  10. value,text,attr等区别