syntax highlight working

This commit is contained in:
2022-05-12 19:29:14 +02:00
parent e27c93c5c0
commit 8a4a694b86
9 changed files with 384 additions and 515 deletions

View File

@@ -1,5 +1,8 @@
<template lang="html">
<div v-show="title == selectedTitle">
<div
v-show="title === selectedTitle"
class="tab-content"
>
<slot/>
</div>
</template>
@@ -16,10 +19,16 @@ export default {
},
setup() {
const selectedTitle = inject('selectedTitle')
return {
selectedTitle
}
}
}
</script>
<style>
.tab-content {
padding: 20px;
border-radius: 5px;
}
</style>

View File

@@ -5,7 +5,7 @@
v-for="title in tabTitles"
:key="title"
:class="{ selected: title === selectedTitle }"
@click="selectedTitle = title"
@click="handleClick(title)"
>
{{ title }}
</li>
@@ -30,11 +30,11 @@ export default {
tabTitles
}
},
data: () => ({
selectedIndex: 0,
tabs: []
}),
created() {
methods: {
handleClick(title) {
this.selectedTitle = title
this.$emit('tabActivated', title)
}
},
}
</script>