后台导航 测试使用原生 ajax

This commit is contained in:
pushuo 2022-09-09 10:58:34 +08:00 committed by Edward Yang
parent 9d65337fbd
commit 5b89353afe
1 changed files with 20 additions and 9 deletions

View File

@ -357,17 +357,28 @@
null; null;
} }
$http.get(url, null, {hload: true, hmsg: true}).then((res) => { $.ajax({
if (res.data) { url: 'admin/'+url,
self.name = res.data; // dataType: 'json',
} else { headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
self.name = '{{ __('admin/builder.text_no_data') }}'; // beforeSend: function() { self.loading = true;; },
complete: function() { self.nameLoading = false; },
success: function (json) {
console.log(json);
} }
}).catch(() => {
self.name = '{{ __('admin/builder.text_no_data') }}';
}).finally(() => {
self.nameLoading = false;
}); });
// $http.get(url, null, {hload: true, hmsg: true}).then((res) => {
// if (res.data) {
// self.name = res.data;
// } else {
// self.name = '{{ __('admin/builder.text_no_data') }}';
// }
// }).catch(() => {
// self.name = '{{ __('admin/builder.text_no_data') }}';
// }).finally(() => {
// self.nameLoading = false;
// });
}, },
} }
}); });