login.js 765 B

12345678910111213141516171819202122232425262728293031323334353637
  1. let app = new Vue({
  2. el: '#app',
  3. data () {
  4. return {
  5. accounts:'',
  6. password:'',
  7. userList:[
  8. {accounts:'123',password:'456'},
  9. {accounts:'admin',password:'123456'}
  10. ]
  11. }
  12. },
  13. created () {
  14. },
  15. beforeDestroy () {
  16. },
  17. mounted () {
  18. },
  19. methods: {
  20. goIndex(){
  21. console.log(this.accounts,this.password)
  22. for(let a = 0;a<this.userList.length;a++){
  23. if(this.userList[a].accounts == this.accounts){
  24. if(this.userList[a].password == this.password){
  25. this.$message({
  26. message: '登录成功',
  27. type: 'success'
  28. });
  29. return
  30. }
  31. }
  32. }
  33. this.$message.error('用户名不存在或密码错误');
  34. }
  35. },
  36. })