File tree Expand file tree Collapse file tree 4 files changed +184
-86
lines changed Expand file tree Collapse file tree 4 files changed +184
-86
lines changed Original file line number Diff line number Diff line change 3
3
<template #navbar-search >
4
4
<AlgoliaSearchBox :options =" $site.themeConfig.algolia" />
5
5
</template >
6
- <template #page-top-ads >
6
+ <template #page-top >
7
7
<CarbonAds
8
8
v-if =" $site.themeConfig.carbonAds"
9
- :key =" 'carbon' + $page.path "
9
+ :key =" 'carbon' + $page.relativePath "
10
10
:code =" $site.themeConfig.carbonAds.carbon"
11
11
:placement =" $site.themeConfig.carbonAds.placement"
12
12
/>
13
13
</template >
14
- <template #page-bottom-ads >
14
+ <template #page-bottom >
15
15
<BuySellAds
16
16
v-if =" $site.themeConfig.carbonAds"
17
- :key =" 'custom' + $page.path "
17
+ :key =" 'custom' + $page.relativePath "
18
18
:code =" $site.themeConfig.carbonAds.custom"
19
19
:placement =" $site.themeConfig.carbonAds.placement"
20
20
/>
Original file line number Diff line number Diff line change 2
2
<div class =" carbon-ads" ref =" el" />
3
3
</template >
4
4
5
- <script setup lang="ts">
6
- import { defineProps , ref , onMounted } from ' vue'
5
+ <script lang="ts">
6
+ import { defineComponent , ref , onMounted } from ' vue'
7
7
8
- const { code, placement } = defineProps <{
9
- code: string
10
- placement: string
11
- }>()
8
+ export default defineComponent ({
9
+ props: {
10
+ code: {
11
+ type: String ,
12
+ required: true ,
13
+ },
14
+ placement: {
15
+ type: String ,
16
+ required: true ,
17
+ },
18
+ },
12
19
13
- const el = ref ()
20
+ setup(props ) {
21
+ const el = ref ()
22
+ onMounted (() => {
23
+ const s = document .createElement (' script' )
24
+ s .id = ' _carbonads_js'
25
+ s .src = ` //cdn.carbonads.com/carbon.js?serve=${props .code }&placement=${props .placement } `
26
+ el .value .appendChild (s )
27
+ })
14
28
15
- onMounted (() => {
16
- const s = document .createElement (' script' )
17
- s .id = ' _carbonads_js'
18
- s .src = ` //cdn.carbonads.com/carbon.js?serve=${code }&placement=${placement } `
19
- el .value .appendChild (s )
29
+ // TODO: change on route change
30
+
31
+ return { el }
32
+ },
20
33
})
21
34
</script >
22
35
Original file line number Diff line number Diff line change 101
101
"ts-loader" : " ^8.0.11" ,
102
102
"ts-node" : " ^9.0.0" ,
103
103
"typescript" : " ^4.1.2" ,
104
- "vitepress" : " ^0.9 .1" ,
104
+ "vitepress" : " ^0.8 .1" ,
105
105
"vue" : " ^3.0.3" ,
106
106
"vue-loader" : " ^16.1.0" ,
107
107
"webpack" : " ^5.10.0" ,
You can’t perform that action at this time.
0 commit comments