Skip to content

Commit

Permalink
ついでにscript setupに
Browse files Browse the repository at this point in the history
  • Loading branch information
mehm8128 committed Jan 8, 2024
1 parent b496ca9 commit 21b5b89
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 37 deletions.
34 changes: 12 additions & 22 deletions src/components/Index/PageInfoPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,20 @@
</router-link>
</li>
</template>
<script lang="ts">
import { defineComponent, toRef } from 'vue'

<script lang="ts" setup>
import { toRef } from 'vue'
import Icon from '/@/components/UI/Icon.vue'
import useRouteInfo from '/@/lib/routeInfo'
export default defineComponent({
name: 'PageInfoPanel',
components: {
Icon
},
props: {
name: {
type: String,
required: true
},
path: {
type: String,
required: true
}
},
setup(props) {
const routeInfo = useRouteInfo(toRef(props, 'name'))
return { routeInfo }
}
})
interface Props {
name: string
path: string
}
const props = defineProps<Props>()
const routeInfo = useRouteInfo(toRef(props.name))
</script>

<style lang="scss" module>
Expand Down
22 changes: 7 additions & 15 deletions src/components/Index/PageInfoPanels.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<script lang="ts" setup>
import PageInfoPanel from '/@/components/Index/PageInfoPanel.vue'
import { routes } from '/@/lib/routeInfo'
const pages = routes.filter(route => route.name != 'Top')
</script>

<template>
<ul :class="$style.list">
<page-info-panel
Expand All @@ -9,21 +16,6 @@
</ul>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import PageInfoPanel from '/@/components/Index/PageInfoPanel.vue'
import { routes } from '/@/lib/routeInfo'
export default defineComponent({
name: 'PageInfoPanels',
components: { PageInfoPanel },
setup() {
const pages = routes.filter(route => route.name != 'Top')
return { pages }
}
})
</script>

<style lang="scss" module>
.list {
display: flex;
Expand Down

0 comments on commit 21b5b89

Please sign in to comment.