element ui实际操作
其实从上周就开始写学长的项目了。
感觉之前学的也不是太熟练,js都忘了。。。
这周主要在写前端页面和js表单验证。
上图:
这个是登录界面的js
methods: { check() { var ret = /^[a-zA-Z]w{5,17}$/; if (this.form.username == "") { this.$message("账号/用户名不能为空!"); } else if (this.form.password == "") { this.$message("密码不能为空!"); } else if(!ret.test(this.form.password)) { this.$message("密码必须以字母开头,且只能包含字母、数字和下划线,长度在6~18之间!"); } else { $.ajax({ type:"POST", url:"${pageContext.request.contextPath}/user/check.json", //contentType:"application/json; charset=utf-8", data:{"username":this.form.username,"password":this.form.password}, dataType:"json", success:function() { if(data.message.code == 1) { //成功 $(".form1").hide(); $(".form2").show(); } else if(data.message.code == 0) { //为空 this.showError = true; this.errorMsg = data.message.msg; } else { //用户名已存在 this.showError = true; this.errorMsg = data.message.msg; } }, });
其他的页面也写了点,但是验证的js一直有报错。(我就不放上来丢人现眼了)
这两周都忙着复习,单片机,电机学真的好烦啊啊啊。
下周争取把前端页面全部写完!
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: 有序数组的查找
- 下一篇: Qt中对于类似数组的输出