-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(materials): useResource spilt & Message notification for material loading life cycle #716
base: refactor/develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# useResource | ||
## state | ||
```js | ||
const resState = reactive({ | ||
dataSource: [], // 数据源 | ||
pageTree: [], // 大纲数 | ||
langs: {}, // i18n | ||
utils: {}, // 工具类 | ||
globalState: [] // 全局信息 | ||
}) | ||
|
||
``` | ||
|
||
## api | ||
|
||
### fetchResource | ||
|
||
#### 作用 | ||
1. 获取appData | ||
2. 用appData初始化或者刷新state | ||
3. 调用useMaterial.initMaterialModule初始化物料模块 | ||
4. 初始化当前画布显示的页面或者区块 initPageorBlock | ||
5. 刷新i18n | ||
#### 在哪里被调用 | ||
1. app.vue 在canvas ready后,作为资源初始化 | ||
2. BlockGroupPanel 在新增消费的区块时调用,用作刷新相关数据 | ||
|
||
### handlePopStateEvent | ||
#### 作用 | ||
1. 能够在路由发生改变时init当前的页面和block | ||
2. 刷新i18n | ||
#### 在哪里被调用 | ||
1. app.vue 绑定pop state的事件监听 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use fenced code blocks for better readability. Indented code blocks are not the recommended style for markdown. Use fenced code blocks instead. - 1. 能够在路由发生改变时init当前的页面和block
- 2. 刷新i18n
+```
+1. 能够在路由发生改变时init当前的页面和block
+2. 刷新i18n
+``` ToolsMarkdownlint
|
||
|
||
## 可改造的点(数据流解决后) | ||
1. 利用数据流的通信,将appData获取后发送事件通知 | ||
2. 将fetchResource调用useMaterial.initMaterialModule初始化物料模块提出,解耦useMaterial。 | ||
3. 将 fetchResource调用 initPageorBlock 抽取出来,同2一样,使用事件通信 | ||
4. 将 handlePopStateEvent 抽取出来 | ||
5. 看一下APP.vue是一个什么样的角色,如果app.vue里可以调用上面的几个元服务,那么2,3,4都可以直接写在app.vue中。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use fenced code blocks for better readability. Indented code blocks are not the recommended style for markdown. Use fenced code blocks instead. - 1. 利用数据流的通信,将appData获取后发送事件通知
- 2. 将fetchResource调用useMaterial.initMaterialModule初始化物料模块提出,解耦useMaterial。
- 3. 将 fetchResource调用 initPageorBlock 抽取出来,同2一样,使用事件通信
- 4. 将 handlePopStateEvent 抽取出来
- 5. 看一下APP.vue是一个什么样的角色,如果app.vue里可以调用上面的几个元服务,那么2,3,4都可以直接写在app.vue中。
+```
+1. 利用数据流的通信,将appData获取后发送事件通知
+2. 将fetchResource调用useMaterial.initMaterialModule初始化物料模块提出,解耦useMaterial。
+3. 将 fetchResource调用 initPageorBlock 抽取出来,同2一样,使用事件通信
+4. 将 handlePopStateEvent 抽取出来
+5. 看一下APP.vue是一个什么样的角色,如果app.vue里可以调用上面的几个元服务,那么2,3,4都可以直接写在app.vue中。
+``` ToolsMarkdownlint
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fenced code blocks for better readability.
Indented code blocks are not the recommended style for markdown. Use fenced code blocks instead.
Tools
Markdownlint