this.$http({url: 'http://localhost/wang/index.php/Home/Goods/createGoods', method: 'POST'}
,{"cid": this.cid,"name":this.goodsname,"sort":this.sort,"price":this.price,"desc":this.desc}).then(function (response) {
alert("创建成功");
}, function (response) {
// error callback
});
值写得对不对
"name":this.goodsname
是不是name=goodsname
如果你问的是对象里是否可以写
name= goodsname
,那不可以。你的问题在于
vue-resource
的用法姿势不对,参数应该这么传: