-
-
Notifications
You must be signed in to change notification settings - Fork 237
/
typescript-vue3.fixture
63 lines (55 loc) · 958 Bytes
/
typescript-vue3.fixture
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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>