import { defineStoreSlice , Action } from '@dura/react' ; import { store } from './store' ; const deloy = ( ms ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ; const user = defineStoreSlice ( { namespace : 'user' , state : { /** 姓名 */ name : '张三' , } , reducers : { onChangeName ( state , action ) { state . name = action . payload . name ; } , } , effects : { async onAsyncQuery ( action ) { await deloy ( 500 ) ; store . actions . user . onChangeName ( { ... action . payload } ) ; } , } , } ) ; export default user ;