Skip to content

Commit a817601

Browse files
yyx990803Jinjiang
authored andcommitted
wip: pending link
1 parent 72629fa commit a817601

File tree

8 files changed

+232
-14
lines changed

8 files changed

+232
-14
lines changed

src/lts/index.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!-- TODO: translation -->
2+
# Vue 2 LTS, EOL & Extended Support
3+
4+
## How long will Vue 2 be supported?
5+
6+
Vue 2.7 is the current, and final minor release of Vue 2.x. Vue 2.7 receives 18 months of LTS (long-term support) starting from its release date on July 1st, 2022. During this period, Vue 2 will receive necessary bug and security fixes, but will no longer receive new features.
7+
8+
**Vue 2 will reach End of Life (EOL) on December 31st, 2023**. After that date, Vue 2 will continue to be available in all existing distribution channels (CDNs and package managers), but will no longer receive updates, including security and browser compatibility fixes.
9+
10+
## Options for dealing with EOL
11+
12+
### Upgrade to Vue 3
13+
14+
Vue 3 is the current, latest major version of Vue. It provides better performance, better TypeScript support, and contains new features that are not present in Vue 2, such as Teleport, Suspense, and multiple root elements per template.
15+
16+
Vue 3 contains breaking changes that make it incompatible with Vue 2, so migration will require a certain level of effort depending on your project. Full details are documented in the [Vue 3 Migration Guide](https://v3-migration.vuejs.org/).
17+
18+
Despite the breaking changes, the majority of Vue APIs are shared between the two major versions, so most of your team's Vue 2 knowledge will continue to work in Vue 3. In the long run, we also intend to avoid major breaking upgrades like the one between Vue 2 and Vue 3. Compatibility and ecosystem stability will be our topmost priority for future releases, and new features will be introduced in a way that does not require major migrations.
19+
20+
### Stay on Vue 2
21+
22+
Some teams may not be able to upgrade to Vue 3 by this timeline due to limited bandwidth, budget, risk tolerance, or reliance on Vue-3-incompatible dependencies. We totally understand this, and want to ensure that staying on Vue 2 beyond EOL is a viable option.
23+
24+
#### The Technical Perspective
25+
26+
From a technical perspective, Vue 2 is a stable and battle-tested piece of technology. If it is serving you well now, it will continue to do so for the foreseeable future.
27+
28+
In addition, we have backported some of the most important Vue 3 features to [Vue 2.7](/v2/guide/migration-vue-2-7.html), including Composition API and `<script setup>`. This allows Vue 2 projects to improve scalability, leverage new ecosystem libraries, and better prepare for potential migration to Vue 3.
29+
30+
Vue 2.7 will also be the maintained release before EOL hits, so if you intend to stay on Vue 2, you should at least upgrade to Vue 2.7.
31+
32+
#### Security & Compliance
33+
34+
For some teams, the main concern lies in security, compliance, and browser compatibility.
35+
36+
- You won't receive security fixes from EOL software. For the record, Vue 2 hasn't really had any real vulnerabilities in the past, but you may need a supported version to fullfil regulations or company policies.
37+
38+
- If you are shipping your application to customers with SLAs. You *will* want to avoid including EOL software in your stack.
39+
40+
- Browsers sometimes ship changes that break legacy libraries. This is extremely rare, but could happen in theory.
41+
42+
To address these concerns, we have partnered with industry experts to provide **Extended LTS for Vue 2**. This service will provide a version of Vue 2 that will continue to receive security and browser compatibility fixes, with SLAs (Service Level Agreements). If you expect to be using Vue 2 beyond the EOL date of December 31st, 2023, make sure to plan ahead.
43+
44+
[Learn more about Extended LTS for Vue 2](TODO:link).

src/v2/guide/migration-vue-2-7.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Migration to Vue 2.7
3+
type: guide
4+
order: 704
5+
---
6+
7+
<!-- TODO: translation -->
8+
9+
Vue 2.7 is the latest minor version of Vue 2. It provides built-in support for the [Composition API](https://vuejs.org/guide/extras/composition-api-faq.html#composition-api-faq).
10+
11+
Despite Vue 3 now being the default version, we understand that there are still many users who have to stay on Vue 2 due to dependency compatibility, browser support requirements, or simply not enough bandwidth to upgrade. In Vue 2.7, we have backported some of the most important features from Vue 3 so that Vue 2 users can benefit from them as well.
12+
13+
## Backported Features
14+
15+
- [Composition API](https://vuejs.org/guide/extras/composition-api-faq.html)
16+
- SFC [`<script setup>`](https://vuejs.org/api/sfc-script-setup.html)
17+
- SFC [CSS v-bind](https://vuejs.org/api/sfc-css-features.html#v-bind-in-css)
18+
19+
In addition, the following APIs are also supported:
20+
21+
- `defineComponent()` with improved type inference (compared to `Vue.extend`)
22+
- `h()`, `useSlot()`, `useAttrs()`, `useCssModules()`
23+
- `set()`, `del()` and `nextTick()` are also provided as named exports in ESM builds.
24+
- The `emits` option is also supported, but only for type-checking purposes (does not affect runtime behavior)
25+
26+
2.7 also supports using ESNext syntax in template expressions. When using a build system, the compiled template render function will go through the same loaders / plugins configured for normal JavaScript. This means if you have configured Babel for `.js` files, it will also apply to the expressions in your SFC templates.
27+
28+
### Notes on API exposure
29+
30+
- In ESM builds, these APIs are provided as named exports (and named exports only):
31+
32+
```js
33+
import Vue, { ref } from "vue";
34+
35+
Vue.ref; // undefined, use named export instead
36+
```
37+
38+
- In UMD and CJS builds, these APIs are exposed as properties on the global `Vue` object.
39+
40+
- When bundling with CJS builds externalized, bundlers should be able to handle ESM interop when externalizing CJS builds.
41+
42+
### Behavior Differences from Vue 3
43+
44+
The Composition API is backported using Vue 2's getter/setter-based reactivity system to ensure browser compatibility. This means there are some important behavior differences from Vue 3's proxy-based system:
45+
46+
- All [Vue 2 change detection caveats](https://v2.vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats) still apply.
47+
48+
- `reactive()`, `ref()`, and `shallowReactive()` will directly convert original objects instead of creating proxies. This means:
49+
50+
```js
51+
// true in 2.7, false in 3.x
52+
reactive(foo) === foo;
53+
```
54+
55+
- `readonly()` **does** create a separate object, but it won't track newly added properties and does not work on arrays.
56+
57+
- Avoid using arrays as root values in `reactive()` because without property access the array's mutation won't be tracked (this will result in a warning).
58+
59+
- Reactivity APIs ignore properties with symbol keys.
60+
61+
In addition, the following features are explicitly **NOT** ported:
62+
63+
-`createApp()` (Vue 2 doesn't have isolated app scope)
64+
- ❌ Top-level `await` in `<script setup>` (Vue 2 does not support async component initialization)
65+
- ❌ TypeScript syntax in template expressions (incompatible w/ Vue 2 parser)
66+
- ❌ Reactivity transform (still experimental)
67+
-`expose` option is not supported for options components (but `defineExpose()` is supported in `<script setup>`).
68+
69+
## Upgrade Guide
70+
71+
### Vue CLI / webpack
72+
73+
1. Upgrade local `@vue/cli-xxx` dependencies the latest version in your major version range (if applicable):
74+
75+
- `~4.5.18` for v4
76+
- `~5.0.6` for v5
77+
78+
2. Upgrade `vue` to `^2.7.0`. You can also remove `vue-template-compiler` from the dependencies - it is no longer needed in 2.7.
79+
80+
Note: if you are using `@vue/test-utils`, you will need to keep `vue-template-compiler` in the dependencies because test utils rely on some APIs only exposed in this package.
81+
82+
3. Check your package manager lockfile to ensure the following dependencies meet the version requirements. They may be transitive dependencies not listed in `package.json`.
83+
84+
- `vue-loader`: `^15.10.0`
85+
- `vue-demi`: `^0.13.1`
86+
87+
If not, you will need to remove `node_modules` and the lockfile and perform a fresh install to ensure they are bumped to the latest version.
88+
89+
4. If you were previously using [`@vue/composition-api`](https://github.com/vuejs/composition-api), update imports from it to `vue` instead. Note that some APIs exported by the plugin, e.g. `createApp`, are not ported in 2.7.
90+
91+
5. Update `eslint-plugin-vue` to latest version (9+) if you run into unused variable lint errors when using `<script setup>`.
92+
93+
6. The SFC compiler for 2.7 now uses PostCSS 8 (upgraded from 7). PostCSS 8 should be backwards compatible with most plugins, but the upgrade **may** cause issues if you were previously using a custom PostCSS plugin that can only work with PostCSS 7. In such cases, you will need to upgrade the relevant plugins to their PostCSS 8 compatible versions.
94+
95+
### Vite
96+
97+
2.7 support for Vite is provided via a new plugin: [@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2). This new plugin requires Vue 2.7 or above and supersedes the existing [vite-plugin-vue2](https://github.com/underfin/vite-plugin-vue2).
98+
99+
Note that the new plugin does not handle Vue-specific JSX / TSX transform, which is intentional. Vue 2 JSX / TSX transform for Vite is handled in a separate, dedicated plugin: [@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx).
100+
101+
### Volar Compatibility
102+
103+
2.7 ships improved type definitions so it is no longer necessary to install `@vue/runtime-dom` just for Volar template type inference support. All you need now is the following config in `tsconfig.json`:
104+
105+
```json
106+
{
107+
// ...
108+
"vueCompilerOptions": {
109+
"target": 2.7
110+
}
111+
}
112+
```
113+
114+
### Devtools Support
115+
116+
Vue Devtools 6.2.0 has added support for inspecting 2.7 Composition API state, but the extensions may still need a few days to go through review on respective publishing platforms.
117+
118+
## Implications of the 2.7 Release
119+
120+
As stated before, 2.7 is the final minor release of Vue 2.x. After this release, Vue 2 has entered LTS (long-term support) which lasts for 18 months from now, and will no longer receive new features.
121+
122+
This means **Vue 2 will reach End of Life on December 31st, 2023**. We believe this should provide plenty of time for most of the ecosystem to migrate over to Vue 3. However, we also understand that there could be teams or projects that cannot upgrade by this timeline while still need to fullfil security and compliance requirements. If your team expects to be using Vue 2 beyond end of 2023, make sure to plan head and understand your options: learn more about [Vue 2 LTS and Extended Support](/lts/).

themes/vue/layout/partials/ecosystem_dropdown.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<li><a href="https://github.com/vuejs/vue/projects/6" class="nav-link" target="_blank" rel="noopener">Roadmap</a></li>
2828
<li><a href="https://events.vuejs.org/" class="nav-link" target="_blank" rel="noopener">活动</a></li>
2929
<li><a href="https://twitter.com/vuejs" class="nav-link" target="_blank" rel="noopener">Twitter</a></li>
30-
<li><a href="https://medium.com/the-vue-point" class="nav-link" target="_blank" rel="noopener">博客</a></li>
30+
<li><a href="https://blog.vuejs.org" class="nav-link" target="_blank" rel="noopener">博客</a></li>
3131
<li><a href="https://vuejobs.com/?ref=vuejs" class="nav-link" target="_blank" rel="noopener">工作</a></li>
3232
<li><a href="https://dev.to/t/vue" class="nav-link" target="_blank" rel="noopener">DEV 社区</a></li>
3333
</ul></li>

themes/vue/layout/partials/header.ejs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<div>
22
<div id="v3-banner">
3-
<span class="hidden-sm">您在浏览的是 v2.x 及更早版本的文档。</span
4-
>v3.x 的文档<a href="https://v3.cn.vuejs.org/">在这里</a>。
3+
<span class="hidden-sm">您正在浏览的是 v2.x 的文档。此外您还可以移步 </span>
4+
<a href="https://cn.vuejs.org/">Vue 3</a>
5+
<span class="hidden-sm"> 的文档,或有关</span><span class="only-sm"> | </span>
6+
<a href="/v2/guide/migration-vue-2-7.html">Vue 2.7</a>
7+
<span class="hidden-sm">和</span><span class="only-sm"> | </span>
8+
<!-- TODO: translation -->
9+
<a href="/lts/">Extended LTS</a><span class="hidden-sm"> 的信息。</span>
510
</div>
611

712
<header id="header">

themes/vue/layout/partials/main_menu.ejs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
</li>
66
<%- partial('partials/learn_dropdown') %>
77
<%- partial('partials/ecosystem_dropdown') %>
8+
<%- partial('partials/resources_dropdown') %>
89
<li>
9-
<a href="<%- url_for("/v2/guide/team.html") %>" class="nav-link team<%- page.path.match(/team\.html/) ? ' current' : '' %>">团队</a>
10+
<!-- TODO: translation -->
11+
<a href="/lts/" class="badge-parent">Extended LTS<sup class="badge">新</sup></a>
1012
</li>
11-
<%- partial('partials/resources_dropdown') %>
12-
<!-- <li>
13-
<a href="<%- url_for("/partners") %>" class="nav-link <%- page.path.match(/partners/) ? 'current' : '' %>">Partners</a>
14-
</li> -->
15-
<%- partial('partials/support_vue_dropdown') %>
1613
<%- partial('partials/language_dropdown') %>
1714
<!-- start: special logic for cn -->
1815
<li><a href="https://github.com/vuejs/v2.cn.vuejs.org/" target="_blank" class="nav-link contribute">参与翻译</a></li>
Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
11
<li class="nav-dropdown-container resources">
22
<a href="#" class="nav-link">资源列表</a><span class="arrow"></span>
33
<ul class="nav-dropdown">
4-
<li><a href="<%- url_for("/resources/partners.html") %>" class="nav-link">合作伙伴</a></li>
5-
<li><a href="<%- url_for("/resources/themes.html") %>" class="nav-link">主题</a></li>
6-
<li><a href="https://github.com/vuejs/awesome-vue" class="nav-link" target="_blank" rel="noopener">Awesome Vue</a></li>
7-
<li><a href="https://awesomejs.dev/for/vue/" class="nav-link" target="_blank" rel="noopener">浏览和 Vue 相关的包</a></li>
4+
<li>
5+
<a
6+
href="https://cn.vuejs.org/about/team.html"
7+
class="nav-link team<%- page.path.match(/team\.html/) ? ' current' : '' %>"
8+
>团队</a
9+
>
10+
</li>
11+
<li>
12+
<a href="https://cn.vuejs.org/sponsor/">赞助商</a>
13+
</li>
14+
<li><a href="https://cn.vuejs.org/partners/" class="nav-link">合作伙伴</a></li>
15+
<li>
16+
<a href="https://cn.vuejs.org/resources/themes.html" class="nav-link"
17+
>主题</a
18+
>
19+
</li>
20+
<li>
21+
<a
22+
href="https://github.com/vuejs/awesome-vue"
23+
class="nav-link"
24+
target="_blank"
25+
rel="noopener"
26+
>Awesome Vue</a
27+
>
28+
</li>
29+
<li>
30+
<a
31+
href="https://awesomejs.dev/for/vue/"
32+
class="nav-link"
33+
target="_blank"
34+
rel="noopener"
35+
>浏览和 Vue 相关的包</a
36+
>
37+
</li>
838
</ul>
939
</li>

themes/vue/layout/sponsors-page.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ window.addEventListener('hashchange', function () {
136136
<!-- <h3 id="special-sponsors-china">Platinum Sponsors (China)</h3>
137137
138138
<p class="platinum">
139-
<%_ for (const sponsor of theme.platinum_china) {_%>
139+
<%_ for (const sponsor of theme.platinum_china || []) {_%>
140140
<a href="<%- sponsor.url %>" target="_blank" rel="noopener">
141141
<img src="<%- logo(sponsor.img) %>"<%- (sponsor.big_width || sponsor.big_height) ? ` style="${sponsor.big_width ? `width:${sponsor.big_width};`: ``}${sponsor.big_height ? `height:${sponsor.big_height};` : ``}"` : `` %>>
142142
</a>

themes/vue/source/css/_header.styl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ red-dot-before(leftPos = -8px)
3333
a
3434
color: #fff
3535
font-weight: bold
36+
.only-sm
37+
display: none
38+
margin: 0 5px
3639

3740
@media screen and (max-width: 900px)
3841
.hidden-sm
3942
display: none
43+
.only-sm
44+
display: inline
4045

4146
body.docs
4247
#header
@@ -79,6 +84,21 @@ body.docs
7984
left: 8px
8085
&.new::before
8186
red-dot-before(8px)
87+
a.badge-parent
88+
padding-right 26px
89+
position relative
90+
sup.badge
91+
position absolute
92+
top -4px
93+
margin-left 4px
94+
background-color $green
95+
color #fff
96+
height 14px
97+
font-size 10px
98+
line-height 1
99+
font-weight bold
100+
border-radius 4px
101+
padding 3px 4px 0
82102

83103
.nav-link
84104
padding-bottom: 3px

0 commit comments

Comments
 (0)