-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
165 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { utils } from '@bestminr/build' | ||
|
||
/** | ||
* 根据路由匹配的页面 中间件 | ||
*/ | ||
const middlewares = [ | ||
{ | ||
path: '/', | ||
methods: 'GET', | ||
handle: (req, res, next) => { | ||
req.injectContext = { | ||
middlewaresContent: { | ||
serverStore: { | ||
hello: 'hello word. 这里可用于 使用服务器内存 缓存数据.' | ||
}, | ||
} | ||
} | ||
console.log('调用了', req.injectContext) | ||
next() | ||
}, | ||
}, | ||
] | ||
|
||
export function middlewaresExtension(app, routerStackManagement: utils.RouterStackManagement) { | ||
routerStackManagement.update(middlewares) | ||
console.log('middlewaresExtension init') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import { Tstore } from "@types" | ||
|
||
export const mutations: Tstore.TcreateUtils.ModuleMutations<Tstore.state, Tstore.MutationPayloads['global']> = { | ||
export const mutations: Tstore.createUtils.ModuleMutations<Tstore.state['global'], Tstore.MutationPayloads['global']> = { | ||
SET_IS_MOBILE: (state, isMobile) => { | ||
console.log('SET_IS_MOBILE', isMobile) | ||
state.isMobile = isMobile | ||
}, | ||
SET_HELLO: (state, { hello }) => { | ||
state.hello = hello | ||
}, | ||
SET_testHotLoadingVuex: (state, { number }) => { | ||
state.testHotLoadingVuex += number * 1 | ||
}, | ||
} | ||
|
||
export default mutations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { Tstore } from '@types' | ||
|
||
export default function state(): Tstore.state { | ||
export default function state(): Tstore.state['global'] { | ||
return { | ||
isMobile: false, | ||
hello: '', | ||
testHotLoadingVuex: 0, | ||
initialReplaceStateUrl: '', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.