Skip to content

Commit e9ac8c3

Browse files
committed
docs: add link and mention about vuex 4
1 parent ac6041a commit e9ac8c3

File tree

4 files changed

+53
-52
lines changed

4 files changed

+53
-52
lines changed

docs/.vuepress/config.js

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ module.exports = {
5959
nav: [
6060
{ text: 'Guide', link: '/guide/' },
6161
{ text: 'API Reference', link: '/api/' },
62-
{ text: 'Release Notes', link: 'https://github.com/vuejs/vuex/releases' }
62+
{ text: 'Release Notes', link: 'https://github.com/vuejs/vuex/releases' },
63+
{
64+
text: 'v3.x',
65+
items: [
66+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
67+
]
68+
}
6369
],
6470
sidebar: [
6571
{
@@ -103,7 +109,13 @@ module.exports = {
103109
nav: [
104110
{ text: '指南', link: '/zh/guide/' },
105111
{ text: 'API 参考', link: '/zh/api/' },
106-
{ text: '更新记录', link: 'https://github.com/vuejs/vuex/releases' }
112+
{ text: '更新记录', link: 'https://github.com/vuejs/vuex/releases' },
113+
{
114+
text: 'v3.x',
115+
items: [
116+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
117+
]
118+
}
107119
],
108120
sidebar: [
109121
{
@@ -147,7 +159,13 @@ module.exports = {
147159
nav: [
148160
{ text: 'ガイド', link: '/ja/guide/' },
149161
{ text: 'API リファレンス', link: '/ja/api/' },
150-
{ text: 'リリースノート', link: 'https://github.com/vuejs/vuex/releases' }
162+
{ text: 'リリースノート', link: 'https://github.com/vuejs/vuex/releases' },
163+
{
164+
text: 'v3.x',
165+
items: [
166+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
167+
]
168+
}
151169
],
152170
sidebar: [
153171
{
@@ -191,7 +209,13 @@ module.exports = {
191209
nav: [
192210
{ text: 'Руководство', link: '/ru/guide/' },
193211
{ text: 'Справочник API', link: '/ru/api/' },
194-
{ text: 'История изменений', link: 'https://github.com/vuejs/vuex/releases' }
212+
{ text: 'История изменений', link: 'https://github.com/vuejs/vuex/releases' },
213+
{
214+
text: 'v3.x',
215+
items: [
216+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
217+
]
218+
}
195219
],
196220
sidebar: [
197221
{
@@ -235,7 +259,13 @@ module.exports = {
235259
nav: [
236260
{ text: '가이드', link: '/kr/guide/' },
237261
{ text: 'API 레퍼런스', link: '/kr/api/' },
238-
{ text: '릴리즈 노트', link: 'https://github.com/vuejs/vuex/releases' }
262+
{ text: '릴리즈 노트', link: 'https://github.com/vuejs/vuex/releases' },
263+
{
264+
text: 'v3.x',
265+
items: [
266+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
267+
]
268+
}
239269
],
240270
sidebar: [
241271
{
@@ -279,7 +309,13 @@ module.exports = {
279309
nav: [
280310
{ text: 'Guia', link: '/ptbr/guide/' },
281311
{ text: 'Referência da API', link: '/ptbr/api/' },
282-
{ text: 'Notas da Versão', link: 'https://github.com/vuejs/vuex/releases' }
312+
{ text: 'Notas da Versão', link: 'https://github.com/vuejs/vuex/releases' },
313+
{
314+
text: 'v3.x',
315+
items: [
316+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
317+
]
318+
}
283319
],
284320
sidebar: [
285321
{
@@ -323,7 +359,13 @@ module.exports = {
323359
nav: [
324360
{ text: 'Guide', link: '/fr/guide/' },
325361
{ text: 'API', link: '/fr/api/' },
326-
{ text: 'Notes de version', link: 'https://github.com/vuejs/vuex/releases' }
362+
{ text: 'Notes de version', link: 'https://github.com/vuejs/vuex/releases' },
363+
{
364+
text: 'v3.x',
365+
items: [
366+
{ text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
367+
]
368+
}
327369
],
328370
sidebar: [
329371
{

docs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# What is Vuex?
22

3+
::: tip NOTE
4+
This is the docs for Vuex 3, which works with Vue 2. If you're looking for docs for Vuex 4, which works with Vue 3, [please check it out here](https://next.vuex.vuejs.org/).
5+
:::
6+
37
<VideoPreview />
48

59
Vuex is a **state management pattern + library** for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion. It also integrates with Vue's official [devtools extension](https://github.com/vuejs/vue-devtools) to provide advanced features such as zero-config time-travel debugging and state snapshot export / import.

docs/guide/README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ We will be using ES2015 syntax for code examples for the rest of the docs. If yo
1616

1717
After [installing](../installation.md) Vuex, let's create a store. It is pretty straightforward - just provide an initial state object, and some mutations:
1818

19-
### Vuex 3.x (for Vue 2)
20-
2119
```js
2220
import Vue from 'vue'
2321
import Vuex from 'vuex'
@@ -36,29 +34,6 @@ const store = new Vuex.Store({
3634
})
3735
```
3836

39-
### Vuex 4.x (for Vue 3)
40-
41-
```js
42-
import { createStore } from 'vuex'
43-
import { createApp } from 'vue'
44-
45-
const store = createStore({
46-
state () {
47-
return {
48-
count: 1
49-
}
50-
},
51-
mutations: {
52-
increment (state) {
53-
state.count++
54-
}
55-
}
56-
})
57-
58-
const app = createApp({ /* your root component */ })
59-
app.use(store)
60-
```
61-
6237
Now, you can access the state object as `store.state`, and trigger a state change with the `store.commit` method:
6338

6439
```js

docs/installation.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,23 @@ Include `vuex` after Vue and it will install itself automatically:
1919

2020
```bash
2121
npm install vuex --save
22-
23-
# If using Vue 3.0 + Vuex 4.0:
24-
npm install vuex@next --save
2522
```
2623

2724
## Yarn
2825

2926
```bash
3027
yarn add vuex
31-
32-
# If using Vue 3.0 + Vuex 4.0:
33-
yarn add vuex@next --save
3428
```
3529

3630
When used with a module system, you must explicitly install Vuex as a plugin:
3731

38-
### With Vue 2
39-
4032
```js
4133
import Vue from 'vue'
4234
import Vuex from 'vuex'
4335

4436
Vue.use(Vuex)
4537
```
4638

47-
### With Vue 3
48-
49-
```js
50-
import { createApp } from 'vue'
51-
import { createStore } from 'vuex'
52-
53-
const app = createApp({ ... })
54-
const store = createStore({ ... })
55-
56-
app.use(store)
57-
```
58-
5939
You don't need to do this when using global script tags.
6040

6141
## Promise

0 commit comments

Comments
 (0)