赞
踩
npm install axios
在main.js中
- import axios from 'axios'
- Vue.prototype.$http = axios
发送get请求:
- this.$http.get(this.submitUrl, {
- params: {
- name: this.admin.username,
- pass: this.admin.pass
- }
- })
- .then((res) => {
- console.log(res);
- })
- .catch((res) => {
- console.log(res);
- })
发送post请求:
- let book={
- bname:this.product.bname,
- author:this.product.author
- }
- this.$http.post(this.addUrl,book)
- .then((res)=>{
- console.log(res);
- })
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。