chore(playground): upgrade to script setup
syntax and TypeScript
#2490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrade the playground package to use the
<script setup>
syntax and TypeScript. This change makes the playground more consistent with recent Vue.js practices and improves type safety.Keep the purpose of each example identical to the original examples as much as possible. Therefore, components using
beforeRouteEnter()
, which does not have a<script setup>
equivalent, are not converted to<script setup>
syntax but are only converted to use TypeScript for improved type safety (Home.vue and ComponentWithData.vue). Converting these to use the recommended data loaders ordefineMacro()
could be an option in the future.Update
RouteNamedMap
in main.ts to improve type safety and better demonstrate the newer typed routes feature (introduced in [email protected]) in LongView.vue, Nested.vue, and RepeatedParams.vue.Fix type issue in AppLink.vue where
RouterLinkProps
replacesRouterLink.props
.Remove the
name
option from thedefineComponent
calls that used it, because this option is only useful when the component recursively calls itself, but there are not components in this playground project that do so.