1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
_你好, {{ msg }}_

<RedDiv>

_当前计数为: {{ count }}_

</RedDiv>

<button @click="count++">点我!</button>

<script>
import { h, ref } from 'vue'

const RedDiv = (_, ctx) => h(
'div',
{
class: 'red-div',
},
ctx.slots.default()
)

export default {
components: {
RedDiv,
},

setup() {
const msg = 'Markdown 中的 Vue'
const count = ref(0)

return {
msg,
count,
}
}
}
</script>

<style>
.red-div {
color: red;
}
</style>