Answer the question
In order to leave comments, you need to log in
Why does the prop value change?
The task is to transfer the default values for the object to VUE from the back.
Process.
Passing from Laravel template blade to VUE props
<filter-component
:default_filter="{{json_encode($default_filter)}}"
>
</filter-component>
props: [
'default_filter'
],
resetFilter() {
this.filter = this.default_filter;
},
<input v-model="filter.name" type="text">
Answer the question
In order to leave comments, you need to log in
If this.default_filter is an object, then it is passed by reference, which means that changing this.filter will also change the default filter. Copy the object like this: https://developer.mozilla.org/en/docs/Web/JavaScri...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question