-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support "setup" attribute in <script> tag in vue 3 (#676)
In Vue 3, when <script> tag has "setup" attribute, SFC parser assign script block to a separate field called "scriptSetup" ✅ Closes: #668
- Loading branch information
1 parent
551f2fb
commit 40e4ecf
Showing
9 changed files
with
1,149 additions
and
1,137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/// src/App.vue | ||
<template> | ||
<LoginView /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import LoginView from "@/component/LoginView.vue"; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/// src/App.vue | ||
<template> | ||
<Header title="My App" /> | ||
<Logo /> | ||
<LoginView /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Header from './component/Header.vue'; | ||
import Logo from './component/Logo.vue'; | ||
import LoginView from './component/LoginView.vue'; | ||
</script> | ||
|
||
/// src/component/Header.vue | ||
<template> | ||
<h1>{{ title }}</h1> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps({ | ||
title: String, | ||
}); | ||
</script> | ||
|
||
<!-- Add "scoped" attribute to limit CSS to this component only --> | ||
<style scoped> | ||
h1 { | ||
font-size: 32px; | ||
} | ||
</style> | ||
|
||
/// src/component/Logo.vue | ||
<template> | ||
<img src="public/logo.png" v-bind:class="size" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
interface Props { | ||
size: 'sm' | 'lg' | 'xl'; | ||
} | ||
withDefaults(defineProps<Props>(), { | ||
size: 'sm' | ||
}) | ||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
inheritAttrs: false, | ||
customOptions: {} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
img { | ||
width: 100%; | ||
} | ||
.sm { | ||
width: 50%; | ||
} | ||
.xl { | ||
width: 200%; | ||
} | ||
</style> |
Oops, something went wrong.