Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/api/application-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,27 @@ setTimeout(() => app.unmount(), 5000)
```

- **See also:** [Plugins](../guide/plugins.html)

## version

- **Usage:**

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.

- **Example:**

```js
export default {
install(app) {
const version = Number(app.version.split('.')[0])

if (version < 3) {
console.warn('This plugin requires Vue 3')
}

// ...
}
}
```

- **See also**: [Global API - version](/api/global-api.html#version)
18 changes: 18 additions & 0 deletions src/api/global-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,21 @@ Accepts one argument: `name`
- **Details:**

The name of the CSS module. Defaults to `'$style'`.

## version

Provides the installed version of Vue as a string.

```js
const version = Number(Vue.version.split('.')[0])

if (version === 3) {
// Vue 3
} else if (version === 2) {
// Vue 2
} else {
// Unsupported versions of Vue
}
```

**See also**: [Application API - version](/api/application-api.html#version)