axios用法:

npm install axios --save-dev

2.导入:

import axios from 'axios';

3.使用($(form)需要先按装jQuery)

axios.post('http://localhost:3000/users/zhuce',$(form).serialize())
.then(function(res){
console.log(res);
alert(res.data);
})
.catch(function(err){
console.log(err);
})

4.$(form)需要先按装jQuery

npm install  jquery --save-dev 

5.到build/webpack.base.conf.js中,

导入:var webpack = require('webpack');
最下面添加:

plugins: [
new webpack.ProvidePlugin({
$:"jquery",
jQuery:"jquery",
"window.jQuery":"jquery"
})
]

vue文件中无需导入,可直接使用$和jQuery

1.安装

npm install vue-resource --save-dev 

2.main.js中

Vue.use(require('vue-resource'));  //--------添加

3.vue中使用

callKa:function(event){
this.$http.get('http://localhost:3000/',{}).then(function(data){
alert(data.body);
}).catch(function(err){
alert('出错');
for(let key in err){
console.log(key+':'+err[key]);
}
})
}

最新文章

  1. [python] 安装numpy+scipy+matlotlib+scikit-learn及问题解决
  2. 当Table中td内容为空时,显示边框的办法
  3. [OC笔记] Category分类之见解
  4. 说说css3布局
  5. w3school-CSS
  6. ffmpeg中ff_scale_image()内存泄露
  7. python报错Could not open PYTHONSTARTUP
  8. 第一章C语言简介及输出函数 上机部分
  9. 使用 jQuery.Pin 垂直滚动时固定导航
  10. 《About Face 3:交互设计精髓》【PDF】下载
  11. Web APP & 弹窗插件
  12. DUMP3.5 企业级电商项目
  13. 【转】完美解决Python与anaconda之间的冲突问题
  14. 洛谷P3389 【模板】高斯消元法
  15. linux下安装redis组件报错-gcc报错
  16. hbase 定时备份
  17. 【 js 基础 】【 源码学习 】柯里化和箭头函数
  18. 求 1+2+3+ …… +n
  19. [leetcode]340. Longest Substring with At Most K Distinct Characters至多包含K种字符的最长子串
  20. JAVA-随机生成四则运算

热门文章

  1. MySQL InnoDB与MyISAM存储引擎差异
  2. Asp.Net MVC session跨域
  3. 简单的shell语句
  4. winform使用相对路径读取文件的方法
  5. Uva1401(字典树)
  6. SQL Server数据文件迁移
  7. 页面报错Uncaught SyntaxError: Unexpected identifier
  8. 【转】探秘Java中的String、StringBuilder以及StringBuffer
  9. SOA、微服务与服务网格
  10. Kerberos的启动和关闭