You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/vue.md
+55-63Lines changed: 55 additions & 63 deletions
Original file line number
Diff line number
Diff line change
@@ -1,33 +1,41 @@
1
1
# Vue compatibility
2
2
3
-
Docsify allows [Vue.js](https://vuejs.org) components to be added directly to you Markdown files. These components can greatly simplify working with data and adding reactivity to your content.
3
+
Docsify allows Vue[v2.x](https://vuejs.org) and [v3.x](https://v3.vuejs.org) components to be added directly to you Markdown files. These components can greatly simplify working with data and adding reactivity to your content.
4
4
5
-
To get started, load either the production (minified) or development (unminified) version of Vue in your `index.html`:
5
+
To get started, load either the production or development version of Vue in your `index.html`:
@@ -36,6 +44,8 @@ The HTML above will render the following:
36
44
37
45
Vue components and templates that require `data`, `methods`, computed properties, lifecycle hooks, etc. require manually creating a new `Vue()` instance within a `<script>` tag in your markdown.
38
46
47
+
<!-- prettier-ignore-start -->
48
+
39
49
```markdown
40
50
<div id="example-1">
41
51
<p>{{ message }}</p>
@@ -48,13 +58,19 @@ Vue components and templates that require `data`, `methods`, computed properties
48
58
</div>
49
59
```
50
60
61
+
<!-- prettier-ignore-end -->
62
+
63
+
#### Vue 2.x
64
+
51
65
```markdown
52
66
<script>
53
67
new Vue({
54
68
el: "#example-1",
55
69
data: function() {
56
-
counter: 0,
57
-
message: "Hello, World!"
70
+
return {
71
+
counter: 0,
72
+
message: "Hello, World!"
73
+
};
58
74
},
59
75
methods: {
60
76
hello: function() {
@@ -65,8 +81,30 @@ Vue components and templates that require `data`, `methods`, computed properties
65
81
</script>
66
82
```
67
83
84
+
#### Vue 3.x
85
+
86
+
```markdown
87
+
<script>
88
+
Vue.createApp({
89
+
data: function() {
90
+
return {
91
+
counter: 0,
92
+
message: "Hello, World!"
93
+
};
94
+
},
95
+
methods: {
96
+
hello: function() {
97
+
alert(this.message);
98
+
}
99
+
}
100
+
}).mount("#example-1");
101
+
</script>
102
+
```
103
+
68
104
The HTML & JavaScript above will render the following:
69
105
106
+
<!-- prettier-ignore-start -->
107
+
70
108
<divid="example-1">
71
109
<p>{{ message }}</p>
72
110
@@ -77,64 +115,18 @@ The HTML & JavaScript above will render the following:
77
115
<buttonv-on:click="counter += 1">+</button>
78
116
</div>
79
117
80
-
!> Only the first `<script>` tag in a markdown file is executed. If you are working with multiple Vue components, all `Vue` instances must be created within this tag.
81
-
82
-
## Vuep playgrounds
83
-
84
-
[Vuep](https://github.com/QingWei-Li/vuep) is a Vue component that provides a live editor and preview for Vue content. See the [vuep documentation](https://qingwei-li.github.io/vuep/) for details.
!> Only the first `<script>` tag in a markdown file is executed. If you are working with multiple Vue components, all `Vue` instances must be created within this tag.
0 commit comments