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: src/guide/quick-start.md
+14-4
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,9 @@ To get started with Vue without a build step, simply copy the following code int
74
74
<divid="app">{{ message }}</div>
75
75
76
76
<script>
77
-
Vue.createApp({
77
+
const { createApp } = Vue
78
+
79
+
createApp({
78
80
data() {
79
81
return {
80
82
message:'Hello Vue!'
@@ -84,7 +86,11 @@ To get started with Vue without a build step, simply copy the following code int
84
86
</script>
85
87
```
86
88
87
-
The above example uses the global build of Vue where all APIs are exposed under the global `Vue` variable.
89
+
The above example uses the global build of Vue where all APIs are exposed under the global `Vue` variable. For example, to also use the `ref` API, you can do:
90
+
91
+
```js
92
+
const { createApp, ref } = Vue
93
+
```
88
94
89
95
While the global build works, we will be primarily using [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) syntax throughout the rest of the documentation for consistency. In order to use Vue over native ES modules, use the following HTML instead:
90
96
@@ -112,11 +118,15 @@ While the global build works, we will be primarily using [ES modules](https://de
112
118
</script>
113
119
```
114
120
115
-
Notice how we can import directly from `'vue'` in our code - this is made possible by the `<script type="importmap">` block, leveraging a native browser feature called [Import Maps](https://caniuse.com/import-maps). Import maps are currently only available in Chromium-based browsers, so we recommend using Chrome or Edge during the learning process. If your preferred browser does not support import maps yet, you can polyfill it with [es-module-shims](https://github.com/guybedford/es-module-shims).
121
+
Notice how we can import directly from `'vue'` in our code - this is made possible by the `<script type="importmap">` block, leveraging a native browser feature called [Import Maps](https://caniuse.com/import-maps).
116
122
117
123
You can add entries for other dependencies to the import map - just make sure they point to the ES modules version of the library you intend to use.
118
124
119
-
:::tip Not for production
125
+
:::tip Import Maps Browser Support
126
+
Import maps are currently only available in Chromium-based browsers, so we recommend using Chrome or Edge during the learning process. If your preferred browser does not support import maps yet, you can polyfill it with [es-module-shims](https://github.com/guybedford/es-module-shims).
127
+
:::
128
+
129
+
:::warning Not for production
120
130
The import-maps-based setup is meant for learning only - if you intend to use Vue without build tools in production, make sure to check out the [Production Deployment Guide](/guide/best-practices/production-deployment.html#without-build-tools).
0 commit comments