refactor: move border to screen itself, and use withDefaults
This commit is contained in:
18
app/app.vue
18
app/app.vue
@@ -1,16 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<Screen>
|
||||||
<Screen>
|
<Background />
|
||||||
<Background />
|
<Stats />
|
||||||
<Stats />
|
</Screen>
|
||||||
</Screen>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
.wrapper {
|
|
||||||
width: fit-content;
|
|
||||||
height: fit-content;
|
|
||||||
border: 1px solid red;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -64,7 +64,15 @@ onUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<canvas ref="canvas" :width="SCREEN_WIDTH" :height="SCREEN_HEIGHT" />
|
<canvas
|
||||||
|
ref="canvas"
|
||||||
|
:width="SCREEN_WIDTH"
|
||||||
|
:height="SCREEN_HEIGHT"
|
||||||
|
:style="{
|
||||||
|
margin: '0',
|
||||||
|
border: '1px solid red',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
|
||||||
<slot v-if="canvas" />
|
<slot v-if="canvas" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
const props = defineProps({
|
const props = withDefaults(defineProps<{ x?: number; y?: number }>(), {
|
||||||
x: {
|
x: 0,
|
||||||
type: Number,
|
y: 0,
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const SAMPLES = 60;
|
const SAMPLES = 60;
|
||||||
|
|||||||
Reference in New Issue
Block a user