Skip to content

Commit d76538e

Browse files
author
issayah
committed
BNav script setup conversion
1 parent fa62c74 commit d76538e

File tree

2 files changed

+44
-45
lines changed

2 files changed

+44
-45
lines changed

src/components/BNav.vue

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,33 @@
44
</ul>
55
</template>
66

7-
<script lang="ts">
8-
import {computed, defineComponent} from 'vue'
7+
<script setup lang="ts">
8+
// import type {BNavProps} from '@/types/components'
9+
import {computed} from 'vue'
910
10-
export default defineComponent({
11-
name: 'BNav',
12-
props: {
13-
align: {type: String},
14-
fill: {type: Boolean, default: false},
15-
justified: {type: Boolean, default: false},
16-
pills: {type: Boolean, default: false},
17-
tabs: {type: Boolean, default: false},
18-
vertical: {type: Boolean, default: false},
19-
},
20-
setup(props) {
21-
const classes = computed(() => ({
22-
'flex-column': props.vertical,
23-
[`justify-content-${props.align}`]: props.align,
24-
'nav-tabs': props.tabs,
25-
'nav-pills': props.pills,
26-
'nav-fill': props.fill,
27-
'nav-justified': props.justified,
28-
}))
11+
interface BNavProps {
12+
align?: string
13+
fill?: boolean
14+
justified?: boolean
15+
pills?: boolean
16+
tabs?: boolean
17+
vertical?: boolean
18+
}
2919
30-
return {
31-
classes,
32-
}
33-
},
20+
const props = withDefaults(defineProps<BNavProps>(), {
21+
fill: false,
22+
justified: false,
23+
pills: false,
24+
tabs: false,
25+
vertical: false,
3426
})
27+
28+
const classes = computed(() => ({
29+
'flex-column': props.vertical,
30+
[`justify-content-${props.align}`]: props.align,
31+
'nav-tabs': props.tabs,
32+
'nav-pills': props.pills,
33+
'nav-fill': props.fill,
34+
'nav-justified': props.justified,
35+
}))
3536
</script>

src/components/BNavItem.vue

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,31 @@
33
<a
44
:href="href"
55
class="nav-link"
6-
:tabindex="disabled ? -1 : null"
7-
:aria-disabled="disabled ? true : null"
6+
:tabindex="disabled ? -1 : undefined"
7+
:aria-disabled="disabled ? true : undefined"
88
>
99
<slot />
1010
</a>
1111
</li>
1212
</template>
1313

14-
<script lang="ts">
15-
import {computed, defineComponent} from 'vue'
14+
<script setup lang="ts">
15+
// import type {BNavItemProps} from '@/types/components'
16+
import {computed} from 'vue'
1617
17-
export default defineComponent({
18-
name: 'BNavItem',
19-
props: {
20-
active: {type: Boolean, default: false},
21-
disabled: {type: Boolean, default: false},
22-
href: {type: String, required: false},
23-
},
24-
setup(props) {
25-
const classes = computed(() => ({
26-
active: props.active,
27-
disabled: props.disabled,
28-
}))
18+
interface BNavItemProps {
19+
active?: boolean
20+
disabled?: boolean
21+
href?: string
22+
}
2923
30-
return {
31-
classes,
32-
}
33-
},
24+
const props = withDefaults(defineProps<BNavItemProps>(), {
25+
active: false,
26+
disabled: false,
3427
})
28+
29+
const classes = computed(() => ({
30+
active: props.active,
31+
disabled: props.disabled,
32+
}))
3533
</script>

0 commit comments

Comments
 (0)