這就是為什么我不能按 ID 洗掉的原因,即使代碼在 id 處處于非活動狀態,它是一個 JS 檔案。

這是我在控制器中的洗掉功能
> public function destroy(Estate $estates)
> {
> if ($estates->delete()) {
> return response()->json([
> 'message' => 'Estate deleted successfully',
> 'status_code' => 200
> ], 200);
> } else {
> return response()->json([
> 'message' => 'Can not delete, Some error occured, please try again later',
> 'status_code' => 500
> ], 500);
> }
> }
下面是我的 Vue 方法來啟動洗掉方法,首先是我的按鈕,其次是我的洗掉方法
<button class="btn btn-danger btn-sm" v-on:click="deleteEstate(estate)"> <span class="fas fa-trash-alt"></span></button>
> deleteEstate: async function(estate) {
> if (!window.confirm('Are You sure you want to delete this Estate Record!')) {
> return;
> }
>
> try {
> await estateService.deleteEstate(estate.id);
>
> this.estate = this.estate.filter(obj => {
> return obj.id != estate.id;
> });
> } catch (error) {
>
> }
> }
這是我洗掉的結果,需要一些幫助!

uj5u.com熱心網友回復:
您正在將 /estate/{id} 發送到您的后端。您應該將字串包裹在反引號 ` 中。
uj5u.com熱心網友回復:
在您deleteEstate()使用單引號 '' 但${}操作員需要反引號 `` 才能作業。嘗試改變它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/317415.html
下一篇:Laravel集合展示和短問題
