我正在尝试将 id 从 1 vue 传递到另一个 vue 并获取我的 api 服务的数据。
我能够从第一个 vue (ClientListing.vue) 传递 id,但不知何故我的第二个 vue (Client.vue) 无法检索 id。
我的客户列表.vue
<th scope="row" v-on:click="rowClicked(row)" style="cursor: pointer">
<div class="media align-items-center" @click="showClient(row)">
<a class="avatar rounded-circle mr-3">
<img alt="Image placeholder" :src="row.customerTypeIcon">
</a>
<div class="media-body">
<span class="name mb-0 text-sm">{{row.name}}</span>
</div>
</div>
</th>
methods: {
showClient(item) {
router.push({ path: 'Clients/client', query: { id: item.id } });
}
}
我的客户端.vue
mounted: function () {
CifRepository
.getCustomerDetails(this.$route.query)
.then(response => {
this.model = response.data.Results;
}
)
.catch(error => {
console.log(error)
this.errored = true
})
.finally(() => this.loading = false);
}
getCustomerDetails(id) {
return Repository.get("/api/Accounts/GetCustomerDetails");
}
我的 api 服务 - AccountsController
[HttpGet("GetCustomerDetails")]
public async Task<CustomerListingDto> GetCustomerDetails(long id)
{
CustomerServiceModel customers = await
_accountService.GetCustomerDetailsByCustomerId(id);
return _mapper.Map<CustomerListingDto>(customers);
}
我的 AccountController/GetCustomerDetails 不断获取 0/null 值,并且无法从 ClientListing.vue 获取 id 传递
吃鸡游戏
相关分类