Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d7ac625

Browse filesBrowse files
authored
docs(zh): in build-targets.md add "using vuex" (#5883) [skip ci]
1 parent 468986b commit d7ac625
Copy full SHA for d7ac625

File tree

Expand file treeCollapse file tree

1 file changed

+17
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+17
-0
lines changed

‎docs/zh/guide/build-targets.md

Copy file name to clipboardExpand all lines: docs/zh/guide/build-targets.md
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,20 @@ dist/foo.1.js 5.24 kb 1.64 kb
144144
<!-- foo-one 的实现的 chunk 会在用到的时候自动获取 -->
145145
<foo-one></foo-one>
146146
```
147+
148+
## 在构建时使用 vuex
149+
在构建 [Web Components 组件](#web-components-组件)[](#库)时,入口点不是 `main.js` ,而是 `entry-wc.js` 文件,该文件由此生成: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveWcEntry.js
150+
151+
因此,要在 Web Components 组件的目标中使用 vuex ,你需要在 `App.vue` 中初始化存储 (store):
152+
``` js
153+
import store from './store'
154+
155+
// ...
156+
157+
export default {
158+
store,
159+
name: 'App',
160+
// ...
161+
}
162+
```
163+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.