关于网友提出的“(vue.js)vue这样做提交可以吗”问题疑问,本网通过在网上对“(vue.js)vue这样做提交可以吗”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:(vue.js)vue这样做提交可以吗
描述: 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
解决方案1:如果你问的是对象里是否可以写name= goodsname
,那不可以。
你的问题在于vue-resource
的用法姿势不对,参数应该这么传:
this.$http({
url: 'http://localhost/wang/index.php/Home/Goods/createGoods',
method: 'POST',
data: {
cid: this.cid,
name: this.goodsname,
sort: this.sort,
price: this.price,
desc: this.desc
}
}).then(function(response) {
alert('创建成功');
}, function(response) {
// error callback
});
以上介绍了“(vue.js)vue这样做提交可以吗”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1490345.html