Skip to content

Commit

Permalink
fix(twikoo): clicking the like reply button will return to the top (t…
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo-Messi committed Aug 31, 2024
1 parent 3aec9a1 commit 7a97d7d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ export default {
app.component('BoxCube', DocBoxCube)
app.component('Home', HomeUnderline)
app.component('VideoLink', DocVideoLink)
app.component('Twikoo', Twikoo)
}
}
31 changes: 31 additions & 0 deletions docs/guide/twikoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,34 @@ export default {
...
}
```

## 在首页使用

```ts
//.vitepress/theme/index.ts
import DefaultTheme from 'vitepress/theme'
import { h } from 'vue'// [!code ++]
import { Twikoo } from '@theojs/lumen'// [!code ++]
export default {
extends: DefaultTheme,
enhanceApp: ({ app }) => {// [!code ++]
app.component('Twikoo', Twikoo)// [!code ++]
}// [!code ++]
...
}
```

```md
<!-- index.md -->

---

layout: home

---

<Twikoo :Twikoo_Data="{ envId: 'https://xxxxxx' }" />
<!-- 修改成部署的Twikoo地址 -->
```
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ features:
--vp-home-hero-image-background-image: none !important;
}
</style>

<!-- <Twikoo :Twikoo_Data="{ envId: 'https://share-twikoo.netlify.app/.netlify/functions/twikoo' }" /> -->
11 changes: 10 additions & 1 deletion packages/Lumen/components/DocTwikoo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,14 @@ watch(
</script>

<template>
<div :key="key" id="twikoo"></div>
<div class="comment-container vp-raw">
<div id="twikoo"></div>
<component
:is="'script'"
src="https://cdn.jsdelivr.net/npm/twikoo@1.6.39/dist/twikoo.min.js"
crossorigin="anonymous"
ref="twikooJs"
></component>
</div>
<!-- <div :key="key" id="twikoo"></div> -->
</template>
13 changes: 12 additions & 1 deletion packages/Solis/components/Twikoo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,16 @@ watch(

<template>
<!-- 仅在路径为 /posts/ 开头时渲染评论组件 -->
<div v-if="isPostPage" :key="key" id="twikoo"></div>
<div v-if="isPostPage" class="comment-container vp-raw">
<div id="twikoo"></div>
<component
:is="'script'"
src="https://cdn.jsdelivr.net/npm/twikoo@1.6.39/dist/twikoo.min.js"
crossorigin="anonymous"
ref="twikooJs"
></component>
</div>
<!-- <template>
<div v-if="isPostPage" :key="key" id="twikoo"></div>
</template> -->
</template>

0 comments on commit 7a97d7d

Please sign in to comment.