8000 use SFC syntax in basic example · vuejs/rfcs@79c933a · GitHub
[go: up one dir, main page]

Skip to content

Commit 79c933a

Browse files
authored
use SFC syntax in basic example
1 parent f8b4dfe commit 79c933a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

active-rfcs/0000-function-api.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ Expose logic-related component options via function-based APIs instead.
99

1010
# Basic example
1111

12-
``` js
12+
``` vue
13+
<script>
1314
import { value, computed, watch, onMounted } from 'vue'
1415
15-
const App = {
16-
template: `
17-
<div>
18-
<span>count is {{ count }}</span>
19-
<span>plusOne is {{ plusOne }}</span>
20-
<button @click="increment">count++</button>
21-
</div>
22-
`,
16+
export default {
2317
setup() {
2418
// reactive state
2519
const count = value(0)
@@ -43,6 +37,15 @@ const App = {
4337
}
4438
}
4539
}
40+
</script>
41+
42+
<template>
43+
<div>
44+
<span>count is {{ count }}</span>
45+
<span>plusOne is {{ plusOne }}</span>
46+
<button @click="increment">count++</button>
47+
</div>
48+
</template>
4649
```
4750

4851
# Motivation

0 commit comments

Comments
 (0)
0