IMO using props in option api was more clean looking way to declare props but I still want to use setup function.
As far as I know the this
in setup doesn’t refer to the component. But I still want to use it . Is this possible anyhow.
Technically you can mix the two, however it is greatly discouraged.
Primarily because of this:
- Variables created inside
<script setup>
are not added as properties to the component instance, making them inaccessible from the Options API. Mixing APIs in this way is strongly discouraged.
Relevant to docs: <script setup> | Vue.js
1 Like