Javascript 将vuejs ID传递给数据url

Javascript 将vuejs ID传递给数据url,javascript,php,html,laravel,vue.js,Javascript,Php,Html,Laravel,Vue.js,我有v-for=“产品中的产品” 如何将product.id传递到数据url? 我尝试: 不工作 $(函数(){ //在侧边栏上启用/禁用产品 $(“.toggle product”)。打开('click',函数(){ var checked=$(this).is(':checked'); var$status=$(this.parents(“.list组项”); $status.addClass('list-group-item-warning'); $.post($(this).data(

我有v-for=“产品中的产品”
如何将product.id传递到数据url? 我尝试:

不工作

$(函数(){
//在侧边栏上启用/禁用产品
$(“.toggle product”)。打开('click',函数(){
var checked=$(this).is(':checked');
var$status=$(this.parents(“.list组项”);
$status.addClass('list-group-item-warning');
$.post($(this).data('url'){
“已启用”:选中?1:0,
“_-token”:“{{csrf_-token()}”
},功能(回应){
$status.removeClass('list-group-item-warning');
}.绑定(本)
});
});
新Vue({
el:“#产品”,
数据:{
产品:[
@foreach(有效产品为$p)
{label:'{{$p->getTranslatedName()}}',id:'{{$p->id}}',@if(!isset($restrictedProductId[$p->id])选中:true@endif},
@endforeach
]
},
计算:{
选中:函数(){
返回此.products.filter(函数(l){
退票
}).map(函数(l){
返回(l})
}
},          
});    

工作?


工作?

谢谢,是的,我在谷歌找到了这个解决方案,无论如何谢谢。谢谢,是的,我在谷歌找到了这个解决方案,无论如何谢谢。
<li class="list-group-item" v-for="product in products">
@{{ product.label }}
<input
type="checkbox" :id="product.id" :value="product.id" v-model="product.checked"
class="toggle-product pull-right"
data-url="{{env('APP_URL')}}/accounts/{{ $account->id }} /albums/{{ $album->id }}/images/{{ $image }}/settings/@{{ product.id }}/toggle">
data-url="{{route('image.settings.product.toggle',[$account,$album,$image,'product.id'])}}
:data-url="'{{env('APP_URL')}}/accounts/{{ $account->id }} /albums/{{ $album->id }}
           /images/{{ $image }}/settings/' + product.id + '/toggle'">