2👍
You can’t use Razor ‘inside’ a Vue component because Razor generates the page server-side before Vue gets to do its stuff in the browser. What you have there is a Vue component inside a Razor page. elType is defined as a Vue prop, so it likely isn’t in your view bag?
In any case, please don’t do this! Use Razor or Vue. If you choose Vue, your vue components are static .js or .vue files, your data arrives via AJAX calls, and you loop through elTypes with v-for
, in the browser. Any other way will lead to madness 🙂
- [Vuejs]-How can I use my svg icons with q-btn-toggle
- [Vuejs]-Chaining different API calls in a Vue component including one with a for loop
1👍
You could send your razor with props to the component if necessary:
View file
<component-name :prop1="@Model.somethingOtherThanString" prop2="@Model.aString"></component-name>
Vue file
props: {
prop1: Boolean,
prop2: String
}
👤Per
Source:stackexchange.com