Skip to content

Commit 5c84b2f

Browse files
committed
perf: little imporves & tweak
1 parent b3248a0 commit 5c84b2f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ declare var Vue: any
88

99
interface RegisterOptions {
1010
template: string
11-
script: string
11+
options: string
1212
}
1313

1414
export function stripDemoBlock(text: Text): Text {
@@ -30,22 +30,22 @@ export function parseComponent(text: Text): RegisterOptions {
3030
.replace(JS_RE, '')
3131
// Replace all style tag to docute built-in component `<v-style>`
3232
.replace(/<(\/?)style>/g, '<$1v-style>')
33-
const script = matchedScript.replace(MODULE_JS_RE, '$2').replace(JS_RE, '')
33+
const options = matchedScript.replace(MODULE_JS_RE, '$2')
3434

3535
return {
3636
template,
37-
script
37+
options
3838
}
3939
}
4040

4141
export function registerComponent(
42-
{ template, script }: RegisterOptions,
42+
{ template, options }: RegisterOptions,
4343
id: number
4444
) {
4545
if (!Vue) return
4646

4747
const resolveComponent = new Function(
48-
`return {template: \`<section>${template}</section>\`,${script}}`
48+
`return {template: \`<section>${template}</section>\`,${options}}`
4949
)
5050

5151
Vue.component(`Demo${id}`, resolveComponent())

0 commit comments

Comments
 (0)