testaxios.vue 2.09 KB
<template>
    <div>
        <Row>
            <Col span="24">
            <div class="content">
                <Form ref='data'
                      :model="data"
                      :label-width="80"
                      class="demo-ruleForm card-box loginform">
                    <h3 class="title">系统登录</h3>
                    <Form-item label="帐号"
                               prop="username">
                        <Input type="text"
                               v-model="data.username"></Input>
                    </Form-item>
                    <Form-item label="密码"
                               prop="password">
                        <Input type="password"
                               v-model="data.password"></Input>
                    </Form-item>
                    <Form-item>
                        <Button type="primary"
                                @click='login()'>提交</Button>
                        <Button type="primary"
                                @click='loginError()'>错误提交</Button>
                        <Button type="ghost"
                                style="margin-left: 8px">重置</Button>
                    </Form-item>
    
                </Form>
            </div>
            </Col>
        </Row>
    </div>
</template>
<script>
export default {
    name: 'content',
    data() {
        return {
            data: {
                username: '',
                password: '',
                // token: ''
            },
        }
    },
    methods: {
        login() {
            var self = this;
            console.log(self.data.username);
            this.axios.get("public/act/getAll").then((res) => {
                console.log(JSON.stringify(error));
                console.log("页面里面:" + res);
            })
        },
        loginError(){
            this.axios.get("test/axioserror").then((res) => {
                console.log("页面里面:" + res);
            }).catch((error)=>{
                console.log(error);
            })
        }
    },
    created() {

    },
    mounted() {

    }
}
</script>