Skip to content

Commit ad2eebe

Browse files
committed
docs: add Vue.version and app.version to the API reference (vuejs/docs@4a437b6)
1 parent 1710366 commit ad2eebe

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/api/application-api.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,27 @@ setTimeout(() => app.unmount(), 5000)
316316
```
317317

318318
- **参照:** [Plugins](../guide/plugins.html)
319+
320+
## version
321+
322+
- **Usage:**
323+
324+
Provides the installed version of Vue as a string. This is especially useful for community [plugins](/guide/plugins.html), where you might use different strategies for different versions.
325+
326+
- **Example:**
327+
328+
```js
329+
export default {
330+
install(app) {
331+
const version = Number(app.version.split('.')[0])
332+
333+
if (version < 3) {
334+
console.warn('This plugin requires Vue 3')
335+
}
336+
337+
// ...
338+
}
339+
}
340+
```
341+
342+
- **See also**: [Global API - version](/api/global-api.html#version)

0 commit comments

Comments
 (0)