im using laravel and Vuejs
how can i set the input old value on refresh or back to the page in vue dynamic component
something like this :
value="{{ old('name') }}
im using laravel and Vuejs
how can i set the input old value on refresh or back to the page in vue dynamic component
something like this :
value="{{ old('name') }}
In your blade file, create a new script tag:
<script>
var oldFormData = {
name: "{{ old('name') }}",
//...
}
</script>
Then in your component created callback.
created() {
this.name = oldFormData.name // This should get {{ old('name') }} value
}
You could also pass the old data via Vue component props.
Let's say your component is my-form, then it should look like this in your blade file:
<my-form :oldData="{name: '{{ old('name') }}'}"></my-form>
Then on created:
props: ['oldData'],
created() {
this.name = this.oldData.name
}
oldFormData object.