瀏覽代碼

docs: add link and mention about vuex 4

Kia Ishii 4 年之前
父節點
當前提交
e9ac8c3a8e
共有 4 個文件被更改,包括 53 次插入52 次删除
  1. 49 7
      docs/.vuepress/config.js
  2. 4 0
      docs/README.md
  3. 0 25
      docs/guide/README.md
  4. 0 20
      docs/installation.md

+ 49 - 7
docs/.vuepress/config.js

@@ -59,7 +59,13 @@ module.exports = {
         nav: [
           { text: 'Guide', link: '/guide/' },
           { text: 'API Reference', link: '/api/' },
-          { text: 'Release Notes', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: 'Release Notes', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {
@@ -103,7 +109,13 @@ module.exports = {
         nav: [
           { text: '指南', link: '/zh/guide/' },
           { text: 'API 参考', link: '/zh/api/' },
-          { text: '更新记录', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: '更新记录', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {
@@ -147,7 +159,13 @@ module.exports = {
         nav: [
           { text: 'ガイド', link: '/ja/guide/' },
           { text: 'API リファレンス', link: '/ja/api/' },
-          { text: 'リリースノート', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: 'リリースノート', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {
@@ -191,7 +209,13 @@ module.exports = {
         nav: [
           { text: 'Руководство', link: '/ru/guide/' },
           { text: 'Справочник API', link: '/ru/api/' },
-          { text: 'История изменений', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: 'История изменений', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {
@@ -235,7 +259,13 @@ module.exports = {
         nav: [
           { text: '가이드', link: '/kr/guide/' },
           { text: 'API 레퍼런스', link: '/kr/api/' },
-          { text: '릴리즈 노트', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: '릴리즈 노트', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {
@@ -279,7 +309,13 @@ module.exports = {
         nav: [
           { text: 'Guia', link: '/ptbr/guide/' },
           { text: 'Referência da API', link: '/ptbr/api/' },
-          { text: 'Notas da Versão', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: 'Notas da Versão', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {
@@ -323,7 +359,13 @@ module.exports = {
         nav: [
           { text: 'Guide', link: '/fr/guide/' },
           { text: 'API', link: '/fr/api/' },
-          { text: 'Notes de version', link: 'https://github.com/vuejs/vuex/releases' }
+          { text: 'Notes de version', link: 'https://github.com/vuejs/vuex/releases' },
+          {
+            text: 'v3.x',
+            items: [
+              { text: 'v4.x', link: 'https://next.vuex.vuejs.org/' }
+            ]
+          }
         ],
         sidebar: [
           {

+ 4 - 0
docs/README.md

@@ -1,5 +1,9 @@
 # What is Vuex?
 
+::: tip NOTE
+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/).
+:::
+
 <VideoPreview />
 
 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.

+ 0 - 25
docs/guide/README.md

@@ -16,8 +16,6 @@ We will be using ES2015 syntax for code examples for the rest of the docs. If yo
 
 After [installing](../installation.md) Vuex, let's create a store. It is pretty straightforward - just provide an initial state object, and some mutations:
 
-### Vuex 3.x (for Vue 2)
-
 ```js
 import Vue from 'vue'
 import Vuex from 'vuex'
@@ -36,29 +34,6 @@ const store = new Vuex.Store({
 })
 ```
 
-### Vuex 4.x (for Vue 3)
-
-```js
-import { createStore } from 'vuex'
-import { createApp } from 'vue'
-
-const store = createStore({
-  state () {
-    return {
-      count: 1
-    }
-  },
-  mutations: {
-    increment (state) {
-      state.count++
-    }
-  }
-})
-
-const app = createApp({ /* your root component */ })
-app.use(store)
-```
-
 Now, you can access the state object as `store.state`, and trigger a state change with the `store.commit` method:
 
 ```js

+ 0 - 20
docs/installation.md

@@ -19,24 +19,16 @@ Include `vuex` after Vue and it will install itself automatically:
 
 ```bash
 npm install vuex --save
-
-# If using Vue 3.0 + Vuex 4.0:
-npm install vuex@next --save
 ```
 
 ## Yarn
 
 ```bash
 yarn add vuex
-
-# If using Vue 3.0 + Vuex 4.0:
-yarn add vuex@next --save
 ```
 
 When used with a module system, you must explicitly install Vuex as a plugin:
 
-### With Vue 2
-
 ```js
 import Vue from 'vue'
 import Vuex from 'vuex'
@@ -44,18 +36,6 @@ import Vuex from 'vuex'
 Vue.use(Vuex)
 ```
 
-### With Vue 3
-
-```js
-import { createApp } from 'vue'
-import { createStore } from 'vuex'
-
-const app = createApp({ ... })
-const store = createStore({ ... })
-
-app.use(store)
-```
-
 You don't need to do this when using global script tags.
 
 ## Promise