Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitee5eb02

Browse files
committed
fix: add default vendorlist
1 parent5ae63b7 commitee5eb02

File tree

12 files changed

+152
-142
lines changed

12 files changed

+152
-142
lines changed

‎docs/web/config/i18n.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export const i18nConfig: I18nConfig = {
6464
'menu.dataFetch':'Data Fetching',
6565
'menu.communication':'Component Communication',
6666
'menu.usingVite':'Using Vite',
67-
'menu.plugin':'Plugin System',
6867
'menu.build':'Build Output',
6968
'menu.deploy':'Application Deployment',
7069
'menu.csr':'Rendering Degradation',
@@ -126,7 +125,6 @@ export const i18nConfig: I18nConfig = {
126125
'menu.dataFetch':'数据获取',
127126
'menu.communication':'组件通信',
128127
'menu.usingVite':'使用 vite',
129-
'menu.plugin':'插件机制',
130128
'menu.build':'构建产物',
131129
'menu.deploy':'应用部署',
132130
'menu.csr':'渲染降级',

‎docs/web/markdown/en/features/communication.md‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
1-
#组件通信
1+
#Component Communication
22

3-
数据管理是前端开发中重要的一环知识。在组件层级过多时通过`props`传递非常的苦难,我们通常会使用额外的数据管理库来进行数据管理。同样数据管理从最初的`flux`架构到现在最新的`context`思路经过了无数变迁,在业界也有着非常非常多的方案。本章节将讲述在`ssr`框架中我们如何进行数据管理
3+
Data management is an important piece of knowledge in frontend development. When there are too many component levels, passing through`props`becomes very difficult, so we usually use additional data management libraries for data management. Similarly, data management has gone through countless changes from the initial`flux`architecture to the latest`context`thinking, and there are many, many solutions in the industry. This chapter will explain how we perform data management in the`ssr`framework.
44

5-
>在阅读本章节之前,请确保你已经阅读并熟悉这两个章节的内容[目录结构](/docs/features$structure)[数据获取](/docs/features$fetch)
5+
>Before reading this chapter, please ensure you have read and are familiar with these two chapters:[Directory Structure](/docs/features$structure) and[Data Fetching](/docs/features$fetch).
66
7-
##发展历史
7+
##Development History
88

9-
数据管理方案从最早的`flux`架构提出,即`视图层组件不允许直接修改应用状态,只能触发 action。应用的状态必须独立出来放到store里面统一管理,通过侦听 action 来执行具体的状态操作`。也就是大家熟知的`单向数据流`。当然真实应用中,我们不可能所有的状态都放在`store` 中,组件仍然可以拥有并且直接修改自己的`私有状态`
9+
Data management solutions were proposed from the earliest`flux`architecture, which means`view layer components are not allowed to directly modify application state, they can only trigger actions. Application state must be separated and placed instorefor unified management, executing specific state operations by listening to actions`. This is the well-known`unidirectional data flow`. Of course, in real applications, we can't put all states in`store`, components can still own and directly modify their own`private state`.
1010

11-
实现`单向数据流` 又分为两大派系。
11+
Implementing`unidirectional data flow` is divided into two major schools.
1212

13-
分别是`immutable`思想的`react-redux`,`redux-(thunk|sage)`,`dva`,`redux-toolkit` 等等
13+
One is the`immutable`thinking:`react-redux`,`redux-(thunk|sage)`,`dva`,`redux-toolkit`, etc.
1414

15-
以及基于`observer`思想的`mobx`,`vuex` 等等
15+
And the other is based on`observer`thinking:`mobx`,`vuex`, etc.
1616

17-
也有些开发者认为`React+MobX`,就是类型友好的干净版`Vue`, 虽然上述方案没有绝对的优劣之分。但从开发者体验的角度来看基于`observer`思想实现的方案在编写舒适度上是要更优的。
17+
Some developers also think that`React+MobX` is a type-friendly clean version of`Vue`. Although the above solutions don't have absolute advantages or disadvantages, from the perspective of developer experience, solutions implemented based on`observer`thinking are superior in writing comfort.
1818

19-
由于数据管理没有唯一答案,所以在`ssr`框架中我们`可能`会在框架层面提供多种方案让用户进行选择。但我们始终建议使用框架默认支持的方案,不要自行引入外部方案。我们也会不断的完善这一块的内容。
19+
Since data management doesn't have a single answer, in the`ssr`framework, we`may` provide multiple solutions at the framework level for users to choose from. But we always recommend using the framework's default supported solutions and not introducing external solutions on your own. We will also continuously improve this area.
2020

21-
##Vue场景解决方案
21+
##VueScenario Solutions
2222

23-
`Vue`场景中,我们提供了多种数据管理方案,包括大家熟知的[Vuex](https://vuex.vuejs.org/) 。另外,在`Vue3`场景中,我们额外提供了[Provide/Inject](https://v3.cn.vuejs.org/guide/composition-api-provide-inject.html#%E4%BF%AE%E6%94%B9%E5%93%8D%E5%BA%94%E5%BC%8F-property)方案来帮助各位简化这一功能。如果你仍然觉得前面两种方案过于复杂,我们还提供了最简单的`props`直出数据方案。
23+
In`Vue`scenarios, we provide multiple data management solutions, including the well-known[Vuex](https://vuex.vuejs.org/). Additionally, in`Vue3`scenarios, we provide an extra[Provide/Inject](https://v3.cn.vuejs.org/guide/composition-api-provide-inject.html#%E4%BF%AE%E6%94%B9%E5%93%8D%E5%BA%94%E5%BC%8F-property)solution to help simplify this functionality. If you still think the previous two solutions are too complex, we also provide the simplest`props`direct data output solution.
2424

2525
###Vuex
2626

27-
`Vuex` 的具体使用方案,开发者可以查看它的官方文档。这里不进行赘述。在[数据获取](/docs/features$fetch)章节中,我们提出了用`fetch.ts` 来进行数据的获取。在`fetch.ts` 中我们可以拿到`vuex` 的实例来进行相关操作
27+
For specific usage of`Vuex`, developers can refer to its official documentation. We won't elaborate here. In the[Data Fetching](/docs/features$fetch) chapter, we proposed using`fetch.ts` for data fetching. In`fetch.ts`, we can get the`vuex` instance to perform related operations.
28+
2829
###Provide/Inject
2930

30-
`Vue3` 中我们提供了另一种更加轻量级的跨组件数据共享的方式,也就是`Provide/Inject``Vuex``Provide/Inject`主要的区别在于,`Vuex`中的全局状态的每次修改是可以追踪回溯的,而`provide/inject`中变量的修改是无法控制的,换句话说,你不知道是哪个组件修改了这个全局状态。
31+
In`Vue3`, we provide another more lightweight way for cross-component data sharing, which is`Provide/Inject`. The main difference between`Vuex`and`Provide/Inject`is that every modification of global state in`Vuex`can be traced back, while variable modifications in`provide/inject`are uncontrollable. In other words, you don't know which component modified this global state.
3132

32-
在中小型应用中,若你完全不考虑使用`Vuex`来做数据管理的话,那么你可以删除默认的示例`Vuex`全部有关代码以及`store`的定义文件夹。
33+
In small to medium applications, if you completely don't consider using`Vuex`for data management, you can delete all the default example`Vuex`related code and the`store`definition folder.
3334

34-
在渲染的过程中,我们会将`layout fetch``page fetch``返回数据` 组合后以`props` 的形式注入到`layout/index.vue`以及`layout/App.vue`当中,开发者可以在该文件当中`provide`如下所示。
35+
During the rendering process, we will combine the`return data` from`layout fetch`and`page fetch`, then inject it into`layout/index.vue`and`layout/App.vue`in the form of`props`. Developers can`provide`in these files as shown below.
3536

36-
`: Vue2场景也提供该属性,仅用于在layout组件中通过props.asyncData拿到合并后的 fetch 数据做一些逻辑处理,不包含数据管理功能`
37+
`Note: Vue2scenarios also provide this property, only used inlayoutcomponents to get merged fetch data throughprops.asyncDatafor some logical processing, not including data management functionality.`
3738

3839
```html
3940
// layout/App.vue
@@ -54,9 +55,9 @@ export default {
5455
</script>
5556
```
5657

57-
便可以在任意组件中通过`inject`拿到该数据并且可以修改数据自动触发更新,为了防止应用数据混乱,我们建议为不同的组件返回数据添加不同的`namespace`命名空间。同样当路由切换时我们也会自动的将`fetch.ts`返回的数据合并进`asyncData`
58+
Then you can get this data through`inject`in any component and can modify the data to automatically trigger updates. To prevent application data confusion, we recommend adding different`namespace`naming spaces for different components' return data. Similarly, when routes switch, we will automatically merge the data returned by`fetch.ts`into`asyncData`.
5859

59-
为了防止对象失去响应性,这里我们follow`ref对象`的规则。将真正的数据对象存放在`asyncData.value`字段中。并且将整个`asyncData`转换为响应式。这样我们后续可以直接通过修改`asyncData.value = obj` 或者`asyncData.value.key = obj`的方式来修改数据仍然可以让对象`保持响应式`。使用这种方式需要注意的是如果在`template` 中使用的话仍然需要添加`.value`取值不会自动展开。
60+
To prevent objects from losing reactivity, here wefollowthe rules of`refobjects`. We store the real data object in the`asyncData.value`field. And convert the entire`asyncData`to reactive. This way, we can later directly modify data through`asyncData.value = obj` or`asyncData.value.key = obj`and still keep the object`reactive`. When using this method, note that if used in`template`, you still need to add`.value`as the value won't automatically expand.
6061

6162
```html
6263
// 任意组件
@@ -84,15 +85,15 @@ export default {
8485
</script>
8586
```
8687

87-
###props直出数据
88+
###propsDirect Data Output
8889

89-
此功能需要依赖版本`>5.5.43`
90+
This functionality requires dependency version`>5.5.43`.
9091

91-
`provide/inject`的方案中,我们为了不丢失响应性需要使用`.value`的形式来取值具体的数据,并且我们需要为不同页面的`fetch` 返回数据添加不同的`namespace` 来防止属性冲突。这些都是非常有必要的事情。如果开发者认为当前应用不需要任何数据管理方案,我们提供了最简单的`props直出数据` 的方案来使得组件能够拿到`fetch` 返回的数据。
92+
In the`provide/inject`solution, to avoid losing reactivity, we need to use`.value`form to get specific data values, and we need to add different`namespace` for different pages'`fetch` return data to prevent property conflicts. These are all very necessary things. If developers think the current application doesn't need any data management solution, we provide the simplest`propsdirect data output` solution to allow components to get the data returned by`fetch`.
9293

93-
此方案兼容`Vue2/Vue3`。同样支持在`layout/index.vue`,`layout/App.vue` 中获取`fetchData`
94+
This solution is compatible with`Vue2/Vue3`. It also supports getting`fetchData` in`layout/index.vue`,`layout/App.vue`.
9495

95-
`注: 不再建议使用props.fetchData,建议统一替换为props.asyncData`
96+
`Note: No longer recommend usingprops.fetchData,suggest uniformly replacing withprops.asyncData.`
9697

9798
```html
9899
// layout/App.vue

‎docs/web/markdown/en/features/technology.md‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
#技术选型
1+
#Technology Choices
22

3-
本章将介绍`ssr`框架在不同场景的一些技术选型, 建议各位阅读[蚂蚁前端研发最佳实践](https://github.com/sorrycc/blog/issues/90)。我们始终认为,固定一套最佳的技术选型方案远比支持多种多样的技术方案要优秀的多。
3+
This chapter will introduce some technology choices of the`ssr`framework in different scenarios. We recommend reading[Ant Frontend Development Best Practices](https://github.com/sorrycc/blog/issues/90). We always believe that fixing a set of optimal technology choice solutions is far better than supporting diverse technology solutions.
44

5-
##服务端框架技术选型
5+
##Server-Side Framework Technology Choices
66

7-
由于我们是通过插件的机制来进行扩展。所以理论上我们可以支持任何服务端框架。目前官方提供了`Midway.js``Nest.js`的实现方案可以直接使用。如果你想基于其他的Node.js框架封装一个插件也是非常容易的。详见[插件机制](./features$plugin)
7+
Since we extend through plugin mechanisms, theoretically we can support any server-side framework. Currently, the official provides`Midway.js`and`Nest.js`implementation solutions that can be used directly. If you want to encapsulate a plugin based on otherNode.jsframeworks, it's also very easy. See[Plugin Mechanism](./features$plugin) for details.
88

9-
##前端框架技术选型
9+
##Frontend Framework Technology Choices
1010

11-
这里我们支持常见的流行前端框架`React``Vue2``Vue3`。用户可直接使用
11+
Here we support common popular frontend frameworks`React`,`Vue2`,`Vue3`. Users can use them directly.
1212

13-
###React技术选型
13+
###ReactTechnology Choices
1414

15-
-前端框架: React v17,实时跟进 React17的新特性
16-
-开发语言: TypeScript
17-
-代码风格(可选):默认[eslint-config-standard-react-ts](https://github.com/zhangyuang/standardjs-react)
18-
-样式处理: less + css modules(根据后缀名自动识别.module.less文件使用css-modules)
19-
- UI组件: 默认已对`antd`的使用做打包配置无需额外配置
20-
-前端路由: 约定式路由/声明式路由
21-
-数据管理: 使用 Hooks 提供的`useContext`实现极简的跨组件通信方案, 摒弃传统的redux/dva等数据管理方案, 详见[组件通信](./features$communication)
22-
-构建工具:[Webpack](https://webpack.docschina.org/)/[Vite](http://vitejs.dev/)
15+
-Frontend Framework: React v17,keeping up with React17's new features in real-time
16+
-Development Language: TypeScript
17+
-Code Style (optional):Default[eslint-config-standard-react-ts](https://github.com/zhangyuang/standardjs-react)
18+
-Style Processing: less + css modules (automatically recognizes.module.lessfiles usingcss-modules based on file extensions)
19+
- UIComponents: Default packaging configuration for`antd`usage, no additional configuration needed
20+
-Frontend Routing: Conventional routing/Declarative routing
21+
-Data Management: Using Hooks'`useContext`to implement minimal cross-component communication solutions, abandoning traditionalredux/dvaand other data management solutions. See[Component Communication](./features$communication) for details
22+
-Build Tools:[Webpack](https://webpack.docschina.org/)/[Vite](http://vitejs.dev/)
2323

24-
###Vue技术选型
24+
###VueTechnology Choices
2525

26-
-前端框架: Vue2.0, Vue3.0
27-
-开发语言: TypeScript
28-
-代码风格(可选):[eslint-config-standard-vue-ts](https://github.com/zhangyuang/standardjs-vue)
29-
-样式处理: less + vue scoped
30-
- UI组件: 默认已对`vant`的使用做打包配置无需额外配置
31-
-前端路由: 约定式路由/声明式路由
32-
-数据管理:[Vuex](https://vuex.vuejs.org/)/[Provide/Inject](./features$communication#Provide/Inject)
33-
-构建工具:[Webpack](https://webpack.docschina.org/)/[Vite](http://vitejs.dev/)
26+
-Frontend Framework: Vue2.0, Vue3.0
27+
-Development Language: TypeScript
28+
-Code Style (optional):[eslint-config-standard-vue-ts](https://github.com/zhangyuang/standardjs-vue)
29+
-Style Processing: less + vue scoped
30+
- UIComponents: Default packaging configuration for`vant`usage, no additional configuration needed
31+
-Frontend Routing: Conventional routing/Declarative routing
32+
-Data Management:[Vuex](https://vuex.vuejs.org/)/[Provide/Inject](./features$communication#Provide/Inject)
33+
-Build Tools:[Webpack](https://webpack.docschina.org/)/[Vite](http://vitejs.dev/)
3434

35-
####Vue3 + TSX(可选)
35+
####Vue3 + TSX (Optional)
3636

37-
Vue3场景下我们默认在底层已加载[@vue/babel-plugin-jsx](https://github.com/vuejs/jsx-next#installation)插件,开发者可根据个人喜好决定使用template的方式抑或是 tsx的方式进行开发。例如想使用tsx 的话,只需要将.vue文件改为.tsx文件即可。
37+
In Vue3scenarios, we default to loading the[@vue/babel-plugin-jsx](https://github.com/vuejs/jsx-next#installation)plugin at the underlying level. Developers can decide whether to usetemplateor tsxapproaches for development based on personal preferences. For example, if you want to usetsx, you just need to change.vuefiles to.tsxfiles.
3838

39-
`注:Vue3 + volar(VSCode插件) + Piniats支持已经十分优秀,不推荐用Vue3 + TSX的组合。由于babel插件自身的问题,在该场景下Webpack HMR热更新能力存在一定问题,若一定要使用建议配合 Vite 一起使用`
39+
`Note:Vue3 + volar (VSCode plugin) + Pinia'stssupport is already excellent, not recommended to useVue3 + TSXcombination. Due to thebabelplugin's own issues,Webpack HMRhot update capabilities have certain problems in this scenario. If you must use it, it's recommended to use it together with Vite.`
4040

4141
```html
4242
<template>
@@ -74,7 +74,7 @@ export default {
7474
7575
```
7676
77-
对应的tsx写法为
77+
The correspondingtsxwriting method is:
7878
7979
```jsx
8080
// render.tsx
@@ -106,10 +106,10 @@ export default {
106106
107107
```
108108
109-
##注意
109+
##Notes
110110
111-
上述选型是我们经过深思熟虑后总结出来的一套优秀方案。如果开发者一定要用其他方案,例如下面介绍的
111+
The above choices are an excellent solution we've summarized after careful consideration. If developers must use other solutions, such as those introduced below:
112112
113-
-`sass` ,参考[文档](./features$faq#)可通过`chainBaseConfig` 的方式来修改默认的`Webpack` 配置支持。但我们不推荐这么做。`90%`框架的`issue`类型都是由于使用者修改了默认的配置引起的。
114-
-`koa` ,开发一个`ssr`框架的`koa`插件只需要两分钟,但我们仍然不推荐这么做。如果你一定需要选择其他的服务端Node.js框架,请选择相对成熟的
115-
-`redux`, 默认不支持`redux`作为数据管理,同样在未来也并不打算支持。`redux-saga`,`dva`同理,未来也并不打算支持。`useContext`已足够优秀,若一定要选择其他的数据管理方案,在未来我们或许会考虑框架层提供`MobX``redux-toolkit`来作为相对复杂的数据管理方案
113+
-`sass`, refer to [documentation](./features$faq#) can modify default`Webpack` configuration support through`chainBaseConfig` approach. But we don't recommend doing this.`90%`of framework`issue`types are caused by users modifying default configurations.
114+
-`koa`, developing an`ssr`framework`koa`plugin only takes two minutes, but we still don't recommend doing this. If you must choose other server-sideNode.jsframeworks, please choose relatively mature ones.
115+
-`redux`, by default doesn't support`redux`as data management, and we don't plan to support it in the future either.`redux-saga`,`dva`are the same, we don't plan to support them in the future either.`useContext`is already excellent enough. If you must choose other data management solutions, in the future we might consider the framework layer providing`MobX`or`redux-toolkit`as relatively complex data management solutions.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp