0đź‘Ť
Assuming you are passing obj
as context to the view, then you need to wrap the variable in <%= %>
tags:
<people-view componentName="Something" :componentValue="<%= obj.value %>"/>
0đź‘Ť
the problem was that ejs can’t parse camel case component name, the solution is to change “componentName” to “componentname”
<people-view componentname="Something" />
0đź‘Ť
You can also use
<people-view
v-bind:data_one="<%= string_data %>"
v-bind:data_two="<%= JSON.stringify(JSON_data) %>">
</people-view>
You can use the first binding if you send string_data
as a stringified JS Object or you can use the second one to just stringify it as you receive it from the backend route.
The reason is v-bind needs a string value to pass to the component. I used this in a recent project.
- [Vuejs]-Trigger a modal if User is Unauthorized in vue-router
- [Vuejs]-Unable to redirect after login in vuejs
Source:stackexchange.com