我是Laravel的新手。我需要将自由职业者在Blade文件中编写的JS代码移动到JS文件。
@if(\Request::route()->getName() == 'profile')
// Change Password
@if ($errors->has('old_password') || $errors->has('password'))
$('#changePassword').modal('show');
@endif
@if (\Session::has('pass_error'))
$('#changePassword').modal('show');
@endif
@endif
@if (Session::has('comment_error') || Session::has('comment_success'))
$('#intrest').show();
$('#intrest_comment').focus();
$('html, body').animate({
scrollTop: $("#intrest_comment").offset().top
}, 1000);
@endif
根据我的说法,可以将其移至JS文件。 Laravel无法实现的其他方法吗?