[Vuejs]-Why vue js component does not showing in laravel blade?

0👍

I think this code is syntactically incorrect, or maybe you left out some parts of the code:

@if($errors->has('password')) :error="'{{$errors->first('password')}}'" @endif></password-input>

Could have been something like:

<password-input>
   if($errors->has('password')) :error="'{{$errors >first('password')}}'" @endif 
</password-input>

0👍

I agree that something seems weird about this line;

@if($errors->has('password')) :error="'{{$errors->first('password')}}'" @endif></password-input>

Did you add the opening part of the component’s tag? I.e. <password-input @if($errors->has('password')) ...


But I don’t think you can have an optional prop in a Vue component, so if there are no errors you wouldn’t be passing anything to the Vue component.

Maybe try something like this:

<password-input
    :error="'{{ $errors->has('password') ? $errors->first('password') : null }}'"
></password-input>

Leave a comment