wip: refactor(client): migrate components to composition api

This commit is contained in:
syuilo
2022-01-15 17:58:35 +09:00
parent ffc07a08d7
commit 41e18aa993
5 changed files with 100 additions and 156 deletions

View File

@ -20,30 +20,17 @@
</svg>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
<script lang="ts" setup>
import { } from 'vue';
export default defineComponent({
props: {
value: {
type: Number,
required: true
}
},
data() {
return {
r: 0.45
};
},
computed: {
color(): string {
return `hsl(${180 - (this.value * 180)}, 80%, 70%)`;
},
strokeDashoffset(): number {
return (1 - this.value) * (Math.PI * (this.r * 2));
}
}
});
const props = defineProps<{
value: number;
}>();
const r = 0.45;
const color = $computed(() => `hsl(${180 - (props.value * 180)}, 80%, 70%)`);
const strokeDashoffset = $computed(() => (1 - props.value) * (Math.PI * (r * 2)));
</script>
<style lang="scss" scoped>