<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script> <script src="https://unpkg.com/axios/dist/axios.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <input id="test" type="button" @click="get()" value="get01"/> <script> $("#test").click(function () { //get axios.get('/user') .then(function (data) { console.log(data); }) .catch(function (reason) { console.log(reason); }) //get 带参数 axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }) .then(function () { console.log('hello') }); //post axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); }) </script>