html效果图 v-model的属性不是item中的js:var vm = new Vue({ el:'#mygifiTCdiv', data:{ items:[// {pay:"1"}, ], pay:[],//pay:''因为是多个inout 所以是数组的形式 }, created: function(){ this.getRoute(); }, //在 methods中定义方法函数 methods: { getRoute: function () { var that = this; var url= path+"/packageProduct/selectPackageProductByAddressIdAndType"; this.$http.post('http://localhost:8080/ArtAppInst2/packageProduct/selectPackageProductByAddressIdAndType',{ "addressId":storageAddressId, "token":token, "packageType":8, }, { emulateJSON:true }).then(function(response){ console.log(response.data.msg); that.data = response.data.msg; that.items = response.data.body.packageProducts; console.log(that.items); },function(response){ alert(response.msg) }); }, buyPackageBtn:function(id){ alert(id) } } })感谢大神们指点^^^^^
1 回答
夜舞暗澜
TA贡献19条经验 获得超7个赞
如果你打算同时显示,那么就必须设置成一一对应的。
一种方式是给传入的items加一层处理,每个item里加一个pay;
另一种方式是将pay写成数组,然后绑定对应值:v-model="pay[index]"
添加回答
举报
0/150
提交
取消