Define a macro for returning the setup object #616
matthew-dean
started this conversation in
Ideas
Replies: 1 comment
-
Note, apparently, TypeScript thinks it's fine to write: <script setup>
import { TagsModel } from './TagsVm'
defineOptions({
setup(props) {
return TagsModel(props)
}
})
</script> However, it's not clear that would actually work, and Volar doesn't know how to interpret the return types. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Use case
I'm converting a Knockout site to Vue, which separates all models / methods / variables into classes.
Without using
<script setup>
you can do this:However, I'd much rather use
<script setup>
, but as far as I know, there's no way to "assign" the return value object to mimic the same pattern here.Proposal
Something like
defineScope
which allows you to return an object that will be bound to the template, exactly the same as the return value ofsetup()
Beta Was this translation helpful? Give feedback.
All reactions