Skip to content

Commit 9f4f003

Browse files
remove defineProps warn
1 parent e8ed92f commit 9f4f003

File tree

7 files changed

+51
-14
lines changed

7 files changed

+51
-14
lines changed

src/components/body.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineProps, h } from 'vue'
1+
import type { PropType } from 'vue'
2+
import { h } from 'vue'
23
import header from './header'
34
import main from './main'
45
import type { Podcast } from '~/models/Podcast'
@@ -8,7 +9,12 @@ interface Props {
89
}
910

1011
export default {
11-
props: defineProps<Props>(),
12+
props: {
13+
podcast: {
14+
type: Object as PropType<Podcast>,
15+
required: true,
16+
},
17+
},
1218
setup(props: Props) {
1319
return h('body', [
1420
header.setup({ podcast: props.podcast }),

src/components/head.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
import { defineProps, h } from 'vue'
1+
import { h } from 'vue'
22

33
interface Props {
44
title?: string
55
css?: string
66
}
77

88
export default {
9-
props: defineProps<Props>(),
9+
props: {
10+
title: {
11+
type: String,
12+
required: false,
13+
},
14+
css: {
15+
type: String,
16+
required: false,
17+
},
18+
},
1019
setup(props: Props) {
1120
return h('head', [
1221
h('meta', {

src/components/header.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
import { defineProps, h } from 'vue'
1+
import type { PropType } from 'vue'
2+
import { h } from 'vue'
23
import type { Podcast } from '~/models/Podcast'
34

45
interface Props {
56
podcast?: Podcast
67
}
78

89
export default {
9-
props: defineProps<Props>(),
10+
props: {
11+
podcast: {
12+
type: Object as PropType<Podcast>,
13+
required: true,
14+
},
15+
},
1016
setup(props: Props) {
1117
const subscribe = {
1218
en: 'Subscribe to podcast',

src/components/html.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineProps, h } from 'vue'
1+
import type { PropType } from 'vue'
2+
import { h } from 'vue'
23
import head from './head'
34
import body from './body'
45
import type { Podcast } from '~/models/Podcast'
@@ -9,7 +10,16 @@ interface Props {
910
}
1011

1112
export default {
12-
props: defineProps<Props>(),
13+
props: {
14+
podcast: {
15+
type: Object as PropType<Podcast>,
16+
required: true,
17+
},
18+
css: {
19+
type: String,
20+
required: false,
21+
},
22+
},
1323
setup(props: Props) {
1424
return h('html', {
1525
lang: props.podcast.language,

src/components/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Options {
1111
}
1212
}
1313

14-
async function createDom(options: Options): Promise<string> {
14+
async function renderDom(options: Options): Promise<string> {
1515
const css = await readFile(`${cwd()}/src/components/feed.css`, 'utf-8')
1616
options.props.css = css
1717

@@ -21,5 +21,5 @@ async function createDom(options: Options): Promise<string> {
2121
}
2222

2323
export {
24-
createDom,
24+
renderDom,
2525
}

src/components/main.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
import { defineProps, h } from 'vue'
1+
import type { PropType } from 'vue'
2+
import { h } from 'vue'
23
import type { Podcast } from '~/models/Podcast'
34

45
interface Props {
56
podcast?: Podcast
67
}
78

89
export default {
9-
props: defineProps<Props>(),
10+
props: {
11+
podcast: {
12+
type: Object as PropType<Podcast>,
13+
required: true,
14+
},
15+
},
1016
setup(props: Props) {
1117
const published = {
1218
en: 'Published',

src/models/Podcast.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createDom } from '../components'
1+
import { renderDom } from '../components'
22
import type { Channel } from '../types'
33
import { Episode } from './Episode'
44

@@ -89,7 +89,7 @@ export class Podcast {
8989
}
9090

9191
public async render(): Promise<string> {
92-
return await createDom({
92+
return await renderDom({
9393
props: {
9494
podcast: this,
9595
},

0 commit comments

Comments
 (0)