123456789101112131415161718192021222324252627282930313233343536373839404142 |
- let app = new Vue({
- el: '#app',
- data () {
- return {
- accounts:'',
- password:'',
- userList:[
- {accounts:'123',password:'123'},
- {accounts:'admin',password:'123456'}
- ]
- }
- },
- created () {
- },
- beforeDestroy () {
- },
- mounted () {
- },
- methods: {
- goIndex(){
- let that = this
- for(let a = 0;a<this.userList.length;a++){
- if(this.userList[a].accounts == this.accounts){
- if(this.userList[a].password == this.password){
- this.$message({
- message: '登录成功',
- type: 'success'
- });
- sessionStorage.setItem('accounts',this.accounts);
- sessionStorage.setItem('password',this.password);
- setTimeout(()=>{
- window.location.href = '../index.html'
- },1000)
- return
- }
- }
- }
- this.$message.error('用户名不存在或密码错误');
- }
- },
- })
|