Skip to content

Commit 0ebf18c

Browse files
vinicius73chrisvfritz
authored andcommitted
add Vue.version into API (vuejs#755)
* add Vue.version into API * Update Vue version API
1 parent 3f13daa commit 0ebf18c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/v2/api/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,24 @@ type: api
329329
```
330330

331331
- **See also:** [Render Functions](../guide/render-function.html)
332+
333+
<h3 id="Vue-version">Vue.version</h3>
334+
335+
- **Details**: Provides the installed version of Vue as a string. This is especially useful for community plugins and components, where you might use different strategies for different versions.
336+
337+
- **Usage**:
338+
339+
```js
340+
var version = Number(Vue.version.split('.')[0])
341+
342+
if (version === 2) {
343+
// Vue v2.x.x
344+
} else if (version === 1) {
345+
// Vue v1.x.x
346+
} else {
347+
// Unsupported versions of Vue
348+
}
349+
```
332350

333351
## Options / Data
334352

0 commit comments

Comments
 (0)