✨ (notes) add routing between notes
This commit is contained in:
40
src/components/StackedNote.vue
Normal file
40
src/components/StackedNote.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div class="stacked-note" v-html="content"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, nextTick, watch } from 'vue'
|
||||
import { useFile } from '@/hooks/useFile.hook'
|
||||
import { useLinks } from '@/hooks/useLinks.hook'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'StackedNote',
|
||||
props: {
|
||||
user: { type: String, required: true },
|
||||
repo: { type: String, required: true },
|
||||
sha: { type: String, required: true }
|
||||
},
|
||||
setup(props) {
|
||||
const { content } = useFile(props.user, props.repo, props.sha)
|
||||
const { listenToClick } = useLinks('stacked-note', props.sha)
|
||||
|
||||
watch(content, () => {
|
||||
if (content.value) {
|
||||
nextTick(() => {
|
||||
listenToClick()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return { content }
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.stacked-note {
|
||||
text-align: left;
|
||||
border-left: 1px solid rgba(18, 19, 58, 0.2);
|
||||
padding-left: 1rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user